refactor Appconfig, split off lifecycle interface

This commit is contained in:
Fischlurch 2008-11-30 06:43:51 +01:00 committed by Christian Thaeter
parent 9e0e79c55c
commit b14d711146
37 changed files with 302 additions and 226 deletions

View file

@ -24,7 +24,7 @@
#include "common/configrules.hpp"
#include "common/query/mockconfigrules.hpp"
//#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"

View file

@ -26,7 +26,7 @@
#ifndef LUMIERA_MULTITHREAD_H
#define LUMIERA_MULTITHREAD_H
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include "common/util.hpp"

View file

@ -23,7 +23,7 @@
#include "common/query.hpp"
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include <boost/algorithm/string.hpp>
#include <boost/regex.hpp>

View file

@ -28,7 +28,7 @@
#include "proc/asset/pipe.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include "common/util.hpp"
using util::isnil;

View file

@ -38,7 +38,7 @@ This code is heavily inspired by
#include "common/singletonpolicies.hpp" // several Policies usable together with SingletonFactory
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"

View file

@ -28,7 +28,7 @@
#include "pre.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include "common/test/suite.hpp"
#include "common/util.hpp"

View file

@ -30,7 +30,7 @@
#include <sstream>
#include <boost/algorithm/string.hpp>
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include "lib/cmdline.hpp"
#include "common/test/suite.hpp"
#include "common/test/run.hpp"

View file

