source: trunk/Mars/mbase/MParList.h@ 12629

Last change on this file since 12629 was 8642, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 3.7 KB
Line 
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
19class TClass;
20class TOrdCollection;
21
22class MLog;
23class MTask;
24class MTaskList;
25
26class MParList : public MParContainer
27{
28private:
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
41public:
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 RecursiveRemove(TObject *obj);
89
90 void Reset();
91 void SetReadyToSave(Bool_t flag=kTRUE);
92
93 void SetOwner(Bool_t enable=kTRUE);
94 Bool_t IsOwner() const { return TestBit(kIsOwner); }
95
96 void Print(Option_t *t = NULL) const;
97
98 void GetNames(TObjArray &arr) const;
99 void SetNames(TObjArray &arr);
100
101 void SavePrimitive(ostream &out, Option_t *o="");
102 void SavePrimitive(ofstream &out, Option_t *o="");
103
104 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
105 Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
106
107 operator TIterator*() const;
108
109 ClassDef(MParList, 1) // list of parameter containers (MParContainer)
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.