HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoConfigFile.h
Go to the documentation of this file.
1 #ifndef HARPOCONFIGFILE_H
2 #define HARPOCONFIGFILE_H
3 
5 // HarpoConfigFile.h
6 //
7 // A class read libconfig+++ configuration file
8 //
9 
10 
11 #include "Rtypes.h"
12 #include "TString.h"
13 
14 // forward declaration for libconfig++
15 namespace libconfig
16 {
17  class Config;
18 }
19 
21  public:
24 
26  // detmask use is detector id for Dummy reader
27  // as we process only one detector and read only one file
28  HarpoConfigFile(int argc, char **argv,ULong64_t detmask = 0x3);
29 
30  // Destructor: Deletes the entries in the list of configuration file lines
31  virtual ~HarpoConfigFile();
32 
34  Bool_t SetCfgFile(const char *fcfg);
35 
37  TString *GetCfgFile() { return fCfgFile; }
38  // **Config File
39 
40  // Is this option defined?
41  Bool_t Exist(const char * path);
42 
44  /* enum Type */
45  /* { */
46  /* TypeNone = 0, */
47  /* // scalar types */
48  /* TypeInt, */
49  /* TypeInt64, */
50  /* TypeFloat, */
51  /* TypeString, */
52  /* TypeBoolean, */
53  /* // aggregate types */
54  /* TypeGroup, */
55  /* TypeArray, */
56  /* TypeList */
57  /* }; */
58  Int_t getSettingType(const char * path);
59 
61  Bool_t Lookup(const char * path,Bool_t &val);
62  Bool_t Lookup(const char * path,Long64_t &val);
63  Bool_t Lookup(const char * path,ULong64_t &val);
64  Bool_t Lookup(const char * path,Double_t &val);
65  Bool_t Lookup(const char * path,TString &val);
66  Bool_t Lookup(const char * path,TString *&val);
67 
69  Int_t getSettingLength(const char * path);
70 
71  Bool_t LookupElem(const char * path,UInt_t index,Bool_t &val);
72  Bool_t LookupElem(const char * path,UInt_t index,Long64_t &val);
73  Bool_t LookupElem(const char * path,UInt_t index,ULong64_t &val);
74  Bool_t LookupElem(const char * path,UInt_t index,Double_t &val);
75  Bool_t LookupElem(const char * path,UInt_t index,TString &val);
76  Bool_t LookupElem(const char * path,UInt_t index,TString *&val);
77 
78 
79  // Print all options
80  void print() const;
81 
82  protected:
83  libconfig::Config *lcfg; //pointer to libconfig++ class
84 
85  TString * fCfgFile;
86  Bool_t infiles;
87 
88 };
89 
90 #endif // #ifndef HARPOCONFIGFILE_H
91 
Bool_t Exist(const char *path)
Bool_t LookupElem(const char *path, UInt_t index, Bool_t &val)
HarpoConfigFile()
Constructor which does basically nothing.
TString * GetCfgFile()
Get Name of libconfig configuration file.
Int_t getSettingLength(const char *path)
Function to deal with arrays or lists.
Int_t getSettingType(const char *path)
Return paramener type as definef in libconfig.h++.
A class which keeps track of the entire configuration file.
virtual ~HarpoConfigFile()
Destructor:
Bool_t infiles
Config file name.
libconfig::Config * lcfg
TString * fCfgFile
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
void print() const
Bool_t SetCfgFile(const char *fcfg)
Set Name of libconfig configuration file.