FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairParSet.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 FAIRPARSET_H
9 #define FAIRPARSET_H
10 
11 #include <Rtypes.h> // for Int_t, Bool_t, etc
12 #include <TObject.h>
13 #include <TString.h> // for TString
14 
15 class FairLogger;
16 class FairParIo;
17 
18 class FairParSet : public TObject
19 {
20  protected:
21  TString fName; //
22  TString fTitle; //
23  TString detName;
24  Int_t versions[3];
25  Bool_t status;
26  Bool_t changed;
27  Bool_t owned;
28  TString paramContext; // Context/purpose for parameters and conditions
29  TString author; // Author of parameters
30  TString description; // Description of parameters
33 
34  public:
35  FairParSet(const char* name = "", const char* title = "", const char* context = "", Bool_t owner = kFALSE);
36  virtual ~FairParSet() {}
37 
38  virtual const char* GetName() const { return static_cast<const char*>(fName.Data()); }
39  virtual const char* GetTitle() const { return static_cast<const char*>(fTitle.Data()); }
40 
41  virtual Bool_t init();
42  virtual Bool_t init(FairParIo*) { return kFALSE; }
43  virtual Int_t write();
44  virtual Int_t write(FairParIo*) { return kFALSE; }
45  virtual void clear() {}
46  virtual void print();
47 
48  const char* getDetectorName() { return detName.Data(); }
49  void resetInputVersions();
50 
51  void setInputVersion(Int_t v = -1, Int_t i = 0)
52  {
53  if (i >= 0 && i < 3) {
54  versions[i] = v;
55  }
56  }
57  Int_t getInputVersion(Int_t i)
58  {
59  if (i >= 0 && i < 3) {
60  return versions[i];
61  } else {
62  return 0;
63  }
64  }
65 
66  void setStatic(Bool_t flag = kTRUE) { status = flag; }
67  Bool_t isStatic() { return status; }
68 
69  void setOwnership(Bool_t flag = kTRUE) { owned = flag; }
70  Bool_t isOwned() { return owned; }
71 
72  void setChanged(Bool_t flag = kTRUE) { changed = flag; }
73  Bool_t hasChanged() { return changed; }
74 
75  const char* getParamContext() const { return paramContext.Data(); }
76 
77  void setAuthor(const char* s) { author = s; }
78  const char* getAuthor() const { return author.Data(); }
79 
80  void setDescription(const char* s) { description = s; }
81  const char* getDescription() const { return description.Data(); }
82 
84  {
85  author = r.getAuthor();
87  }
88 
89  virtual void fill(UInt_t){};
90  virtual void store(UInt_t){};
91 
93  FairParSet(const FairParSet&);
94 
95  ClassDef(FairParSet, 2); // Base class for all parameter containers
96 };
97 
98 #endif /* !FAIRPARSET_H */
const char * getParamContext() const
Definition: FairParSet.h:75
Bool_t isStatic()
Definition: FairParSet.h:67
ClassDef(FairParSet, 2)
virtual const char * GetName() const
Definition: FairParSet.h:38
virtual Bool_t init(FairParIo *)
Definition: FairParSet.h:42
Bool_t status
versions of container in the 2 possible inputs
Definition: FairParSet.h:25
TString fName
Definition: FairParSet.h:21
TString detName
Definition: FairParSet.h:23
void setStatic(Bool_t flag=kTRUE)
Definition: FairParSet.h:66
virtual Int_t write()
Definition: FairParSet.cxx:80
TString author
Definition: FairParSet.h:29
Bool_t owned
flag is kTRUE if parameters have changed
Definition: FairParSet.h:27
Bool_t changed
static flag
Definition: FairParSet.h:26
void setChanged(Bool_t flag=kTRUE)
Definition: FairParSet.h:72
TString description
Definition: FairParSet.h:30
virtual void print()
Definition: FairParSet.cxx:94
FairParSet & operator=(const FairParSet &)
Definition: FairParSet.cxx:164
virtual const char * GetTitle() const
Definition: FairParSet.h:39
void copyComment(FairParSet &r)
Definition: FairParSet.h:83
const char * getDescription() const
Definition: FairParSet.h:81
FairParSet(const char *name="", const char *title="", const char *context="", Bool_t owner=kFALSE)
Definition: FairParSet.cxx:27
Int_t getInputVersion(Int_t i)
Definition: FairParSet.h:57
void setOwnership(Bool_t flag=kTRUE)
Definition: FairParSet.h:69
FairLogger * fLogger
Definition: FairParSet.h:32
virtual Bool_t init()
Definition: FairParSet.cxx:46
virtual Int_t write(FairParIo *)
Definition: FairParSet.h:44
virtual void clear()
Definition: FairParSet.h:45
Bool_t hasChanged()
Definition: FairParSet.h:73
const char * getDetectorName()
Definition: FairParSet.h:48
TString paramContext
if flag is KTRUE FairDB has the par. class ownership
Definition: FairParSet.h:28
const char * getAuthor() const
Definition: FairParSet.h:78
Int_t versions[3]
name of the detector the container belongs to
Definition: FairParSet.h:24
virtual void store(UInt_t)
Definition: FairParSet.h:90
void setInputVersion(Int_t v=-1, Int_t i=0)
Definition: FairParSet.h:51
virtual ~FairParSet()
Definition: FairParSet.h:36
void resetInputVersions()
Definition: FairParSet.cxx:121
virtual void fill(UInt_t)
Definition: FairParSet.h:89
TString fTitle
Definition: FairParSet.h:22
void setAuthor(const char *s)
Definition: FairParSet.h:77
Bool_t isOwned()
Definition: FairParSet.h:70
void setDescription(const char *s)
Definition: FairParSet.h:80