source: trunk/MagicSoft/Mars/mbase/MParList.cc@ 603

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