Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

cafe::Config Class Reference
[CAF Environment (Cafe)]

Provide access to configuration information for a given package called 'name'. More...

#include <Config.hpp>

List of all members.

Public Member Functions

 Config (const std::string &name)
virtual ~Config ()
void set (const std::string &key, const std::string &value)
 Set/Override an entry in the configuration database.

void dumpConfig (std::ostream &stream)
 Dump config DB to given output stream.

void dumpConfig (TDirectory *const dir, std::string const name="configDB")
 Dump config DB to given TDirector.

Accessor
Return the default value if the parameter isn't set

std::string get (const std::string &key, const std::string &def)
 Get string value from config DB.

int get (const std::string &key, int def)
 Get integer value from config DB.

double get (const std::string &key, double def)
 Get floating point value from config DB.

std::vector< std::string > getVString (const std::string &key, const std::string &delim="")
 Get list of strings of config DB.

std::vector< float > getVFloat (const std::string &key, const std::string &delim="")
 Get list of floats from config DB.

std::vector< int > getVInt (const std::string &key, const std::string &delim="")
 Get list of integers from config DB.


Static Private Member Functions

TEnv & getEnv ()

Private Attributes

std::string _name


Detailed Description

Provide access to configuration information for a given package called 'name'.

To use it, just instantiate an object of this type. All lookups will be prepended with the 'name' given.

Config config("MyTest"); std::string value = config.get("MyValue","MyDefault");

will look up 'Mytest.MyValue: ...' in the configuration file.

The configuration file is searched in the following places:

Definition at line 35 of file Config.hpp.


Constructor & Destructor Documentation

cafe::Config::Config const std::string &  name  ) 
 

Definition at line 20 of file Config.cpp.

cafe::Config::~Config  )  [virtual]
 

Definition at line 24 of file Config.cpp.


Member Function Documentation

void cafe::Config::dumpConfig TDirectory *const   dir,
std::string const   name = "configDB"
 

Dump config DB to given TDirector.

Definition at line 109 of file Config.cpp.

References getEnv().

void cafe::Config::dumpConfig std::ostream &  stream  ) 
 

Dump config DB to given output stream.

Definition at line 94 of file Config.cpp.

References getEnv().

Referenced by cafe::ConfigDumper::begin(), and cafe::ConfigDumper::finish().

double cafe::Config::get const std::string &  key,
double  def
 

Get floating point value from config DB.

Definition at line 37 of file Config.cpp.

References _name, and getEnv().

int cafe::Config::get const std::string &  key,
int  def
 

Get integer value from config DB.

Definition at line 32 of file Config.cpp.

References _name, and getEnv().

std::string cafe::Config::get const std::string &  key,
const std::string &  def
 

Get string value from config DB.

Definition at line 27 of file Config.cpp.

References _name, and getEnv().

Referenced by caf_util::ApplyJES::ApplyJES(), cafe::BadLBNs::BadLBNs(), cafe::Stat::begin(), cafe::Hist1D::begin(), cafe::Controller::begin(), caf_util::BTagJetSelector::BTagJetSelector(), cafe::ConfigDumper::ConfigDumper(), cafe::Controller::Controller(), caf_util::ElectronSelector::ElectronSelector(), caf_util::EMJetMatching::EMJetMatching(), cafe::EventList::EventList(), cafe::EventMultiSplitter::EventMultiSplitter(), caf_util::EventQuality::EventQuality(), caf_util::FindDuplicateEvents::FindDuplicateEvents(), cafe::Stat::finish(), cafe::Friend::Friend(), getVFloat(), getVInt(), getVString(), cafe::GoodRuns::GoodRuns(), cafe::Hist1D::Hist1D(), cafe::Hist2D::Hist2D(), cafe::Hist3D::Hist3D(), cafe::If::If(), caf_util::JetSelector::JetSelector(), caf_util::METSelector::METSelector(), caf_util::MuonSelector::MuonSelector(), caf_util::ReComputeMET::ReComputeMET(), cafe::Processor::resolve(), caf_util::ResSelector::ResSelector(), cafe::RunController::RunController(), cafe::Select::Select(), cafe::SelectObjects::SelectObjects(), cafe::SelectUserObjects< T >::SelectUserObjects(), cafe::StageinlistExpander::StageinlistExpander(), caf_util::TauSelector::TauSelector(), caf_util::TopologicalSelector::TopologicalSelector(), caf_util::VertexSelector::VertexSelector(), and cafe::Write::Write().

TEnv & cafe::Config::getEnv  )  [static, private]
 

Definition at line 141 of file Config.cpp.

References cafe::_cleanup.

Referenced by dumpConfig(), get(), and set().

std::vector< float > cafe::Config::getVFloat const std::string &  key,
const std::string &  delim = ""
 

Get list of floats from config DB.

Definition at line 59 of file Config.cpp.

References get().

std::vector< int > cafe::Config::getVInt const std::string &  key,
const std::string &  delim = ""
 

Get list of integers from config DB.

Definition at line 74 of file Config.cpp.

References get().

std::vector< std::string > cafe::Config::getVString const std::string &  key,
const std::string &  delim = ""
 

Get list of strings of config DB.

Definition at line 42 of file Config.cpp.

References get().

Referenced by cafe::BadLBNs::BadLBNs(), cafe::Stat::begin(), cafe::Controller::Controller(), cafe::EventFlags::EventFlags(), cafe::EventList::EventList(), cafe::GoodRuns::GoodRuns(), cafe::Hist1D::Hist1D(), cafe::Hist2D::Hist2D(), cafe::Hist3D::Hist3D(), cafe::Permute::Permute(), cafe::Plugins::Plugins(), caf_util::ReComputeMET::ReComputeMET(), cafe::RunController::RunController(), cafe::Select::Select(), cafe::SelectUserObjects< T >::SelectUserObjects(), cafe::Trigger::Trigger(), and cafe::Write::Write().

void cafe::Config::set const std::string &  key,
const std::string &  value
 

Set/Override an entry in the configuration database.

Definition at line 89 of file Config.cpp.

References getEnv().

Referenced by cafe::Permute::Permute().


Member Data Documentation

std::string cafe::Config::_name [private]
 

Definition at line 75 of file Config.hpp.

Referenced by get().


The documentation for this class was generated from the following files:
Generated on Tue Mar 28 10:13:10 2006 for CAF by doxygen 1.3.4