AppState implementation skeleton
This commit is contained in:
parent
14c1ebceb7
commit
010b0d99ff
6 changed files with 92 additions and 9 deletions
|
|
@ -80,6 +80,52 @@ namespace lumiera {
|
|||
|
||||
|
||||
|
||||
void
|
||||
AppState::evaluate (lumiera::Option& options)
|
||||
{
|
||||
UNIMPLEMENTED ("evaluate the options and set global application state");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
AppState::maybeStart (lumiera::Subsys&)
|
||||
{
|
||||
UNIMPLEMENTED ("maybe register and activate the given subsystem");
|
||||
}
|
||||
|
||||
|
||||
|
||||
using AppState::ExitCode;
|
||||
|
||||
|
||||
ExitCode
|
||||
AppState::maybeWait()
|
||||
{
|
||||
UNIMPLEMENTED ("wait on termination and normal shutdown");
|
||||
}
|
||||
|
||||
|
||||
|
||||
ExitCode
|
||||
AppState::abort (lumiera::Error& problem)
|
||||
{
|
||||
UNIMPLEMENTED ("clean error shutdown");
|
||||
}
|
||||
|
||||
|
||||
|
||||
ExitCode
|
||||
AppState::abort ()
|
||||
{
|
||||
UNIMPLEMENTED ("emergency shutdown");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ==== implementation LifecycleHook class =======
|
||||
|
|
|
|||
|
|
@ -80,7 +80,45 @@ namespace lumiera {
|
|||
static void lifecycle (Symbol eventLabel);
|
||||
|
||||
|
||||
/** evaluate the command line options and maybe additional configuration
|
||||
* such as to be able to determine the further behaviour of the application.
|
||||
* Set the internal state within this object accordingly */
|
||||
void evaluate (lumiera::Option& options);
|
||||
|
||||
|
||||
/** building on the state determined by #evaluate, decide if the given Subsys
|
||||
* needs to be pulled up and, if necessary, register the Subsys and its
|
||||
* prerequisites to be maintained throughout the application's lifetime. */
|
||||
void maybeStart (lumiera::Subsys&);
|
||||
|
||||
|
||||
enum ExitCode {
|
||||
NORMAL_EXIT,
|
||||
CLEAN_EXIT_AFTER_ERROR,
|
||||
CLEAN_EMERGENCY_EXIT,
|
||||
FAILED_EMERGENCY_EXIT
|
||||
};
|
||||
|
||||
/** put the main thread of the application into a wait state, if some subsystem(s)
|
||||
* registered with #maybeStart still need to be maintained. On termination of
|
||||
* one of those components, tear down the remaining components and initiate
|
||||
* a normal or emergency shutdown of the application, depending on the
|
||||
* triggering component's mode of termination (exit or exception).
|
||||
* @return global application exit code */
|
||||
ExitCode maybeWait();
|
||||
|
||||
|
||||
/** initiate the controlled error shutdown sequence
|
||||
* @param problem causing exception */
|
||||
ExitCode abort (lumiera::Error& problem);
|
||||
|
||||
|
||||
/** initiate an fatal emergency shutdown,
|
||||
* caused by an unforeseen error condition */
|
||||
ExitCode abort ();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
typedef scoped_ptr<LifecycleRegistry> PLife;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ main (int argc, const char* argv[])
|
|||
application.maybeStart (lumigui);
|
||||
application.maybeStart (script);
|
||||
|
||||
return 0; // main thread terminating after successful startup
|
||||
return application.maybeWait();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ namespace lumiera {
|
|||
|
||||
|
||||
ostream&
|
||||
operator<< (ostream& os, const TestOption& to)
|
||||
operator<< (ostream& os, const Option& to)
|
||||
{
|
||||
return os << to.syntax;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@ namespace lumiera {
|
|||
boost::program_options::options_description syntax;
|
||||
boost::program_options::variables_map parameters;
|
||||
|
||||
friend ostream& operator<< (ostream&, const TestOption&);
|
||||
friend ostream& operator<< (ostream&, const Option&);
|
||||
};
|
||||
|
||||
|
||||
/** for outputting the help messages. Forward accumulated
|
||||
* help messages from all contained option definitions */
|
||||
ostream& operator<< (ostream& os, const TestOption& to);
|
||||
ostream& operator<< (ostream& os, const Option& to);
|
||||
|
||||
|
||||
} // namespace lumiera
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Asset} - Superinterface: bookeeping view of "things" present in the session
|
||||
Asset - Superinterface: bookkeeping view of "things" present in the session
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
|
@ -40,8 +40,7 @@ using util::and_all;
|
|||
using util::cStr;
|
||||
|
||||
|
||||
namespace asset
|
||||
{
|
||||
namespace asset {
|
||||
|
||||
using ::NOBUG_FLAG(memory);
|
||||
NOBUG_CPP_DEFINE_FLAG_PARENT(assetmem, memory);
|
||||
|
|
@ -96,7 +95,7 @@ namespace asset
|
|||
}
|
||||
|
||||
/**
|
||||
* whether this asset is swithced on and consequently included
|
||||
* whether this asset is switched on and consequently included
|
||||
* in the fixture and participates in rendering.
|
||||
*/
|
||||
bool
|
||||
|
|
@ -137,7 +136,7 @@ namespace asset
|
|||
other->unlink (this->id);
|
||||
}
|
||||
|
||||
/** release all links to other <i>dependant</i>
|
||||
/** release all links to other <i>dependent</i>
|
||||
* asset objects held internally and advise all parent
|
||||
* assets to do so with the link to this asset.
|
||||
* @note we don't release upward links to parent assets,
|
||||
|
|
|
|||
Loading…
Reference in a new issue