FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairContFact.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #ifndef FAIRCONTFACT_H
9 #define FAIRCONTFACT_H
10 
11 #include <Rtypes.h> // for Bool_t, ClassDef, etc
12 #include <TList.h> // for TList
13 #include <TNamed.h> // for TNamed
14 #include <TString.h> // for TString
15 
16 class FairLogger;
17 class FairParIo;
18 class FairParSet;
19 
20 class FairContainer : public TNamed
21 {
22  private:
23  FairContainer();
25  FairContainer& operator=(const FairContainer&);
26 
27  protected:
29  TList* contexts;
31  TString actualContext;
34 
35  public:
36  FairContainer(const char*, const char*, const char*);
38  void addContext(const char*);
39  Bool_t setActualContext(const char* c);
40  const char* getDefaultContext();
41  const char* getActualContext() { return actualContext.Data(); }
42  void print();
43  TString getConcatName();
44  const char* getContext();
45  ClassDef(FairContainer, 0); // class for list elements in class FairContFact
46 };
47 
48 class FairContFact : public TNamed
49 {
50  public:
51  FairContFact();
52  virtual ~FairContFact();
53  Bool_t addContext(const char* name);
54  void print();
55  FairParSet* getContainer(const char*);
56  virtual FairParSet* createContainer(FairContainer*) { return 0; }
57  virtual void activateParIo(FairParIo*) {}
59  Bool_t AddContainer(FairContainer*);
60 
61  protected:
62  TList* containers; // all parameter containers managed by this factory
63  const char* getActualContext(const char* name)
64  {
65  return (static_cast<FairContainer*>(containers->FindObject(name)))->getActualContext();
66  }
69  ClassDef(FairContFact, 0); // base class of all factories for parameter containers
70 
71  private:
72  FairContFact(const FairContFact&);
73  FairContFact& operator=(const FairContFact&);
74 };
75 
76 #endif /* !FAIRCONTFACT_H */
Bool_t AddContainer(FairContainer *)
virtual FairParSet * createContainer(FairContainer *)
Definition: FairContFact.h:56
virtual ~FairContFact()
FairParSet * getContainer(const char *)
const char * getDefaultContext()
TList * containers
Definition: FairContFact.h:62
TList * contexts
Definition: FairContFact.h:29
const char * getContext()
ClassDef(FairContainer, 0)
TString getConcatName()
virtual void activateParIo(FairParIo *)
Definition: FairContFact.h:57
FairLogger * fLogger
Definition: FairContFact.h:68
TString actualContext
Definition: FairContFact.h:31
Bool_t setActualContext(const char *c)
void addContext(const char *)
const char * getActualContext()
Definition: FairContFact.h:41
Bool_t addContext(const char *name)
const char * getActualContext(const char *name)
Definition: FairContFact.h:63
FairLogger * fLogger
Definition: FairContFact.h:33
ClassDef(FairContFact, 0)