@ -196,7 +196,7 @@ Actions::on_menu_help_about()
//dialog.set_program_name(AppTitle);
dialog.set_version(AppVersion);
//dialog.set_version(Appconfig::get("version"));
//dialog.set_version(AppState::get("version"));
dialog.set_copyright(AppCopyright);
dialog.set_website(AppWebsite);
dialog.set_authors(StringArrayHandle(AppAuthors,

View file

@ -25,8 +25,8 @@
#define LUMIERA_ERROR_HPP_
#include <string>
#include "include/nobugcfg.hpp"
#include "lumiera/appconfig.hpp"
#include "include/nobugcfg.h"
#include "include/lifecycle.h"
#include "lib/error.h"
@ -154,7 +154,7 @@ namespace lumiera {
/** install our own handler for undeclared exceptions. Will be
* called automatically ON_BASIC_INIT when including errror.hpp
* @note it's OK this is defined multiple times...
* @see appconfig.hpp */
* @see appstate.hpp */
void install_unexpectedException_handler ();
namespace {
LifecycleHook schedule_ (ON_BASIC_INIT, &install_unexpectedException_handler);

105
src/include/lifecycle.h Normal file
View file

@ -0,0 +1,105 @@
/*
LIFECYCLE.h - interface for registering and triggering lifecycle callbacks
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file lifecycle.h
** Interface for registering and triggering application lifecycle event callbacks.
** This service is a facade for and implemented by lumiera::AppState.
** By placing a static LifecycleHook variable or by calling LifecycleHook::add,
** a callback can be registered to be executed on a specific application lifecycle
** event. Examples being #ON_BASIC_INIT, #ON_GLOBAL_INIT. Other subsystems may
** register additional events for more specific purpose.
**
** @see lumiera::AppState
** @see main.cpp
*/
#ifndef LUMIERA_LIFECYCLE_H
#define LUMIERA_LIFECYCLE_H
#ifdef __cplusplus
#include "include/symbol.hpp"
#include <boost/noncopyable.hpp>
namespace lumiera {
extern Symbol ON_BASIC_INIT; ///< automatic static init. treated specially
extern Symbol ON_GLOBAL_INIT; ///< to be triggered in main() @note no magic!
extern Symbol ON_GLOBAL_SHUTDOWN; ///< to be triggered at the end of main() @note no magic!
// client code is free to register and use additional lifecycle events
/**
* define and register a callback for a specific lifecycle event.
* The purpose of this class is to be defined as a static variable in the implementation
* of some subsystem (i.e. in the cpp file), providing the ctor with the pointer to a
* callback function. Thus the callback gets enrolled when the corresponding object file
* is loaded. The event ON_BASIC_INIT is handled specifically, firing off the referred
* callback function as soon as possible. All other labels are just arbitrary (string)
* constants and it is necessary that "someone" cares to fire off the lifecycle events
* at the right place. For example, lumiera-main (and the test runner) calls
* \c AppState::instance().execute(ON_GLOBAL_INIT) (and..SHUTDOWN)
* @note duplicate or repeated calls with the same callback are NOP
*/
class LifecycleHook
: private boost::noncopyable
{
public:
typedef void (*Hook)(void);
LifecycleHook (Symbol eventLabel, Hook callbackFun);
/** for chained calls (add multiple callbacks) */
LifecycleHook& add (Hook callbackFun);
/** alternative, static interface for registering a callback */
static void add (Symbol eventLabel, Hook callbackFun);
/** trigger lifecycle callbacks registered under the given label */
static void trigger (Symbol eventLabel);
};
} // namespace lumiera
#else /* =========== C interface ====================== */
extern const char * lumiera_ON_BASIC_INIT;
extern const char * lumiera_ON_GLOBAL_INIT;
extern const char * lumiera_ON_GLOBAL_SHUTDOWN;
void lumiera_LifecycleHook_add (const char* eventLabel, void callbackFun(void));
void lumiera_Lifecycle_trigger (const char* eventLabel);
#endif
#endif

View file

@ -22,7 +22,7 @@
*/
/** @file nobugcfg.hpp
/** @file nobugcfg.h
** This header is for including and configuring NoBug.
** The idea is that configuration and some commonly used flag
** declarations are to be kept in one central location. Subsystems
@ -67,7 +67,7 @@
#ifdef __cplusplus /* ============= C++ ================ */
#include "lumiera/appstate.hpp"
#include "include/lifecycle.h"
#include "include/error.hpp" ///< make assertions throw instead of abort()
namespace lumiera {

View file

@ -47,7 +47,7 @@ noinst_HEADERS += \
$(liblumiera_a_srcdir)/mrucache.h \
$(liblumiera_a_srcdir)/time.h \
$(liblumiera_a_srcdir)/ppmpl.h \
$(liblumiera_a_srcdir)/appconfig.hpp \
$(liblumiera_a_srcdir)/appstate.hpp \
$(liblumiera_a_srcdir)/allocationcluster.hpp \
$(liblumiera_a_srcdir)/scopedholdertransfer.hpp \
$(liblumiera_a_srcdir)/scopedholder.hpp \

View file

@ -24,7 +24,7 @@
#include "lib/cmdline.hpp"
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include <boost/regex.hpp>
#include <boost/algorithm/string/split.hpp>

View file

@ -23,7 +23,7 @@
/** @file lifecycleregistry.hpp
** Helper for registering lifecycle event callbacks, which are
** provided as a global service by lumiera::Appconfig. This service
** provided as a global service by lumiera::AppState. This service
** allows to enrol functions under a given label and then to call
** all those registered functions.
** @note this is in fact an event mechanism, and if we start using
@ -31,7 +31,7 @@
** boost::signals. (which has the downside of being an binary
** dependency).
**
** @see appconfig.hpp
** @see appstate.hpp
*/
@ -54,14 +54,14 @@ namespace lumiera {
using util::contains;
using std::string;
typedef const char * const Symbol; //TODO define a real Symbol class, i.e. same literal string==same pointer,
// typedef const char * const Symbol; //TODO define a real Symbol class, i.e. same literal string==same pointer,
// so we don't have to store string keys in the map...
/**
* 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 a list, which can be triggered via label. Used by AppState
* to implement the lumiera lifecycle (init, shutdown) hooks.
*/
class LifecycleRegistry
@ -95,7 +95,7 @@ namespace lumiera {
std::map<const string, Callbacks> table_;
LifecycleRegistry () {}
friend class Appconfig;
friend class AppState;
};

View file

@ -1,150 +0,0 @@
/*
APPCONFIG.hpp - for global initialization and configuration
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file appconfig.hpp
** Registering and managing some application-global services.
** Besides \link Appconfig::get querying \endlink for some
** "Application property" constants, there is a mechanism for
** registering and firing off application lifecycle event hooks.
** The implementation of some subsystem can define a static instance
** variable of class LifecycleHook, which will place the provided
** callback function into a central registry accessable through
** the Appconfig singleton instance.
**
** @see lumiera.cpp
** @see nobugcfg.cpp
** @see sessmanagerimpl.cpp
*/
#ifndef LUMIERA_APPCONFIG_H
#define LUMIERA_APPCONFIG_H
#include <map>
#include <string>
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp>
#include "lib/lifecycleregistry.hpp"
namespace lumiera
{
using std::string;
using boost::scoped_ptr;
using boost::noncopyable;
/**
* Singleton to hold inevitable global flags and constants
* and for performing early (static) global initialization tasks.
* Appconfig services are available already from static
* initialsation code.
* @warning don't use Appconfig in destuctors.
*/
class Appconfig
: private noncopyable
{
private:
/** perform initialization on first access.
* @see #instance()
*/
Appconfig ();
~Appconfig () throw() {}; ///< deletion prohibited
friend void boost::checked_delete<Appconfig>(Appconfig*);
public:
/** get the (single) Appconfig instance.
* Implemented as Meyers singleton.
* @warning don't use it after the end of main()!
*/
static Appconfig& instance()
{
static scoped_ptr<Appconfig> theApp_ (0);
if (!theApp_) theApp_.reset (new Appconfig ());
return *theApp_;
}
/** fire off all lifecycle callbacks
* registered under the given label */
static void lifecycle (Symbol eventLabel);
// note: if necessary, we can add support
// for querying the current lifecycle phase...
private:
typedef scoped_ptr<LifecycleRegistry> PLife;
PLife lifecycleHooks_;
friend class LifecycleHook;
};
extern Symbol ON_BASIC_INIT; ///< automatic static init. treated specially
extern Symbol ON_GLOBAL_INIT; ///< to be triggered in main() @note no magic!
extern Symbol ON_GLOBAL_SHUTDOWN; ///< to be triggered at the end of main() @note no magic!
// client code is free to register and use additional lifecycle events
/**
* define and register a callback for some lifecycle event.
* The purpose of this class is to be defined as a static variable
* in the implementation of some subsystem (i.e. in the cpp file),
* providing the ctor with the pointer to a callback function.
* Thus the callback gets enrolled when the corresponding object
* file is loaded. The event ON_BASIC_INIT is handled specifically,
* firing off the referred callback function as soon as possible.
* All other lables are just arbitrary (string) constants and it
* is necessary that "someone" cares to fire off the lifcycle events
* at the right place. For example, lumiera-main (and the test runner)
* calls \c Appconfig::instance().execute(ON_GLOBAL_INIT) (and..SHUTDOWN)
* @note duplicate or repeated calls with the same callback are a NOP
*/
class LifecycleHook
: private noncopyable
{
public:
LifecycleHook (Symbol eventLabel, LifecycleRegistry::Hook callbackFun);
LifecycleHook& add (Symbol eventLabel, LifecycleRegistry::Hook callbackFun); ///< for chained calls (add multiple callbacks)
};
} // namespace lumiera
extern "C" { //TODO provide a separate header if some C code happens to need this...
void lumiera_LifecycleHook_add (const char* eventLabel, void callbackFun(void));
void lumiera_Lifecycle_execute (const char* eventLabel);
}
#endif

View file

@ -1,5 +1,5 @@
/*
Appconfig - for global initialisation and configuration
AppState - application initialisation and behaviour
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
@ -21,7 +21,9 @@
* *****************************************************/
#include "lumiera/appconfig.hpp"
#include "lumiera/appstate.hpp"
#include "lib/lifecycleregistry.hpp"
#include "include/error.hpp"
#include "common/util.hpp"
@ -31,41 +33,53 @@ using util::cStr;
namespace lumiera {
Symbol ON_BASIC_INIT ("ON_BASIC_INIT");
Symbol ON_GLOBAL_INIT ("ON_GLOBAL_INIT");
Symbol ON_GLOBAL_SHUTDOWN ("ON_GLOBAL_SHUTDOWN");
/** perform initialisation triggered on first access.
* Will execute the ON_BASIC_INIT hook, but under typical
* circumstances this is a NOP, because when callbacks are
* added to this hook, the Appconfig singleton instance has
* added to this hook, the AppState singleton instance has
* already been created. For this reason, there is special
* treatment for the ON_BASIC_INIT in LifecycleHook::add,
* causing the provided callbacks to be fired immediately.
* (btw, this is nothing to be worried of, because from
* client codes POV it just behaves like intended).
*/
Appconfig::Appconfig()
AppState::AppState()
: lifecycleHooks_(new LifecycleRegistry)
{
lifecycleHooks_->execute (ON_BASIC_INIT); // note in most cases a NOP
}
AppState::~AppState() { }
AppState&
AppState::instance() // Meyer's singleton
{
static scoped_ptr<AppState> theApp_ (0);
if (!theApp_) theApp_.reset (new AppState ());
return *theApp_;
}
void
Appconfig::lifecycle (Symbol event_label)
AppState::lifecycle (Symbol event_label)
{
instance().lifecycleHooks_->execute(event_label);
}
// ==== implementation LifecycleHook class =======
@ -80,12 +94,12 @@ namespace lumiera {
LifecycleHook&
LifecycleHook::add (Symbol eventLabel, Callback callbackFun)
{
bool isNew = Appconfig::instance().lifecycleHooks_->enroll (eventLabel,callbackFun);
bool isNew = AppState::instance().lifecycleHooks_->enroll (eventLabel,callbackFun);
if (isNew && !strcmp(ON_BASIC_INIT, eventLabel))
callbackFun(); // when this code executes,
// then per definition we are already post "basic init"
// (which happens in the Appconfig ctor); thus fire it immediately
// (which happens in the AppState ctor); thus fire it immediately
return *this;
}
@ -93,17 +107,28 @@ namespace lumiera {
} // namespace lumiera
// ==== implementation C interface =======
void
lumiera_LifecycleHook_add (const char* eventLabel, void callbackFun(void))
{
lumiera::LifecycleHook (eventLabel, callbackFun);
extern "C" { /* ==== implementation C interface for lifecycle hooks ======= */
extern const char * lumiera_ON_BASIC_INIT = lumiera::ON_BASIC_INIT;
extern const char * lumiera_ON_GLOBAL_INIT = lumiera::ON_GLOBAL_INIT;
extern const char * lumiera_ON_GLOBAL_SHUTDOWN = lumiera::ON_GLOBAL_SHUTDOWN;
void
lumiera_LifecycleHook_add (const char* eventLabel, void callbackFun(void))
{
lumiera::LifecycleHook (eventLabel, callbackFun);
}
void
lumiera_Lifecycle_trigger (const char* eventLabel)
{
lumiera::AppState::lifecycle (eventLabel);
}
}
void
lumiera_Lifecycle_execute (const char* eventLabel)
{
lumiera::Appconfig::lifecycle (eventLabel);
}

96
src/lumiera/appstate.hpp Normal file
View file

@ -0,0 +1,96 @@
/*
APPSTATE.hpp - application initialisation and behaviour
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file appstate.hpp
** Registering and managing some application-global services.
** Besides encapsulating the logic for starting up the fundamental parts
** of the application, there is a mechanism for registering and firing off
** application lifecycle event callbacks.
**
** @see LifecycleHook
** @see main.cpp
** @see nobugcfg.h
*/
#ifndef LUMIERA_APPSTATE_H
#define LUMIERA_APPSTATE_H
#include "include/symbol.hpp"
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
#include <string>
#include <map>
namespace lumiera {
using std::string;
using boost::scoped_ptr;
using boost::noncopyable;
class LifecycleRegistry;
/**
* Singleton to hold global flags directing the overall application behaviour,
* for triggering lifecycle events and performing early initialisation tasks.
* AppState services are available already from static initialisation code.
* @warning don't use AppState in destructors.
*/
class AppState
: private noncopyable
{
private:
AppState ();
~AppState (); ///< deletion prohibited
friend void boost::checked_delete<AppState>(AppState*);
public:
/** get the (single) AppState instance.
* @warning don't use it after the end of main()! */
static AppState& instance();
/** fire off all lifecycle callbacks
* registered under the given label */
static void lifecycle (Symbol eventLabel);
private:
typedef scoped_ptr<LifecycleRegistry> PLife;
PLife lifecycleHooks_;
friend class LifecycleHook;
};
} // namespace lumiera
#endif

View file

@ -23,7 +23,7 @@
//TODO: Lumiera header includes//
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include "lumiera/lumiera.h"
#include "lumiera/interface.h"
#include "lumiera/interfaceregistry.h"

View file

@ -23,7 +23,7 @@
//TODO: Lumiera header includes//
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include "lumiera/lumiera.h"
#include "lumiera/config_interface.h"

View file

@ -28,7 +28,7 @@
using std::cout;
using std::endl;
using lumiera::Appconfig;
using lumiera::AppState;
using lumiera::ON_GLOBAL_INIT;
using lumiera::ON_GLOBAL_SHUTDOWN;
@ -37,10 +37,10 @@ int main (int argc, char* argv[])
{
cout << "*** Lumiera NLE for Linux ***" << endl;
Appconfig::lifecycle (ON_GLOBAL_INIT);
AppState::lifecycle (ON_GLOBAL_INIT);
// great things are happening here....
Appconfig::lifecycle (ON_GLOBAL_SHUTDOWN);
AppState::lifecycle (ON_GLOBAL_SHUTDOWN);
return 0;
}

View file

@ -21,10 +21,10 @@
* *****************************************************/
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#define NOBUG_INIT_DEFS_
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#undef NOBUG_INIT_DEFS_

View file

@ -219,5 +219,5 @@ noinst_HEADERS += \
$(liblumiproc_a_srcdir)/asset.hpp \
$(liblumiproc_a_srcdir)/assetmanager.hpp \
$(liblumiproc_a_srcdir)/lumiera.hpp \
$(liblumiproc_a_srcdir)/nobugcfg.hpp
$(liblumiproc_a_srcdir)/nobugcfg.h

View file

@ -56,7 +56,7 @@
#include "proc/asset/category.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include "include/error.hpp"
#include "common/p.hpp"

View file

@ -23,7 +23,7 @@
#include "proc/asset/category.hpp"
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include <boost/algorithm/string.hpp>

View file

@ -29,7 +29,7 @@
#include "proc/mobject/session/clip.hpp"
#include "proc/mobject/session/mobjectfactory.hpp"
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include <boost/regex.hpp>
#include <boost/format.hpp>

View file

@ -24,7 +24,7 @@
#include "proc/assetmanager.hpp"
#include "proc/asset/meta.hpp"
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
namespace asset

View file

@ -24,7 +24,7 @@
#include "proc/assetmanager.hpp"
#include "proc/asset/proc.hpp"
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
namespace asset

View file

@ -31,7 +31,7 @@
#include "proc/asset/structfactoryimpl.hpp"
#include "common/util.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
#include <boost/format.hpp>

View file

@ -45,8 +45,8 @@
#include "common/p.hpp"
#include "common/util.hpp"
#include "common/lumitime.hpp"
#include "include/error.hpp" ///< pulls in NoBug via nobugcfg.hpp
#include "lumiera/appconfig.hpp"
#include "include/error.hpp" ///< pulls in NoBug via nobugcfg.h
#include "lumiera/appstate.hpp"
/**

View file

@ -52,7 +52,7 @@ namespace control {
STypeManager::reset()
{
reg_.reset(new Registry);
lumiera::Appconfig::lifecycle(ON_STREAMTYPES_RESET);
lumiera::AppState::lifecycle(ON_STREAMTYPES_RESET);
}
/** \par

View file

@ -24,7 +24,7 @@
#ifndef MOBJECT_BUILDER_COMMON_H
#define MOBJECT_BUILDER_COMMON_H
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
namespace mobject {

View file

@ -22,7 +22,7 @@
#include "proc/mobject/session/fixture.hpp"
#include "include/nobugcfg.hpp"
#include "include/nobugcfg.h"
namespace mobject
{

View file

@ -15,7 +15,7 @@
#include <nobug.h>
//#include "include/nobugcfg.hpp"
//#include "include/nobugcfg.h"
#include <iostream>
//#include <typeinfo>

View file

@ -1,5 +1,5 @@
/*
Appconfig(Test) - accessing the always-available Appconfig singleton
Appconfig(Test) - accessing the always-available AppState singleton
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
@ -25,7 +25,7 @@
#include "common/test/run.hpp"
#include "common/util.hpp"
#include "lumiera/appconfig.hpp"
#include "lumiera/appstate.hpp"
@ -42,10 +42,10 @@ namespace lumiera {
UNIMPLEMENTED ("reorganise config access for C++");
}
/** @test accessing a value from lumiera::Appconfig */
/** @test accessing a value from lumiera::AppState */
void testAccess (const string& key)
{
// string ver = lumiera::Appconfig::get(key);
// string ver = lumiera::AppState::get(key);
// ASSERT ( !util::isnil(ver));
}
};

View file

@ -182,7 +182,7 @@ namespace lumiera
* this should result in the global unknown() handler to be called,
* so usually it will terminate the testrun.
* @note inside error.hpp, an initialisation hook has been installed into
* Appconfig, causing our own unknown() handler to be installed and
* AppState, causing our own unknown() handler to be installed and
* invoked, which gives additional diagnostics.*/
void terminateUnknown () throw()
{

View file

@ -1,5 +1,5 @@
/*
LifeCycle(Test) - checking the lifecycle callback hooks provided by Appconfig
LifeCycle(Test) - checking the lifecycle callback hooks provided by AppState
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
@ -25,7 +25,7 @@
#include "common/test/run.hpp"
#include "common/util.hpp"
#include "lumiera/appconfig.hpp"
#include "lumiera/appstate.hpp"
@ -64,7 +64,7 @@ namespace lumiera
ASSERT (1 == basicInit, "the basic-init callback has been invoked more than once");
ASSERT (!customCallback);
Appconfig::lifecycle (MY_MAGIC_MEGA_EVENT);
AppState::lifecycle (MY_MAGIC_MEGA_EVENT);
ASSERT ( 1 == customCallback);
}

View file

@ -23,9 +23,9 @@
#include "common/test/suite.hpp"
#include "common/test/testoption.hpp"
#include "lumiera/appconfig.hpp"
#include "lumiera/appstate.hpp"
using lumiera::Appconfig;
using lumiera::AppState;
using lumiera::ON_GLOBAL_INIT;
using lumiera::ON_GLOBAL_SHUTDOWN;
@ -39,13 +39,13 @@ int main (int argc, const char* argv[])
util::Cmdline args (argc,argv);
test::TestOption optparser (args);
test::Suite suite (optparser.getTestgroup());
Appconfig::lifecycle(ON_GLOBAL_INIT);
AppState::lifecycle(ON_GLOBAL_INIT);
if (optparser.getDescribe())
suite.describe();
else
suite.run (args);
Appconfig::lifecycle(ON_GLOBAL_SHUTDOWN);
AppState::lifecycle(ON_GLOBAL_SHUTDOWN);
return 0;
}