| 1 | #ifndef MARS_MParList
|
|---|
| 2 | #define MARS_MParList
|
|---|
| 3 |
|
|---|
| 4 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 5 | // //
|
|---|
| 6 | // MParList //
|
|---|
| 7 | // //
|
|---|
| 8 | // List of parameter containers (MParContainer) //
|
|---|
| 9 | // //
|
|---|
| 10 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 11 |
|
|---|
| 12 | #ifndef ROOT_TObjArray
|
|---|
| 13 | #include <TObjArray.h>
|
|---|
| 14 | #endif
|
|---|
| 15 | #ifndef MARS_MParContainer
|
|---|
| 16 | #include "MParContainer.h"
|
|---|
| 17 | #endif
|
|---|
| 18 |
|
|---|
| 19 | class TClass;
|
|---|
| 20 | class TOrdCollection;
|
|---|
| 21 |
|
|---|
| 22 | class MLog;
|
|---|
| 23 | class MTask;
|
|---|
| 24 | class MTaskList;
|
|---|
| 25 |
|
|---|
| 26 | class MParList : public MParContainer
|
|---|
| 27 | {
|
|---|
| 28 | private:
|
|---|
| 29 | TOrdCollection *fContainer; // Collection of Parameter and Data Containers
|
|---|
| 30 | TOrdCollection *fAutodelete; //! All what this list contains is deleted in the destructor
|
|---|
| 31 |
|
|---|
| 32 | static TString GetClassName(const char *classname);
|
|---|
| 33 | static TString GetObjectName(const char *classname, const char *objname);
|
|---|
| 34 |
|
|---|
| 35 | enum { kIsOwner = BIT(14) };
|
|---|
| 36 |
|
|---|
| 37 | void StreamPrimitive(ostream &out) const;
|
|---|
| 38 |
|
|---|
| 39 | void Init(const char *name, const char *title);
|
|---|
| 40 |
|
|---|
| 41 | public:
|
|---|
| 42 | enum { kDoNotReset = BIT(17), kIsProcessing = BIT(18) };
|
|---|
| 43 |
|
|---|
| 44 | MParList(const char *name=NULL, const char *title=NULL);
|
|---|
| 45 | MParList(const MParList &ts, const char *name=NULL, const char *title=NULL);
|
|---|
| 46 |
|
|---|
| 47 | virtual ~MParList();
|
|---|
| 48 |
|
|---|
| 49 | Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL);
|
|---|
| 50 | void AddToList(TObjArray *list);
|
|---|
| 51 |
|
|---|
| 52 | Bool_t Replace(MParContainer *obj);
|
|---|
| 53 | void Remove(MParContainer *obj);
|
|---|
| 54 |
|
|---|
| 55 | void SetLogStream(MLog *log);
|
|---|
| 56 | void SetDisplay(MStatusDisplay *d);
|
|---|
| 57 |
|
|---|
| 58 | TObject *FindObject(const char *name) const;
|
|---|
| 59 | TObject *FindObject(const TObject *obj) const;
|
|---|
| 60 |
|
|---|
| 61 | TObject *FindObject(const char *name, const char *classname) const;
|
|---|
| 62 | TObject *FindObject(const TObject *obj, const char *classname) const;
|
|---|
| 63 |
|
|---|
| 64 | MTask *FindTask(const char *name, const char *tlist="MTaskList") const;
|
|---|
| 65 | MTaskList *FindTaskListWithTask(const char *name) const;
|
|---|
| 66 | MTaskList *FindTaskListWithTask(const MTask *task) const;
|
|---|
| 67 |
|
|---|
| 68 | MParContainer *FindCreateObj(const char *classname, const char *objname=NULL);
|
|---|
| 69 |
|
|---|
| 70 | TObjArray FindObjectList(const char *name, UInt_t first, const UInt_t last) const;
|
|---|
| 71 | TObjArray FindObjectList(const char *name, const UInt_t num) const
|
|---|
| 72 | {
|
|---|
| 73 | return FindObjectList(name, 0, num);
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | TObjArray FindCreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname=NULL);
|
|---|
| 77 | TObjArray FindCreateObjList(const char *cname, const UInt_t num, const char *oname=NULL)
|
|---|
| 78 | {
|
|---|
| 79 | return FindCreateObjList(cname, 0, num, oname);
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | static TObjArray CreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname=NULL);
|
|---|
| 83 | static TObjArray CreateObjList(const char *cname, const UInt_t num, const char *oname=NULL)
|
|---|
| 84 | {
|
|---|
| 85 | return CreateObjList(cname, 0, num, oname);
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | void Reset();
|
|---|
| 89 | void SetReadyToSave(Bool_t flag=kTRUE);
|
|---|
| 90 |
|
|---|
| 91 | void SetOwner(Bool_t enable=kTRUE);
|
|---|
| 92 | Bool_t IsOwner() const { return TestBit(kIsOwner); }
|
|---|
| 93 |
|
|---|
| 94 | void Print(Option_t *t = NULL) const;
|
|---|
| 95 |
|
|---|
| 96 | void GetNames(TObjArray &arr) const;
|
|---|
| 97 | void SetNames(TObjArray &arr);
|
|---|
| 98 |
|
|---|
| 99 | void SavePrimitive(ostream &out, Option_t *o="");
|
|---|
| 100 | void SavePrimitive(ofstream &out, Option_t *o="");
|
|---|
| 101 |
|
|---|
| 102 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
|
|---|
| 103 | Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
|
|---|
| 104 |
|
|---|
| 105 | operator TIterator*() const;
|
|---|
| 106 |
|
|---|
| 107 | ClassDef(MParList, 1) // list of parameter containers (MParContainer)
|
|---|
| 108 | };
|
|---|
| 109 |
|
|---|
| 110 | #endif
|
|---|