44 #include <libconfig.h++>
46 using namespace libconfig;
51 fCfgFile = (TString *) NULL;
58 if ( fCfgFile != NULL )
delete fCfgFile;
65 if (fCfgFile != NULL)
delete fCfgFile;
66 fCfgFile =
new TString(fcfg);
67 std::cout <<
"Reading Config --> " << *fCfgFile << std::endl;
69 lcfg->readFile(fCfgFile->Data());
70 lcfg->setAutoConvert(
true);
74 std::cout <<
"config file read failed" << std::endl;
82 return ((lcfg != NULL) && lcfg->exists(path) );
88 lcfg->lookupValue(path,val);
96 if ( ! Exist(path) )
return false;
99 if (lcfg->lookupValue(path,val)) {
104 if (lcfg->lookupValue(path,ival)) {
117 if (lcfg->lookupValue(path,lval)) {
118 val = (ULong64_t) lval;
123 if (lcfg->lookupValue(path,ival)) {
135 lcfg->lookupValue(path,val);
145 lcfg->lookupValue(path,lval);
156 lcfg->lookupValue(path,lval);
157 if ( val != NULL )
delete val;
158 val =
new TString(lval);
167 Setting &lset = lcfg->lookup(path);
168 return lset.getLength();
176 Setting &lset = lcfg->lookup(path);
177 return lset.getType();
185 Setting &lset = lcfg->lookup(path);
195 Setting &lset = lcfg->lookup(path);
205 Setting &lset = lcfg->lookup(path);
215 Setting &lset = lcfg->lookup(path);
225 Setting &lset = lcfg->lookup(path);
226 std::string lval = lset[index];
236 Setting &lset = lcfg->lookup(path);
237 std::string lval = lset[index];
240 if ( val != NULL )
delete val;
241 val =
new TString(lval);
Bool_t Exist(const char *path)
Bool_t LookupElem(const char *path, UInt_t index, Bool_t &val)
HarpoConfigFile()
Constructor which does basically nothing.
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++.
virtual ~HarpoConfigFile()
Destructor:
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
Bool_t SetCfgFile(const char *fcfg)
Set Name of libconfig configuration file.