Fawkes API Fawkes Development Version
manager.h
1
2/***************************************************************************
3 * manager.h - Fawkes Aspect Manager
4 *
5 * Created: Thu Nov 25 00:27:42 2010 (based on inifin.h)
6 * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#ifndef _ASPECT_MANAGER_H_
25#define _ASPECT_MANAGER_H_
26
27#include <core/threading/thread_finalizer.h>
28#include <core/threading/thread_initializer.h>
29
30#include <list>
31#include <map>
32#include <string>
33
34namespace fawkes {
35
36class BlackBoard;
37class Configuration;
38class Logger;
39class Clock;
40class FawkesNetworkHub;
41class PluginManager;
42class Thread;
43class ThreadCollector;
44class NetworkNameResolver;
45class ServicePublisher;
46class ServiceBrowser;
47class LoggerEmployer;
48class BlockedTimingExecutor;
49class MainLoopEmployer;
50class AspectIniFin;
51class SyncPointManager;
52
53namespace tf {
54class Transformer;
55}
56
58{
59public:
60 virtual ~AspectManager();
61
62 virtual void init(Thread *thread);
63 virtual void finalize(Thread *thread);
64 virtual bool prepare_finalize(Thread *thread);
65
66 void register_inifin(AspectIniFin *inifin);
67 void unregister_inifin(AspectIniFin *inifin);
68
69 bool has_threads_for_aspect(const char *aspect_name);
70
71 void register_default_inifins(BlackBoard * blackboard,
72 ThreadCollector * collector,
73 Configuration * config,
74 Logger * logger,
75 Clock * clock,
76 FawkesNetworkHub * fnethub,
77 MainLoopEmployer * mloop_employer,
78 LoggerEmployer * logger_employer,
80 NetworkNameResolver * nnresolver,
81 ServicePublisher * service_publisher,
82 ServiceBrowser * service_browser,
83 PluginManager * pmanager,
84 tf::Transformer * tf_listener,
85 SyncPointManager * syncpoint_manager);
86
87private:
88 std::map<std::string, AspectIniFin *> inifins_;
89 std::map<std::string, AspectIniFin *> default_inifins_;
90 std::map<std::string, std::list<Thread *>> threads_;
91};
92
93} // end namespace fawkes
94
95#endif
Aspect initializer/finalizer base class.
Definition: inifin.h:34
Aspect and aspect initializer/finalizer manager.
Definition: manager.h:58
virtual bool prepare_finalize(Thread *thread)
Prepare finalization of a thread.
Definition: manager.cpp:184
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.
Definition: manager.cpp:227
virtual void finalize(Thread *thread)
Finalize a thread.
Definition: manager.cpp:158
virtual void init(Thread *thread)
This method is called by the ThreadManager for each newly added Thread.
Definition: manager.cpp:115
void register_inifin(AspectIniFin *inifin)
Register initializer/finalizer.
Definition: manager.cpp:77
void unregister_inifin(AspectIniFin *inifin)
Unregister initializer/finalizer.
Definition: manager.cpp:89
bool has_threads_for_aspect(const char *aspect_name)
Check if threads for a particular aspect still exist.
Definition: manager.cpp:109
virtual ~AspectManager()
Constructor.
Definition: manager.cpp:64
The BlackBoard abstract class.
Definition: blackboard.h:46
Blocked timing executor.
Definition: executor.h:37
This is supposed to be the central clock in Fawkes.
Definition: clock.h:35
Interface for configuration handling.
Definition: config.h:68
Fawkes Network Hub.
Definition: hub.h:34
Logger employer The LoggerEmployer shall pipe all log messages of the system to added loggers.
Interface for logging.
Definition: logger.h:42
Main loop employer The MainLoopEmployer calls the main loop for execution.
Definition: employer.h:32
Network name and address resolver.
Definition: resolver.h:45
Fawkes Plugin Manager.
Definition: manager.h:48
Service browser.
Service publisher interface.
This class gives access to SyncPoints.
Thread finalizer interface.
Thread initializer interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
Coordinate transforms between any two frames in a system.
Definition: transformer.h:65
Fawkes library namespace.