#ifndef ROO_EXPENSIVE_OBJECT_CACHE
#define ROO_EXPENSIVE_OBJECT_CACHE
#include "Rtypes.h"
#include "RooArgSet.h"
#include "TString.h"
#include <list>
#include <map>
class RooExpensiveObjectCache : public TObject {
public:
RooExpensiveObjectCache() ;
RooExpensiveObjectCache(const RooExpensiveObjectCache&) ;
virtual ~RooExpensiveObjectCache() ;
Bool_t registerObject(const char* ownerName, const char* objectName, TObject& cacheObject, TIterator* paramIter) ;
Bool_t registerObject(const char* ownerName, const char* objectName, TObject& cacheObject, const RooArgSet& params) ;
const TObject* retrieveObject(const char* name, TClass* tclass, const RooArgSet& params) ;
const TObject* getObj(Int_t uniqueID) ;
Bool_t clearObj(Int_t uniqueID) ;
Bool_t setObj(Int_t uniqueID, TObject* obj) ;
void clearAll() ;
void importCacheObjects(RooExpensiveObjectCache& other, const char* ownerName, Bool_t verbose=kFALSE) ;
static RooExpensiveObjectCache& instance() ;
Int_t size() const { return _map.size() ; }
static void cleanup() ;
void print() const ;
class ExpensiveObject {
public:
ExpensiveObject() { _payload = 0 ; } ;
ExpensiveObject(Int_t uid, const char* ownerName, TObject& payload, TIterator* paramIter) ;
ExpensiveObject(Int_t uid, const ExpensiveObject& other) ;
virtual ~ExpensiveObject() ;
Bool_t matches(TClass* tc, const RooArgSet& params) ;
Int_t uid() const { return _uid ; }
const TObject* payload() const { return _payload ; }
TObject* payload() { return _payload ; }
void setPayload(TObject* obj) { _payload = obj ; }
const char* ownerName() const { return _ownerName.Data() ; }
void print() ;
protected:
Int_t _uid ;
TObject* _payload ;
std::map<TString,Double_t> _realRefParams ;
std::map<TString,Int_t> _catRefParams ;
TString _ownerName ;
ClassDef(ExpensiveObject,2) ;
} ;
protected:
Int_t _nextUID ;
static RooExpensiveObjectCache* _instance ;
std::map<TString,ExpensiveObject*> _map ;
ClassDef(RooExpensiveObjectCache,2)
};
#endif
RooExpensiveObjectCache.h:1 RooExpensiveObjectCache.h:2 RooExpensiveObjectCache.h:3 RooExpensiveObjectCache.h:4 RooExpensiveObjectCache.h:5 RooExpensiveObjectCache.h:6 RooExpensiveObjectCache.h:7 RooExpensiveObjectCache.h:8 RooExpensiveObjectCache.h:9 RooExpensiveObjectCache.h:10 RooExpensiveObjectCache.h:11 RooExpensiveObjectCache.h:12 RooExpensiveObjectCache.h:13 RooExpensiveObjectCache.h:14 RooExpensiveObjectCache.h:15 RooExpensiveObjectCache.h:16 RooExpensiveObjectCache.h:17 RooExpensiveObjectCache.h:18 RooExpensiveObjectCache.h:19 RooExpensiveObjectCache.h:20 RooExpensiveObjectCache.h:21 RooExpensiveObjectCache.h:22 RooExpensiveObjectCache.h:23 RooExpensiveObjectCache.h:24 RooExpensiveObjectCache.h:25 RooExpensiveObjectCache.h:26 RooExpensiveObjectCache.h:27 RooExpensiveObjectCache.h:28 RooExpensiveObjectCache.h:29 RooExpensiveObjectCache.h:30 RooExpensiveObjectCache.h:31 RooExpensiveObjectCache.h:32 RooExpensiveObjectCache.h:33 RooExpensiveObjectCache.h:34 RooExpensiveObjectCache.h:35 RooExpensiveObjectCache.h:36 RooExpensiveObjectCache.h:37 RooExpensiveObjectCache.h:38 RooExpensiveObjectCache.h:39 RooExpensiveObjectCache.h:40 RooExpensiveObjectCache.h:41 RooExpensiveObjectCache.h:42 RooExpensiveObjectCache.h:43 RooExpensiveObjectCache.h:44 RooExpensiveObjectCache.h:45 RooExpensiveObjectCache.h:46 RooExpensiveObjectCache.h:47 RooExpensiveObjectCache.h:48 RooExpensiveObjectCache.h:49 RooExpensiveObjectCache.h:50 RooExpensiveObjectCache.h:51 RooExpensiveObjectCache.h:52 RooExpensiveObjectCache.h:53 RooExpensiveObjectCache.h:54 RooExpensiveObjectCache.h:55 RooExpensiveObjectCache.h:56 RooExpensiveObjectCache.h:57 RooExpensiveObjectCache.h:58 RooExpensiveObjectCache.h:59 RooExpensiveObjectCache.h:60 RooExpensiveObjectCache.h:61 RooExpensiveObjectCache.h:62 RooExpensiveObjectCache.h:63 RooExpensiveObjectCache.h:64 RooExpensiveObjectCache.h:65 RooExpensiveObjectCache.h:66 RooExpensiveObjectCache.h:67 RooExpensiveObjectCache.h:68 RooExpensiveObjectCache.h:69 RooExpensiveObjectCache.h:70 RooExpensiveObjectCache.h:71 RooExpensiveObjectCache.h:72 RooExpensiveObjectCache.h:73 RooExpensiveObjectCache.h:74 RooExpensiveObjectCache.h:75 RooExpensiveObjectCache.h:76 RooExpensiveObjectCache.h:77 RooExpensiveObjectCache.h:78 RooExpensiveObjectCache.h:79 RooExpensiveObjectCache.h:80 RooExpensiveObjectCache.h:81 RooExpensiveObjectCache.h:82 RooExpensiveObjectCache.h:83 RooExpensiveObjectCache.h:84 RooExpensiveObjectCache.h:85 RooExpensiveObjectCache.h:86 RooExpensiveObjectCache.h:87 RooExpensiveObjectCache.h:88 RooExpensiveObjectCache.h:89 RooExpensiveObjectCache.h:90 RooExpensiveObjectCache.h:91