source: trunk/MagicSoft/include-Classes/MBase/MParList.cc@ 490

Last change on this file since 490 was 490, checked in by magicsol, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1///////////////////////////////////////////////////////////////////////
2//
3// MParList
4//
5// This class contains a list of different Parameter and Data
6// Containers.
7//
8// You can add every parameter Container (Named object) to the
9// instance and access it from somewhere else via its Name.
10//
11///////////////////////////////////////////////////////////////////////
12
13#include "MParList.h"
14
15#include <TNamed.h>
16
17#include "MParContainer.h"
18
19ClassImp(MParList)
20
21MParList::MParList() : fNext(NULL)
22{
23 //
24 // default constructor
25 // creates an empty list
26 //
27
28}
29
30MParList::MParList(MParList &ts)
31{
32 //
33 // copy constructor
34 //
35
36 fContainer.AddAll(&ts.fContainer);
37}
38
39
40Bool_t MParList::AddToList(MParContainer *obj, MParContainer *where)
41{
42 //
43 // Add an Container to the list.
44 //
45 // If 'where' is given, the object will be added after this.
46 //
47
48 //
49 // check if the object (you want to add) exists
50 //
51 if (!obj) return kTRUE;
52
53 cout << "Adding " << obj->GetName() << " to " << GetName() << "... " << flush;
54 //
55 // check if it is in the list yet
56 //
57 if (fContainer.FindObject(obj))
58 {
59 cout << "WARNING: MParList::add: Container already added" << endl;
60 return kTRUE;
61 }
62
63 //
64 // check if you want to add the new parameter container somewhere
65 // special (in that case you specify "where")
66 //
67 if (where)
68 {
69 if (!fContainer.FindObject(where))
70 {
71 cout << "ERROR: MParList::add: Cannot find parameter container after which the new one should be added!" << endl;
72 return kFALSE;
73 }
74 }
75
76 fContainer.Add(obj);
77 cout << "Done." << endl;
78
79 return kTRUE;
80}
81
82TObject *MParList::FindObject(const char *name) const
83{
84 //
85 // Find an object in the list.
86 // 'name' is the name of the object you are searching for.
87 //
88 return (TObject*)fContainer.FindObject(name);
89}
90
91
92void MParList::Print(Option_t *t)
93{
94 //
95 // print some information about the current status of MParList
96 //
97 cout << "ParList: " << this->GetName() << " <" << this->GetTitle() << ">" << endl;
98 cout << endl;
99}
100
Note: See TracBrowser for help on using the repository browser.