24#include <aspect/inifins/aspect_provider.h>
25#include <aspect/inifins/blackboard.h>
26#include <aspect/inifins/blocked_timing.h>
27#include <aspect/inifins/clock.h>
28#include <aspect/inifins/configurable.h>
29#include <aspect/inifins/fawkes_network.h>
30#include <aspect/inifins/logger.h>
31#include <aspect/inifins/logging.h>
32#include <aspect/inifins/mainloop.h>
33#include <aspect/inifins/network.h>
34#include <aspect/inifins/plugin_director.h>
35#include <aspect/inifins/syncpoint.h>
36#include <aspect/inifins/syncpoint_manager.h>
37#include <aspect/inifins/thread_producer.h>
38#include <aspect/inifins/time_source.h>
39#include <aspect/inifins/vision.h>
40#include <aspect/inifins/vision_master.h>
41#include <aspect/manager.h>
43# include <aspect/inifins/webview.h>
46# include <aspect/inifins/tf.h>
49# include <aspect/inifins/pointcloud.h>
66 std::map<std::string, AspectIniFin *>::iterator i;
67 for (i = default_inifins_.begin(); i != default_inifins_.end(); ++i) {
70 default_inifins_.clear();
95 throw Exception(
"Threads with the %s aspect are still alive, cannot "
96 "unregister the aspect",
111 return (threads_.find(aspect_name) != threads_.end()) && (!threads_[aspect_name].empty());
117 Aspect *aspected_thread =
dynamic_cast<Aspect *
>(thread);
118 if (aspected_thread != NULL) {
119 const std::list<const char *> &aspects = aspected_thread->
get_aspects();
121 std::list<const char *> initialized;
124 std::list<const char *>::const_iterator i;
125 for (i = aspects.begin(); i != aspects.end(); ++i) {
126 if (inifins_.find(*i) == inifins_.end()) {
128 "but no initializer is known.",
132 inifins_[*i]->init(thread);
133 initialized.push_back(*i);
136 for (i = aspects.begin(); i != aspects.end(); ++i) {
137 threads_[*i].push_back(thread);
140 std::list<const char *>::const_reverse_iterator i;
141 for (i = initialized.rbegin(); i != initialized.rend(); ++i) {
142 inifins_[*i]->finalize(thread);
146 std::list<const char *>::const_reverse_iterator i;
147 for (i = initialized.rbegin(); i != initialized.rend(); ++i) {
148 inifins_[*i]->finalize(thread);
160 Aspect *aspected_thread =
dynamic_cast<Aspect *
>(thread);
161 if (aspected_thread != NULL) {
162 const std::list<const char *> &aspects = aspected_thread->
get_aspects();
164 std::list<const char *>::const_iterator i;
165 for (i = aspects.begin(); i != aspects.end(); ++i) {
166 if (inifins_.find(*i) == inifins_.end()) {
168 "but no finalizer is known.",
172 inifins_[*i]->finalize(thread);
177 for (i = aspects.begin(); i != aspects.end(); ++i) {
178 threads_[*i].remove(thread);
186 Aspect *aspected_thread =
dynamic_cast<Aspect *
>(thread);
187 if (aspected_thread != NULL) {
188 const std::list<const char *> &aspects = aspected_thread->
get_aspects();
190 std::list<const char *>::const_iterator i;
191 for (i = aspects.begin(); i != aspects.end(); ++i) {
192 if (inifins_.find(*i) == inifins_.end()) {
194 "but no finalizer is known.",
243 if (!default_inifins_.empty())
301 std::map<std::string, AspectIniFin *>::iterator i;
302 for (i = default_inifins_.begin(); i != default_inifins_.end(); ++i) {
303 inifins_[i->first] = i->second;
Aspect initializer/finalizer base class.
const char * get_aspect_name() const
Get aspect name.
virtual bool prepare_finalize(Thread *thread)
Prepare finalization of a thread.
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, SyncPointManager *syncpoint_manager)
Register default aspect initializer/finalizer.
virtual void finalize(Thread *thread)
Finalize a thread.
virtual void init(Thread *thread)
This method is called by the ThreadManager for each newly added Thread.
void register_inifin(AspectIniFin *inifin)
Register initializer/finalizer.
void unregister_inifin(AspectIniFin *inifin)
Unregister initializer/finalizer.
bool has_threads_for_aspect(const char *aspect_name)
Check if threads for a particular aspect still exist.
virtual ~AspectManager()
Constructor.
Initializer/finalizer for the AspectProviderAspect.
Fawkes aspect base class.
const std::list< const char * > & get_aspects() const
Get list of aspect names attached to a aspected thread.
Initializer/finalizer for the BlackBoardAspect.
The BlackBoard abstract class.
Initializer/finalizer for the BlockedTimingAspect.
Thread cannot be finalized.
Thread cannot be initialized.
Initializer/finalizer for the ClockAspect.
This is supposed to be the central clock in Fawkes.
Initializer/finalizer for the ConfigurableAspect.
Interface for configuration handling.
Base class for exceptions in Fawkes.
void append(const char *format,...) noexcept
Append messages to the message list.
Initializer/finalizer for the FawkesNetworkAspect.
Initializer/finalizer for the LoggerAspect.
Logger employer The LoggerEmployer shall pipe all log messages of the system to added loggers.
Initializer/finalizer for the LoggingAspect.
Initializer/finalizer for the MainLoopAspect.
Main loop employer The MainLoopEmployer calls the main loop for execution.
Initializer/finalizer for the NetworkAspect.
Network name and address resolver.
Initializer/finalizer for the PluginDirectorAspect.
Initializer/finalizer for the PointCloudAspect.
Service publisher interface.
Initializer/finalizer for the SyncPointAspect.
Initializer/finalizer for the SyncPointManagerAspect.
This class gives access to SyncPoints.
Initializer/finalizer for the ThreadProducerAspect.
Thread class encapsulation of pthreads.
const char * name() const
Get name of thread.
Initializer/finalizer for the TimeSourceAspect.
Initializer/finalizer for the VisionAspect.
Initializer/finalizer for the VisionMasterAspect.
Initializer/finalizer for the WebviewAspect.
Fawkes library namespace.