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

Last change on this file since 2178 was 2178, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 26.2 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2002
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26// //
27// MParList //
28// //
29// This class contains a list of different parameter containers. //
30// //
31// A parameter container is an object which is derived from //
32// MParContainer. //
33// //
34// Normally a parameter container is used for data exchange between two //
35// tasks at runtime. //
36// //
37// You can add every parameter container (Named object) to the //
38// instance and access it from somewhere else via its Name. //
39// //
40/////////////////////////////////////////////////////////////////////////////
41#include "MParList.h"
42
43#include <fstream> // ofstream, SavePrimitive
44
45#include <TNamed.h>
46#include <TClass.h>
47#include <TOrdCollection.h>
48
49#include "MLog.h"
50#include "MLogManip.h"
51
52#include "MIter.h"
53
54ClassImp(MParList);
55
56using namespace std;
57
58static const TString gsDefName = "MParList";
59static const TString gsDefTitle = "A list of Parameter Containers";
60
61// --------------------------------------------------------------------------
62//
63// default constructor
64// creates an empty list
65//
66MParList::MParList(const char *name, const char *title)
67{
68 fName = name ? name : gsDefName.Data();
69 fTitle = title ? title : gsDefTitle.Data();
70
71 //
72 // This sets a flag that the list is the owner, which means
73 // that the destructor of the list deletes all it's objects
74 //
75 fContainer = new TOrdCollection;
76 fAutodelete = new TOrdCollection;
77}
78
79// --------------------------------------------------------------------------
80//
81// Copy constructor. It copies all entries of the parameter list, but it
82// takes care of, that the automatically created entries are only deleted
83// once. (doesn't copy the list which holds the automatically created
84// entries)
85//
86MParList::MParList(MParList &ts)
87{
88 fContainer->AddAll(ts.fContainer);
89}
90
91// --------------------------------------------------------------------------
92//
93// If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted
94// by the destructor
95//
96MParList::~MParList()
97{
98 //
99 // Case:
100 // 1) MParList is owner of the containers:
101 // All container are stored in fContainer, and become deleted by
102 // 'delete fContainer'. Some of these containers, which were
103 // created automatically are stored in fAutodelete, too. To prevent
104 // double deletion this containers are not deleted by the destructor
105 // of fAutodelete.
106 // 2) MParList is not owner of the containers:
107 // The containers which were Added by AddToList are not touched.
108 // Only the containers which were created automatically are also
109 // automatically deleted.
110 //
111 IsOwner() ? fContainer->SetOwner() : fAutodelete->SetOwner();
112
113 // FIXME? If fContainer is owner do we have to remove the object
114 // from fAutodelete due to the acces when checking for a
115 // garbage collection?
116
117 delete fContainer;
118 delete fAutodelete;
119}
120
121// --------------------------------------------------------------------------
122//
123// If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted
124// by the destructor
125//
126void MParList::SetOwner(Bool_t enable)
127{
128 enable ? SetBit(kIsOwner) : ResetBit(kIsOwner);
129}
130
131// --------------------------------------------------------------------------
132//
133// Set the logging streamer of the parameter list and all contained
134// parameter containers
135//
136void MParList::SetLogStream(MLog *log)
137{
138 fContainer->ForEach(MParContainer, SetLogStream)(log);
139 MParContainer::SetLogStream(log);
140}
141
142void MParList::SetDisplay(MStatusDisplay *d)
143{
144 fContainer->ForEach(MParContainer, SetDisplay)(d);
145 MParContainer::SetDisplay(d);
146}
147
148// --------------------------------------------------------------------------
149//
150// Add a single container to the list.
151//
152// If 'where' is given, the object will be added after this.
153//
154Bool_t MParList::AddToList(MParContainer *cont, MParContainer *where)
155{
156 //
157 // check if the object (you want to add) exists
158 //
159 if (!cont)
160 return kFALSE;
161
162 //
163 // Get Name of new container
164 //
165 const char *name = cont->GetName();
166
167 //
168 // Check if the new container is already existing in the list
169 //
170 const TObject *objn = fContainer->FindObject(name);
171 const TObject *objt = fContainer->FindObject(cont);
172
173 if (objn || objt)
174 {
175 //
176 // If the container is already in the list ignore it.
177 //
178 if (objt || objn==cont)
179 {
180 *fLog << warn << dbginf << "Warning: Container '" << cont->GetName() << ", 0x" << (void*)cont;
181 *fLog << "' already existing in '" << GetName() << "'... ignoring." << endl;
182 return kTRUE;
183 }
184
185 //
186 // Otherwise add it to the list, but print a warning message
187 //
188 *fLog << warn << dbginf << "Warning: Container with the same name '" << cont->GetName();
189 *fLog << "' already existing in '" << GetName() << "'." << endl;
190 *fLog << "You may not be able to get a pointer to container task by name." << endl;
191 }
192
193 //
194 // check if you want to add the new parameter container somewhere
195 // special (in that case you specify "where")
196 //
197 if (where)
198 {
199 if (!fContainer->FindObject(where))
200 {
201 *fLog << dbginf << "Error: Cannot find parameter container after which the new one should be added!" << endl;
202 return kFALSE;
203 }
204 }
205
206 *fLog << inf << "Adding " << name << " to " << GetName() << "... " << flush;
207
208 fContainer->Add(cont);
209 *fLog << "Done." << endl;
210
211 return kTRUE;
212}
213
214// --------------------------------------------------------------------------
215//
216// Add all entries of the TObjArray to the list.
217//
218void MParList::AddToList(TObjArray *list)
219{
220 //
221 // check if the object (you want to add) exists
222 //
223 if (!list)
224 return;
225
226 MIter Next(list);
227
228 MParContainer *cont = NULL;
229 while ((cont=Next()))
230 AddToList(cont);
231}
232
233// --------------------------------------------------------------------------
234//
235// Find an object with the same name in the list and replace it with
236// the new one. If the kIsOwner flag is set and the object was not
237// created automatically, the object is deleted.
238//
239Bool_t MParList::Replace(MParContainer *cont)
240{
241 //
242 // check if the object (you want to add) exists
243 //
244 if (!cont)
245 return kFALSE;
246
247 TObject *obj = FindObject(cont->GetName());
248 if (!obj)
249 {
250 *fLog << warn << "No object with the same name '";
251 *fLog << cont->GetName() << "' in list... adding." << endl;
252 return AddToList(cont);
253 }
254
255 fContainer->Remove(obj);
256
257 if (IsOwner() && !fAutodelete->FindObject(obj))
258 delete obj;
259
260 *fLog << inf << "MParContainer '" << cont->GetName() << "' found and replaced..." << endl;
261
262 return AddToList(cont);
263}
264
265// --------------------------------------------------------------------------
266//
267// Find an object with the same name in the list and remove it.
268// If the kIsOwner flag is set and the object was not created
269// automatically, the object is deleted.
270//
271void MParList::Remove(MParContainer *cont)
272{
273 //
274 // check if the object (you want to add) exists
275 //
276 if (!cont)
277 return;
278
279 TObject *obj = fContainer->Remove(cont);
280 if (!obj)
281 {
282 *fLog << warn << "Object not found in list..." << endl;
283 return;
284 }
285
286 *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl;
287
288 if (IsOwner() && !fAutodelete->FindObject(obj))
289 delete obj;
290}
291
292// --------------------------------------------------------------------------
293//
294// Find an object in the list.
295// 'name' is the name of the object you are searching for.
296//
297TObject *MParList::FindObject(const char *name) const
298{
299 return fContainer->FindObject(name);
300}
301
302// --------------------------------------------------------------------------
303//
304// check if the object is in the list or not
305//
306TObject *MParList::FindObject(const TObject *obj) const
307{
308 return fContainer->FindObject(obj);
309}
310
311// --------------------------------------------------------------------------
312//
313// Find an object in the list and check for the correct inheritance.
314// 'name' is the name of the object you are searching for.
315//
316TObject *MParList::FindObject(const char *name, const char *classname) const
317{
318 TObject *obj = fContainer->FindObject(name);
319
320 if (!obj)
321 return NULL;
322
323 if (obj->InheritsFrom(classname))
324 return obj;
325
326 *fLog << dbginf << warn << "Found object '" << name << "' doesn't ";
327 *fLog << "inherit from " << "'" << classname << "'" << endl;
328 return NULL;
329}
330
331// --------------------------------------------------------------------------
332//
333// check if the object is in the list or not and check for the correct
334// inheritance
335//
336TObject *MParList::FindObject(const TObject *obj, const char *classname) const
337{
338 TObject *nobj = fContainer->FindObject(obj);
339
340 if (!nobj)
341 return NULL;
342
343 if (nobj->InheritsFrom(classname))
344 return nobj;
345
346 *fLog << dbginf << warn << "Found object '" << nobj->GetName() << "' ";
347 *fLog << "doesn't inherit from " << "'" << classname << "'" << endl;
348 return NULL;
349}
350
351// --------------------------------------------------------------------------
352//
353// returns the ClassName without anything which is behind that last ';' in
354// string.
355//
356TString MParList::GetClassName(const char *classname)
357{
358 TString cname(classname);
359 const char *semicolon = strrchr(cname, ';');
360
361 if (semicolon)
362 cname.Remove(semicolon-cname);
363
364 return cname;
365}
366
367// --------------------------------------------------------------------------
368//
369// returns the ObjectName. It is created from a class and object name.
370// If no object name is given the objectname is the same than the
371// class name. Leading dots are removed from the object name
372//
373TString MParList::GetObjectName(const char *classname, const char *objname)
374{
375 TString cname(classname);
376 const char *semicolon = strrchr(cname, ';');
377
378 TString oname(objname ? objname : classname);
379
380 if (semicolon)
381 {
382 //
383 // Remove leading dots from objectname (eg. "MMcTrig;5.")
384 //
385 Int_t sz = oname.Sizeof()-2;
386
387 while (sz>=0 && oname[sz]=='.')
388 oname.Remove(sz--);
389 }
390 return oname;
391}
392
393// --------------------------------------------------------------------------
394//
395// Find an object in the list.
396// 'name' is the name of the object you are searching for.
397// If the object doesn't exist we try to create one from the
398// dictionary. If this isn't possible NULL is returned.
399//
400// An object which was created automatically is deleted automatically in
401// the destructor of the parameter list, too. This means, that if an
402// object should survive (eg. Histograms) you MUST create it by yourself
403// and add it to the parameter list.
404//
405// By default (you don't specify an object name) the object name is
406// the same as the classname
407//
408// If the classname (default classname) is of the structure
409// "Name;something" - containing a semicolon - evarything which is
410// after the last appearance of a semicolon is stripped to get the
411// Name of the Class. Normally this is used to number your objects.
412// "Name;1", "Name;2", ... If a semicolon is detected leading dots
413// are stripped from the object-name (eg. "name;5.")
414//
415MParContainer *MParList::FindCreateObj(const char *classname, const char *objname)
416{
417 //
418 // If now object name (name of the object to identify it in the
419 // List) is given use it's classname as the objectname
420 //
421
422 //
423 // Check if the classname is a 'numbered' name (like: "MTime;2")
424 // if so strip the number from the classname.
425 //
426 // Becareful: We check for the last occurance of a ';' only and we
427 // also don't check if a number follows or something else.
428 //
429 // Rem: I use a TString to make the code more readyble and to get
430 // the new object deleted automatically
431 //
432 TString cname = GetClassName(classname);
433 TString oname = GetObjectName(classname, objname);
434
435 //
436 // Try to find a object with this object name which is already
437 // in the List. If we can find one we are done.
438 //
439 MParContainer *pcont = (MParContainer*)FindObject(oname);
440
441 if (pcont)
442 {
443 if (pcont->InheritsFrom(cname))
444 return pcont;
445
446 *fLog << err << "Warning: Object '" << oname << "' found in list doesn't inherit from " << cname << "." << endl;
447 return NULL;
448 }
449
450 //
451 // if object is not existing in the list try to create one
452 //
453 *fLog << inf << "Object '" << oname << "' [" << cname << "] not yet in " << GetName() << "... creating." << endl;
454
455 //
456 // try to get class from root environment
457 //
458 TClass *cls = gROOT->GetClass(cname);
459 if (!cls)
460 {
461 //
462 // if class is not existing in the root environment
463 //
464 *fLog << err << dbginf << "Class '" << cname << "' not existing in dictionary." << endl;
465 return NULL;
466 }
467
468 //
469 // create the parameter container of the the given class type
470 //
471 pcont = (MParContainer*)cls->New();
472 if (!pcont)
473 {
474 *fLog << err << dbginf << "Cannot create new instance of class '" << cname << "' Possible reasons:" << endl;
475 *fLog << " - Class has no default constructor." << endl;
476 *fLog << " - An abstract member functions of a base class is not overwritten." << endl;
477 return NULL;
478 }
479
480 //
481 // Set the name of the container
482 //
483 pcont->SetName(oname);
484
485 //
486 // Now add the object to the parameter list
487 //
488 AddToList(pcont);
489
490 //
491 // The object was automatically created. This makes sure, that such an
492 // object is deleted together with the list
493 //
494 fAutodelete->Add(pcont);
495
496 //
497 // Find an object in the list.
498 // 'name' is the name of the object you are searching for.
499 //
500 return pcont;
501}
502
503// --------------------------------------------------------------------------
504//
505// print some information about the current status of MParList
506//
507void MParList::Print(Option_t *t) const
508{
509 *fLog << all << underline << GetDescriptor() << ":" << endl;
510
511 MParContainer *obj = NULL;
512 MIter Next(fContainer);
513 while ((obj=Next()))
514 {
515 *fLog << " " << obj->GetDescriptor();
516 if (fAutodelete->FindObject(obj))
517 *fLog << " <autodel>";
518 *fLog << endl;
519 }
520 *fLog << endl;
521}
522
523// --------------------------------------------------------------------------
524//
525// Sets the flags off all containers in the list (and the list
526// itself) to unchanged
527//
528void MParList::SetReadyToSave(Bool_t flag)
529{
530 fContainer->ForEach(MParContainer, SetReadyToSave)(flag);
531 MParContainer::SetReadyToSave(flag);
532}
533
534// --------------------------------------------------------------------------
535//
536// Reset all containers in the list
537//
538void MParList::Reset()
539{
540 fContainer->ForEach(MParContainer, Reset)();
541}
542
543// --------------------------------------------------------------------------
544//
545// This finds numbered objects. The objects are returned in a copy of a
546// TObjArray.
547//
548// If from only is given (or to=0) object are assumed numbered
549// from 1 to from.
550//
551TObjArray MParList::FindObjectList(const char *name, UInt_t first, const UInt_t last) const
552{
553 TObjArray list;
554
555 if (first>0 && last<first)
556 {
557 *fLog << err << dbginf << "Cannot create entries backwards (last<first)...skipped." << endl;
558 return list;
559 }
560
561 const UInt_t len = strlen(name);
562
563 char *auxname = new char[len+7];
564 strcpy(auxname, name);
565
566 if (first==0 && last!=0)
567 first = 1;
568
569 //
570 // If only 'from' is specified the number of entries are ment
571 //
572 for (UInt_t i=first; i<=last; i++)
573 {
574 if (first!=0 || last!=0)
575 sprintf(auxname+len, ";%d", i);
576
577 TObject *obj = FindObject(auxname);
578 if (!obj)
579 continue;
580
581 list.AddLast(obj);
582 }
583 delete auxname;
584
585 return list;
586}
587
588// --------------------------------------------------------------------------
589//
590// This finds numbered objects. The objects are returned in a copy of a
591// TObjArray. If one of the objects doesn't exist it is created from the
592// meaning of cname and oname (s. FindCreateObj)
593//
594// If from only is given (or to=0) object are assumed numbered
595// from 1 to from.
596//
597TObjArray MParList::FindCreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname)
598{
599 TObjArray list;
600
601 if (first>0 && last<first)
602 {
603 *fLog << err << dbginf << "Cannot create entries backwards (last<first)...skipped." << endl;
604 return list;
605 }
606
607 const UInt_t len = strlen(cname);
608
609 char *auxname = new char[len+7];
610 strcpy(auxname, cname);
611
612 //
613 // If only 'from' is specified the number of entries are ment
614 //
615 if (first==0 && last!=0)
616 first = 1;
617
618 for (UInt_t i=first; i<=last; i++)
619 {
620 if (first!=0 || last!=0)
621 sprintf(auxname+len, ";%d", i);
622
623 TObject *obj = FindCreateObj(auxname, oname);
624 if (!obj)
625 break;
626
627 list.AddLast(obj);
628 }
629 delete auxname;
630
631 return list;
632}
633
634// --------------------------------------------------------------------------
635//
636// This finds numbered objects. The objects are returned in a copy of a
637// TObjArray. If one of the objects doesn't exist it is created from the
638// meaning of cname and oname (s. FindCreateObj)
639//
640// If from only is given (or to=0) object are assumed numbered
641// from 1 to from.
642//
643// Remark: Because it is static the object are only created and not added to
644// the parameter list. You must also take care of deleting these objects!
645// This function is mainly made for use in root macros. Don't use it in
646// compiled programs if you are not 100% sure what you are doing.
647//
648TObjArray MParList::CreateObjList(const char *cname, UInt_t first, const UInt_t last, const char *oname)
649{
650 TObjArray list;
651
652 if (first>0 && last<first)
653 {
654 gLog << err << dbginf << "Cannot create entries backwards (last<first)...skipped." << endl;
655 return list;
656 }
657
658 //
659 // try to get class from root environment
660 //
661 TClass *cls = gROOT->GetClass(cname);
662 if (!cls)
663 {
664 //
665 // if class is not existing in the root environment
666 //
667 gLog << dbginf << "Class '" << cname << "' not existing in dictionary." << endl;
668 return list;
669 }
670
671 const UInt_t len = strlen(cname);
672
673 char *auxname = new char[len+7];
674 strcpy(auxname, cname);
675
676 //
677 // If only 'from' is specified the number of entries are ment
678 //
679 if (first==0 && last!=0)
680 first = 1;
681
682 for (UInt_t i=first; i<=last; i++)
683 {
684 if (first!=0 || last!=0)
685 sprintf(auxname+len, ";%d", i);
686
687 //
688 // create the parameter container of the the given class type
689 //
690 MParContainer *pcont = (MParContainer*)cls->New();
691 if (!pcont)
692 {
693 gLog << err << dbginf << "Cannot create new instance of class '" << cname << "' (Maybe no def. constructor)" << endl;
694 return list;
695 }
696
697 //
698 // Set the name of the container
699 //
700 pcont->SetName(auxname);
701
702 //
703 // Add new object to the return list
704 //
705 list.AddLast(pcont);
706 }
707 delete auxname;
708
709 return list;
710}
711
712void MParList::SavePrimitive(ofstream &out, Option_t *o)
713{
714 Bool_t saved = IsSavedAsPrimitive();
715
716 MParContainer::SavePrimitive(out);
717
718 MIter Next(fContainer);
719
720 MParContainer *cont = NULL;
721 while ((cont=Next()))
722 {
723 //
724 // Because it was automatically created don't store its primitive
725 // I guess it will be automatically created again
726 //
727 if (fAutodelete->FindObject(cont) || cont->IsSavedAsPrimitive())
728 continue;
729
730 cont->SavePrimitive(out, "");
731
732 out << " " << GetUniqueName() << ".";
733 out << (cont->InheritsFrom("MTaskList") && saved ? "Replace" : "AddToList");
734 out << "(&" << cont->GetUniqueName() << ");" << endl << endl;
735 }
736}
737
738// --------------------------------------------------------------------------
739//
740// Implementation of SavePrimitive. Used to write the call to a constructor
741// to a macro. In the original root implementation it is used to write
742// gui elements to a macro-file.
743//
744void MParList::StreamPrimitive(ofstream &out) const
745{
746 out << " MParList " << GetUniqueName();
747 if (fName!=gsDefName || fTitle!=gsDefTitle)
748 {
749 out << "(\"" << fName << "\"";
750 if (fTitle!=gsDefTitle)
751 out << ", \"" << fTitle << "\"";
752 out <<")";
753 }
754 out << ";" << endl << endl;
755}
756
757// --------------------------------------------------------------------------
758//
759// Adds one TNamed object per object in the list. The TNamed object must
760// be deleted by the user.
761//
762void MParList::GetNames(TObjArray &arr) const
763{
764 MParContainer::GetNames(arr);
765 fContainer->ForEach(MParContainer, GetNames)(arr);
766}
767
768// --------------------------------------------------------------------------
769//
770// Sets name and title of each object in the list from the objects in
771// the array.
772//
773void MParList::SetNames(TObjArray &arr)
774{
775 MParContainer::SetNames(arr);
776 fContainer->ForEach(MParContainer, SetNames)(arr);
777}
778
779// --------------------------------------------------------------------------
780//
781// Read the contents/setup of a parameter container/task from a TEnv
782// instance (steering card/setup file).
783// The key to search for in the file should be of the syntax:
784// prefix.vname
785// While vname is a name which is specific for a single setup date
786// (variable) of this container and prefix is something like:
787// evtloopname.name
788// While name is the name of the containers/tasks in the parlist/tasklist
789//
790// eg. Job4.MImgCleanStd.CleaningLevel1: 3.0
791// Job4.MImgCleanStd.CleaningLevel2: 2.5
792//
793// If this cannot be found the next step is to search for
794// MImgCleanStd.CleaningLevel1: 3.0
795// And if this doesn't exist, too, we search for:
796// CleaningLevel1: 3.0
797//
798// Warning: The programmer is responsible for the names to be unique in
799// all Mars classes.
800//
801Bool_t MParList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
802{
803 if (print)
804 *fLog << all << "MParList::ReadEnv: " << prefix << " (" << (int)print << ")" << endl;
805
806 MParContainer *cont = NULL;
807
808 MIter Next(fContainer);
809 while ((cont=Next()))
810 {
811 if (cont->InheritsFrom("MTaskList"))
812 {
813 if (cont->ReadEnv(env, prefix, print)==kERROR)
814 return kERROR;
815 continue;
816 }
817
818 // Check For: Job4.ContainerName.Varname
819 if (print)
820 *fLog << all << "Testing: " << prefix+cont->GetName() << endl;
821 Bool_t rc = cont->ReadEnv(env, prefix+cont->GetName(), print);
822 if (rc==kERROR)
823 return kERROR;
824 if (rc==kTRUE)
825 continue;
826
827 // Check For: Job4.MClassName.Varname
828 if (print)
829 *fLog << all << "Testing: " << prefix+cont->ClassName() << endl;
830 rc = cont->ReadEnv(env, prefix+cont->ClassName(), print);
831 if (rc==kERROR)
832 return kERROR;
833 if (rc==kTRUE)
834 continue;
835
836 // Check For: ContainerName.Varname
837 if (print)
838 *fLog << all << "Testing: " << cont->GetName() << endl;
839 rc = cont->ReadEnv(env, cont->GetName(), print);
840 if (rc==kERROR)
841 return kERROR;
842 if (rc==kTRUE)
843 continue;
844
845 // Check For: MClassName.Varname
846 if (print)
847 *fLog << all << "Testing: " << cont->ClassName() << endl;
848 rc = cont->ReadEnv(env, cont->ClassName(), print);
849 if (rc==kERROR)
850 return kERROR;
851 if (rc==kTRUE)
852 continue;
853 }
854
855 return kTRUE;
856}
857
858// --------------------------------------------------------------------------
859//
860// Write the contents/setup of a parameter container/task to a TEnv
861// instance (steering card/setup file).
862// The key to search for in the file should be of the syntax:
863// prefix.vname
864// While vname is a name which is specific for a single setup date
865// (variable) of this container and prefix is something like:
866// evtloopname.name
867// While name is the name of the containers/tasks in the parlist/tasklist
868//
869// eg. Job4.MImgCleanStd.CleaningLevel1: 3.0
870// Job4.MImgCleanStd.CleaningLevel2: 2.5
871//
872// If this cannot be found the next step is to search for
873// MImgCleanStd.CleaningLevel1: 3.0
874// And if this doesn't exist, too, we search for:
875// CleaningLevel1: 3.0
876//
877// Warning: The programmer is responsible for the names to be unique in
878// all Mars classes.
879//
880Bool_t MParList::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
881{
882 MParContainer *cont = NULL;
883
884 MIter Next(fContainer);
885 while ((cont=Next()))
886 if (!cont->WriteEnv(env, prefix, print))
887 return kFALSE;
888 return kTRUE;
889}
Note: See TracBrowser for help on using the repository browser.