Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

cfg Namespace Reference

Run-time configuration management. More...


Classes

class  cfg::Config
 A collection of configuration parameters. More...
class  cfg::ConfigBuilder
 A class with the necesarry permissions to create configurations. More...
class  cfg::ConfigEditor
 A class to modify an existing configuration and publish changes. More...
class  cfg::Exception
 Exceptions thrown by the Config package. More...
class  cfg::Observer
 Defines the base class for classes which use cfg::Config parameters. More...
class  cfg::Param
 A single parameter stored in a configuration. More...
class  cfg::Table
 Tables of configurations defined in the program and their clients. More...
class  cfg::configBuilder
class  cfg::configdocBuilder
class  cfg::paramBuilder

Functions

std::ostream & operator<< (std::ostream &os, const Param &p)
template<class T>
const std::type_info & gsDataType (void)
template<class T>
const std::type_info & gsVectorType (void)
template<class T>
void gsDataDelete (void *p)
template<class T>
void gsDataCopyCons (void **dest, const void *src)
template<class T>
void gsDataCopy (void *dest, const void *src)
template<class T>
void gsDataPrint (std::ostream &os, const void *p)
template<class T>
std::ostream & operator<< (std::ostream &os, const std::vector< T > &v)


Detailed Description

Run-time configuration management.

A parameter consists of a name, and explanation ("comment") and a collection of data values all of which must be of a single type


Function Documentation

template<class T>
void gsDataCopy void *  dest,
const void *  src
[static]
 

Copy data from location src to location dest assuming that dest and src point to objects of type T

Definition at line 124 of file Param.h.

00125     {
00126       T* destc = (T*)dest;
00127       T* srcc  = (T*)src;
00128       (*destc) = (*srcc);
00129     }

template<class T>
void gsDataCopyCons void **  dest,
const void *  src
[static]
 

Construct a new object of type T at location (*dest) given object of same type at location src.

Definition at line 110 of file Param.h.

00111     {
00112       T* srcc = (T*)src;
00113       T* newt = new T(*srcc);
00114       *dest   = (void*)newt;
00115     }

template<class T>
void gsDataDelete void *  p  )  [static]
 

Delete the data pointed to by p assuming its of type T

Definition at line 98 of file Param.h.

00099     {
00100       T* pc = (T*)p; delete pc; 
00101     }

template<class T>
void gsDataPrint std::ostream &  os,
const void *  p
[static]
 

Print the data located at p assuming its of type T

Definition at line 137 of file Param.h.

00138     {
00139       T* pc = (T*)p;
00140       os << (*pc);
00141     }

template<class T>
const std::type_info& gsDataType void   )  [static]
 

Return the type info for data of type T

Definition at line 77 of file Param.h.

00078     {
00079       return typeid(T);
00080     }

template<class T>
const std::type_info& gsVectorType void   )  [static]
 

Params always hold vectors (see Config/xml/paramBuilder.cxx). Return the type info for data of vector type T

Definition at line 87 of file Param.h.

00088     {
00089       return typeid(typename T::value_type);
00090     }

template<class T>
std::ostream& operator<< std::ostream &  os,
const std::vector< T > &  v
[static]
 

Print a vector of basic types

Definition at line 149 of file Param.h.

00150     {
00151       int sz   = v.size();
00152       int szm1 = sz-1;
00153       if ( (typeid(T) == typeid(std::string)) || 
00154            (typeid(T) == typeid(const char*)) ) {
00155         // Add quotes if data is of string type
00156         for (int i=0; i<sz; ++i) {
00157           if (i==szm1) os << "\"" << v[i] << "\"";
00158           else         os << "\"" << v[i] << "\" ";
00159         }
00160       }
00161       else {
00162         // Non-string data gets streamed normally
00163         for (int i=0; i<sz; ++i) {
00164           if (i==szm1) os << v[i];
00165           else         os << v[i] << " ";
00166         }
00167       }
00168       return os;
00169     }

std::ostream& operator<< std::ostream &  os,
const Param &  p
 

Definition at line 16 of file Param.cxx.

References cfg::Param::Get(), cfg::Param::Print(), and cfg::Param::XMLTag().

00017   {
00018     if (std::string(p.XMLTag())=="time_t") {
00019       time_t t;
00020       p.Get(t);
00021       struct tm* ts = gmtime(&t);
00022       os << ts->tm_year+1900 << "-" << ts->tm_mon+1 << "-" 
00023          << ts->tm_mday << " " << ts->tm_hour << ":" << ts->tm_min << ":" 
00024          << ts->tm_sec;
00025       return os;
00026     }
00027     else {
00028       p.Print(os); 
00029       return os;
00030     }
00031   }


Generated on Sun Nov 22 04:45:30 2009 for NOvA Offline by  doxygen 1.3.9.1