#include <appconfig.hpp>


Static Public Member Functions | |
| static const string & | get (const string &key) |
| access the configuation value for a given key. | |
| static Appconfig & | instance () |
| get the (single) Appconfig instance. | |
| static void | lifecycle (Symbol eventLabel) |
| fire off all lifecycle callbacks registered under the given label | |
Private Types | |
| typedef std::map< string, string > | Configmap |
| typedef scoped_ptr< Configmap > | PConfig |
|
typedef scoped_ptr < LifecycleRegistry > | PLife |
Private Member Functions | |
| Appconfig () | |
| perform initialization on first access. | |
Private Attributes | |
| PConfig | configParam_ |
| PLife | lifecycleHooks_ |
Friends | |
| void | boost::checked_delete (Appconfig *) |
| deletion prohibited | |
| class | LifecycleHook |
Definition at line 64 of file appconfig.hpp.
| lumiera::Appconfig::Appconfig | ( | ) | [private] |
perform initialization triggered on first access.
Definition at line 55 of file appconfig.cpp.
References lumiera::ON_BASIC_INIT.
00056 : configParam_ (new Configmap), 00057 lifecycleHooks_(new LifecycleRegistry) 00058 { 00059 lifecycleHooks_->execute (ON_BASIC_INIT); // note in most cases a NOP 00060 00061 (*configParam_)["version"] = STRINGIFY (LUMIERA_VERSION); 00062 }
| const string & lumiera::Appconfig::get | ( | const string & | key | ) | [static] |
Definition at line 69 of file appconfig.cpp.
References configParam_, and instance().
00070 { 00071 try 00072 { 00073 const string& val = (*instance().configParam_)[key]; 00074 WARN_IF ( isnil(val), config, "undefined config parameter \"%s\" requested.", key.c_str()); 00075 return val; 00076 } 00077 catch (...) 00078 { 00079 ERROR (config, "error while accessing configuration parameter \"%s\".", key.c_str()); 00080 static string NOTFOUND (""); 00081 return NOTFOUND; 00082 } }

| static Appconfig& lumiera::Appconfig::instance | ( | ) | [inline, static] |
Implemented as Meyers singleton.
Definition at line 82 of file appconfig.hpp.
Referenced by get(), and lifecycle().
00083 { 00084 static scoped_ptr<Appconfig> theApp_ (0); 00085 if (!theApp_) theApp_.reset (new Appconfig ()); 00086 return *theApp_; 00087 }

1.5.5