source: trunk/MagicSoft/Mars/mbase/MParList.h@ 1938

Last change on this file since 1938 was 1880, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.2 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;
23
24class MParList : public MParContainer
25{
26private:
27 TOrdCollection *fContainer; // Collection of Parameter and Data Containers
28 TOrdCollection *fAutodelete; //! All what this list contains is deleted in the destructor
29
30 static TString GetClassName(const char *classname);
31 static TString GetObjectName(const char *classname, const char *objname);
32
33 enum { kIsOwner = BIT(14) };
34
35 void StreamPrimitive(ofstream &out) const;
36
37public:
38 enum { kDoNotReset = BIT(17) };
39
40 MParList(const char *name=NULL, const char *title=NULL);
41 MParList(MParList &ts);
42
43 virtual ~MParList();
44
45 Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL);
46 void AddToList(TObjArray *list);
47
48 Bool_t Replace(MParContainer *obj);
49 void Remove(MParContainer *obj);
50
51 void SetLogStream(MLog *log);
52
53 TObject *FindObject(const char *name) const;
54 TObject *FindObject(const TObject *obj) const;
55
56 TObject *FindObject(const char *name, const char *classname) const;
57 TObject *FindObject(const TObject *obj, const char *classname) const;
58
59 MParContainer *FindCreateObj(const char *classname, const char *objname=NULL);
60
61 TObjArray FindObjectList(const char *name, UInt_t first, const UInt_t last) const;
62 TObjArray FindObjectList(const char *name, const UInt_t num) const
63 {
64 return FindObjectList(name, 0, num);
65 }
66
67 TObjArray FindCreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname=NULL);
68 TObjArray FindCreateObjList(const char *cname, const UInt_t num, const char *oname=NULL)
69 {
70 return FindCreateObjList(cname, 0, num, oname);
71 }
72
73 static TObjArray CreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname=NULL);
74 static TObjArray CreateObjList(const char *cname, const UInt_t num, const char *oname=NULL)
75 {
76 return CreateObjList(cname, 0, num, oname);
77 }
78
79 void Reset();
80 void SetReadyToSave(Bool_t flag=kTRUE);
81
82 void SetOwner(Bool_t enable=kTRUE);
83 Bool_t IsOwner() const { return TestBit(kIsOwner); }
84
85 void Print(Option_t *t = NULL) const;
86
87 void GetNames(TObjArray &arr) const;
88 void SetNames(TObjArray &arr);
89
90 void SavePrimitive(ofstream &out, Option_t *o="");
91
92 Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
93 Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
94
95 ClassDef(MParList, 1) // list of parameter containers (MParContainer)
96};
97
98#endif
Note: See TracBrowser for help on using the repository browser.