Appconfig doesn't provide Config functionality any longer.

This role of the Appconfig class is superseeded by the Config subsystem...
This commit is contained in:
Fischlurch 2008-11-28 21:39:48 +01:00 committed by Christian Thaeter
parent 628be502e5
commit 2b5affa8b3
5 changed files with 7 additions and 43 deletions

View file

@ -59,7 +59,7 @@ namespace lumiera
/**
* Registry of callback functions accessable by a label (ID)
* Registry of callback functions accessible by a label (ID)
* provided at registration. Registered functions will be added
* to a list, which can be triggered via label. Used by Appconfig
* to implement the lumiera lifecycle (init, shutdown) hooks.
@ -73,6 +73,7 @@ namespace lumiera
typedef Callbacks::iterator Iter;
/** @note only one copy of each distinct callback remembered */
bool enroll (const string label, Hook toCall)
{
return table_[label]

View file

@ -33,9 +33,6 @@ namespace lumiera
{
#ifndef LUMIERA_VERSION
#define LUMIERA_VERSION 0++devel
#endif
Symbol ON_BASIC_INIT ("ON_BASIC_INIT");
Symbol ON_GLOBAL_INIT ("ON_GLOBAL_INIT");
@ -53,35 +50,15 @@ namespace lumiera
* client codes POV it just behaves like intended).
*/
Appconfig::Appconfig()
: configParam_ (new Configmap),
lifecycleHooks_(new LifecycleRegistry)
: lifecycleHooks_(new LifecycleRegistry)
{
lifecycleHooks_->execute (ON_BASIC_INIT); // note in most cases a NOP
(*configParam_)["version"] = STRINGIFY (LUMIERA_VERSION);
}
const string &
Appconfig::get (const string & key)
{
try
{
const string& val = (*instance().configParam_)[key];
WARN_IF ( isnil(val), config, "undefined config parameter \"%s\" requested.", key.c_str());
return val;
}
catch (...)
{
ERROR (config, "error while accessing configuration parameter \"%s\".", key.c_str());
static string NOTFOUND ("");
return NOTFOUND;
} }
void
Appconfig::lifecycle (Symbol event_label)
{
@ -131,10 +108,3 @@ lumiera_Lifecycle_execute (const char* eventLabel)
{
lumiera::Appconfig::lifecycle (eventLabel);
}
const char*
lumiera_Appconfig_get (const char* key)
{
return cStr (lumiera::Appconfig::get(key));
}

View file

@ -87,10 +87,6 @@ namespace lumiera
}
/** access the configuation value for a given key.
* @return empty string for unknown keys, config value else */
static const string & get (const string& key); // never throws
/** fire off all lifecycle callbacks
* registered under the given label */
static void lifecycle (Symbol eventLabel);
@ -99,11 +95,8 @@ namespace lumiera
// for querying the current lifecycle phase...
private:
typedef std::map<string,string> Configmap;
typedef scoped_ptr<Configmap> PConfig;
typedef scoped_ptr<LifecycleRegistry> PLife;
PConfig configParam_;
PLife lifecycleHooks_;
friend class LifecycleHook;
@ -150,7 +143,6 @@ extern "C" { //TODO provide a separate header if some C code happens to need th
void lumiera_LifecycleHook_add (const char* eventLabel, void callbackFun(void));
void lumiera_Lifecycle_execute (const char* eventLabel);
const char* lumiera_Appconfig_get (const char* key);
}

View file

@ -15,7 +15,7 @@ return: 0
END
TEST "Appconfig_test" Appconfig_test <<END
PLANNED "Appconfig_test" Appconfig_test <<END
return: 0
END

View file

@ -41,13 +41,14 @@ namespace lumiera
virtual void run (Arg arg)
{
testAccess("version");
UNIMPLEMENTED ("reorganise config access for C++");
}
/** @test accessing a value from lumiera::Appconfig */
void testAccess (const string& key)
{
string ver = lumiera::Appconfig::get(key);
ASSERT ( !util::isnil(ver));
// string ver = lumiera::Appconfig::get(key);
// ASSERT ( !util::isnil(ver));
}
};