Fawkes API
Fawkes Development Version
|
Aspect and aspect initializer/finalizer manager. More...
#include <>>
Public Member Functions | |
virtual | ~AspectManager () |
Constructor. More... | |
virtual void | init (Thread *thread) |
This method is called by the ThreadManager for each newly added Thread. More... | |
virtual void | finalize (Thread *thread) |
Finalize a thread. More... | |
virtual bool | prepare_finalize (Thread *thread) |
Prepare finalization of a thread. More... | |
void | register_inifin (AspectIniFin *inifin) |
Register initializer/finalizer. More... | |
void | unregister_inifin (AspectIniFin *inifin) |
Unregister initializer/finalizer. More... | |
bool | has_threads_for_aspect (const char *aspect_name) |
Check if threads for a particular aspect still exist. More... | |
void | register_default_inifins (BlackBoard *blackboard, ThreadCollector *collector, Configuration *config, Logger *logger, Clock *clock, FawkesNetworkHub *fnethub, MainLoopEmployer *mloop_employer, LoggerEmployer *logger_employer, BlockedTimingExecutor *btexec, NetworkNameResolver *nnresolver, ServicePublisher *service_publisher, ServiceBrowser *service_browser, PluginManager *pmanager, tf::Transformer *tf_listener) |
Register default aspect initializer/finalizer. More... | |
![]() | |
virtual | ~ThreadInitializer () |
Virtual empty destructor. More... | |
![]() | |
virtual | ~ThreadFinalizer () |
Virtual empty destructor. More... | |
Aspect and aspect initializer/finalizer manager.
This class is the central gatekeeper to aspects for the main application. It manages the initializers/finalizers and thus the aspects which are currently available in the system. It assures that these are not removed before the last thread with an aspect is gone.
|
virtual |
Constructor.
Definition at line 65 of file manager.cpp.
|
virtual |
Finalize a thread.
This method is called by the ThreadManager for each Thread that is to be stopped and removed from the list of running threads. The finalizer shall NOT call Thread::finalize().
thread | thread to finalize. |
CannotFinalizeThread | thrown if thread can for not b finalized |
Implements fawkes::ThreadFinalizer.
Definition at line 159 of file manager.cpp.
References fawkes::Aspect::get_aspects(), and fawkes::Thread::name().
bool fawkes::AspectManager::has_threads_for_aspect | ( | const char * | aspect_name | ) |
Check if threads for a particular aspect still exist.
aspect_name | name of the aspect to check for |
Definition at line 111 of file manager.cpp.
Referenced by fawkes::AspectProviderAspectIniFin::prepare_finalize().
|
virtual |
This method is called by the ThreadManager for each newly added Thread.
thread | thread to initialize. |
CannotInitializeThread | thrown if thread can for not be initialized |
Implements fawkes::ThreadInitializer.
Definition at line 118 of file manager.cpp.
References fawkes::Exception::append(), fawkes::Aspect::get_aspects(), and fawkes::Thread::name().
|
virtual |
Prepare finalization of a thread.
If the finalizer needs to do anything to prepare a maybe following finalize() can do so here. This is also the only place where it proclaim that finalizing the given thread at the given time is unsafe. The finalizer shall NOT call Thread::prepare_finalize().
thread | thread to prepare finalization for |
Implements fawkes::ThreadFinalizer.
Definition at line 185 of file manager.cpp.
References fawkes::Aspect::get_aspects(), and fawkes::Thread::name().
void fawkes::AspectManager::register_default_inifins | ( | BlackBoard * | blackboard, |
ThreadCollector * | collector, | ||
Configuration * | config, | ||
Logger * | logger, | ||
Clock * | clock, | ||
FawkesNetworkHub * | fnethub, | ||
MainLoopEmployer * | mloop_employer, | ||
LoggerEmployer * | logger_employer, | ||
BlockedTimingExecutor * | btexec, | ||
NetworkNameResolver * | nnresolver, | ||
ServicePublisher * | service_publisher, | ||
ServiceBrowser * | service_browser, | ||
PluginManager * | pmanager, | ||
tf::Transformer * | tf_listener | ||
) |
Register default aspect initializer/finalizer.
This loads initializer/finalizer of all aspects which are in the Fawkes aspect library.
blackboard | blackboard for BlackBoardAspect and TransformAspect |
collector | thread collector for ThreadProducerAspect |
config | configuration for ConfigurableAspect |
clock | clock for ClockAspect |
logger | logger for LoggingAspect |
fnethub | Fawkes network hub for FawkesNetworkAspect |
mloop_employer | Main loop employer for MainLoopAspect |
logger_employer | logger employer for LoggerAspect |
btexec | blocked timing executor for MainLoopAspect |
nnresolver | network name resolver for NetworkAspect |
service_publisher | service publisher for NetworkAspect |
service_browser | service browser for NetworkAspect |
pmanager | plugin manager for PluginDirectorAspect |
tf_listener | transformer for TransformAspect |
Definition at line 226 of file manager.cpp.
References fawkes::AspectIniFin::get_aspect_name().
void fawkes::AspectManager::register_inifin | ( | AspectIniFin * | inifin | ) |
Register initializer/finalizer.
inifin | aspect initializer/finalizer to register |
Definition at line 78 of file manager.cpp.
References fawkes::AspectIniFin::get_aspect_name().
Referenced by fawkes::AspectProviderAspectIniFin::init().
void fawkes::AspectManager::unregister_inifin | ( | AspectIniFin * | inifin | ) |
Unregister initializer/finalizer.
inifin | aspect initializer/finalizer to unregister |
Definition at line 91 of file manager.cpp.
References fawkes::AspectIniFin::get_aspect_name().
Referenced by fawkes::AspectProviderAspectIniFin::finalize().