Warning, file /include/root/RooExpensiveObjectCache.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_EXPENSIVE_OBJECT_CACHE
0017 #define ROO_EXPENSIVE_OBJECT_CACHE
0018
0019 #include "TObject.h"
0020 #include "RooArgSet.h"
0021 #include "TString.h"
0022 #include <map>
0023
0024 class RooExpensiveObjectCache : public TObject {
0025 public:
0026
0027 RooExpensiveObjectCache() {}
0028 RooExpensiveObjectCache(const RooExpensiveObjectCache& other) : TObject(other) {}
0029 ~RooExpensiveObjectCache() override ;
0030
0031 bool registerObject(const char* ownerName, const char* objectName, TObject& cacheObject, const RooArgSet& params) ;
0032 const TObject* retrieveObject(const char* name, TClass* tclass, const RooArgSet& params) ;
0033
0034 const TObject* getObj(Int_t uniqueID) ;
0035 bool clearObj(Int_t uniqueID) ;
0036 bool setObj(Int_t uniqueID, TObject* obj) ;
0037 void clearAll() ;
0038
0039 void importCacheObjects(RooExpensiveObjectCache& other, const char* ownerName, bool verbose=false) ;
0040
0041 static RooExpensiveObjectCache& instance() ;
0042
0043 Int_t size() const { return _map.size() ; }
0044 bool empty() const { return _map.empty() ; }
0045
0046 void print() const ;
0047
0048 class ExpensiveObject {
0049 public:
0050 ExpensiveObject() = default;
0051 ExpensiveObject(Int_t uid, const char *ownerName, TObject &payload, RooArgSet const ¶ms);
0052 ExpensiveObject(Int_t uid, const ExpensiveObject &other);
0053 virtual ~ExpensiveObject();
0054 bool matches(TClass *tc, const RooArgSet ¶ms);
0055
0056 Int_t uid() const { return _uid; }
0057 const TObject *payload() const { return _payload; }
0058 TObject *payload() { return _payload; }
0059 void setPayload(TObject *obj) { _payload = obj; }
0060 const char *ownerName() const { return _ownerName.Data(); }
0061
0062 void print() const;
0063
0064 protected:
0065 Int_t _uid = 0;
0066 TObject *_payload = nullptr;
0067 std::map<TString, double> _realRefParams;
0068 std::map<TString, Int_t> _catRefParams;
0069 TString _ownerName;
0070
0071 ClassDef(ExpensiveObject, 2);
0072 };
0073
0074 protected:
0075
0076 Int_t _nextUID = 0;
0077
0078 std::map<TString,ExpensiveObject*> _map ;
0079
0080
0081 ClassDefOverride(RooExpensiveObjectCache,2)
0082 };
0083
0084 #endif