From 2b5affa8b3473ba603ce7fde87a071388f81f065 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 28 Nov 2008 21:39:48 +0100 Subject: [PATCH] Appconfig doesn't provide Config functionality any longer. This role of the Appconfig class is superseeded by the Config subsystem... --- src/lib/lifecycleregistry.hpp | 3 ++- src/lumiera/appconfig.cpp | 32 +------------------------------- src/lumiera/appconfig.hpp | 8 -------- tests/40components.tests | 2 +- tests/common/appconfigtest.cpp | 5 +++-- 5 files changed, 7 insertions(+), 43 deletions(-) diff --git a/src/lib/lifecycleregistry.hpp b/src/lib/lifecycleregistry.hpp index 285c95fac..984e97481 100644 --- a/src/lib/lifecycleregistry.hpp +++ b/src/lib/lifecycleregistry.hpp @@ -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] diff --git a/src/lumiera/appconfig.cpp b/src/lumiera/appconfig.cpp index 99a41d742..366b44331 100644 --- a/src/lumiera/appconfig.cpp +++ b/src/lumiera/appconfig.cpp @@ -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)); -} diff --git a/src/lumiera/appconfig.hpp b/src/lumiera/appconfig.hpp index a69336d78..83c081751 100644 --- a/src/lumiera/appconfig.hpp +++ b/src/lumiera/appconfig.hpp @@ -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 Configmap; - typedef scoped_ptr PConfig; typedef scoped_ptr 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); } diff --git a/tests/40components.tests b/tests/40components.tests index 4f505c5f6..6aeaa38e5 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -15,7 +15,7 @@ return: 0 END -TEST "Appconfig_test" Appconfig_test <