From 998aaf3603474fc738b6a108ba5db02c4c493201 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 27 Sep 2004 09:21:34 +0000 Subject: [PATCH] Patch level : 2.2 020 Files correlati : sv0.exe sv1.exe sv2.exe Ricompilazione Demo : [ ] Commento : Bug 0000138 Implementare la gestione multilingua E' stato anche velocizzato il programma di statistiche personalizzate. Andrebbe testato confrontando i rsultati con la 2.0 git-svn-id: svn://10.65.10.50/trunk@12346 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- mg/mglib.h | 1 + mg/mglib02.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/mg/mglib.h b/mg/mglib.h index beccd91aa..c5b26093d 100755 --- a/mg/mglib.h +++ b/mg/mglib.h @@ -705,6 +705,7 @@ const char * add_depcode(TString & codmagdep, const char * d); const char * get_magcode(TString & codmagdep); const char * get_depcode(TString & codmagdep); bool riporta_ordinato(); +const TArticolo & cached_articolo(const char * codsrt); #endif //__MGLIB_H diff --git a/mg/mglib02.cpp b/mg/mglib02.cpp index 721e4e300..4f3dbb66e 100755 --- a/mg/mglib02.cpp +++ b/mg/mglib02.cpp @@ -415,6 +415,23 @@ TArticolo::~TArticolo() { } +class TArticoli_cache : public TCache +{ +protected: + virtual TObject * key2obj(const char * articolo) { return new TArticolo(articolo); } +public: + const TArticolo & get(const char * articolo) { return *(const TArticolo *) objptr(articolo);} +}; + +const TArticolo & cached_articolo(const char * articolo) +{ + static TArticoli_cache * art_cache = NULL; + + if (art_cache == NULL) + art_cache = new TArticoli_cache(); + return art_cache->get(articolo); +} + // ***************** // TArticolo_giacenza