Fawkes API  Fawkes Development Version
fawkes::AspectManager Class Reference

Aspect and aspect initializer/finalizer manager. More...

#include <>>

Inheritance diagram for fawkes::AspectManager:

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...
 
- Public Member Functions inherited from fawkes::ThreadInitializer
virtual ~ThreadInitializer ()
 Virtual empty destructor. More...
 
- Public Member Functions inherited from fawkes::ThreadFinalizer
virtual ~ThreadFinalizer ()
 Virtual empty destructor. More...
 

Detailed Description

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.

Author
Tim Niemueller

Definition at line 59 of file manager.h.

Constructor & Destructor Documentation

◆ ~AspectManager()

fawkes::AspectManager::~AspectManager ( )
virtual

Constructor.

Definition at line 65 of file manager.cpp.

Member Function Documentation

◆ finalize()

void fawkes::AspectManager::finalize ( Thread thread)
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().

Parameters
threadthread to finalize.
Exceptions
CannotFinalizeThreadthrown if thread can for not b finalized
See also
Thread::finalize()

Implements fawkes::ThreadFinalizer.

Definition at line 159 of file manager.cpp.

References fawkes::Aspect::get_aspects(), and fawkes::Thread::name().

◆ has_threads_for_aspect()

bool fawkes::AspectManager::has_threads_for_aspect ( const char *  aspect_name)

Check if threads for a particular aspect still exist.

Parameters
aspect_namename of the aspect to check for
Returns
true if thread for the given aspect have been registered, false otherwise

Definition at line 111 of file manager.cpp.

Referenced by fawkes::AspectProviderAspectIniFin::prepare_finalize().

◆ init()

void fawkes::AspectManager::init ( Thread thread)
virtual

This method is called by the ThreadManager for each newly added Thread.

Parameters
threadthread to initialize.
Exceptions
CannotInitializeThreadthrown 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().

◆ prepare_finalize()

bool fawkes::AspectManager::prepare_finalize ( Thread thread)
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().

Parameters
threadthread to prepare finalization for
Returns
true if nothing prevents finalization, false otherwise
See also
Thread::prepare_finalize()

Implements fawkes::ThreadFinalizer.

Definition at line 185 of file manager.cpp.

References fawkes::Aspect::get_aspects(), and fawkes::Thread::name().

◆ register_default_inifins()

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.

Parameters
blackboardblackboard for BlackBoardAspect and TransformAspect
collectorthread collector for ThreadProducerAspect
configconfiguration for ConfigurableAspect
clockclock for ClockAspect
loggerlogger for LoggingAspect
fnethubFawkes network hub for FawkesNetworkAspect
mloop_employerMain loop employer for MainLoopAspect
logger_employerlogger employer for LoggerAspect
btexecblocked timing executor for MainLoopAspect
nnresolvernetwork name resolver for NetworkAspect
service_publisherservice publisher for NetworkAspect
service_browserservice browser for NetworkAspect
pmanagerplugin manager for PluginDirectorAspect
tf_listenertransformer for TransformAspect

Definition at line 226 of file manager.cpp.

References fawkes::AspectIniFin::get_aspect_name().

◆ register_inifin()

void fawkes::AspectManager::register_inifin ( AspectIniFin inifin)

Register initializer/finalizer.

Parameters
inifinaspect initializer/finalizer to register

Definition at line 78 of file manager.cpp.

References fawkes::AspectIniFin::get_aspect_name().

Referenced by fawkes::AspectProviderAspectIniFin::init().

◆ unregister_inifin()

void fawkes::AspectManager::unregister_inifin ( AspectIniFin inifin)

Unregister initializer/finalizer.

Parameters
inifinaspect initializer/finalizer to unregister

Definition at line 91 of file manager.cpp.

References fawkes::AspectIniFin::get_aspect_name().

Referenced by fawkes::AspectProviderAspectIniFin::finalize().


The documentation for this class was generated from the following files: