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_initializer.h>
28 #include <core/threading/thread_finalizer.h>
29 
30 #include <map>
31 #include <list>
32 #include <string>
33 
34 namespace fawkes {
35 #if 0 /* just to make Emacs auto-indent happy */
36 }
37 #endif
38 
39 class BlackBoard;
40 class Configuration;
41 class Logger;
42 class Clock;
43 class FawkesNetworkHub;
44 class PluginManager;
45 class Thread;
46 class ThreadCollector;
47 class NetworkNameResolver;
48 class ServicePublisher;
49 class ServiceBrowser;
50 class LoggerEmployer;
51 class BlockedTimingExecutor;
52 class MainLoopEmployer;
53 class AspectIniFin;
54 
56 {
57  public:
58  virtual ~AspectManager();
59 
60  virtual void init(Thread *thread);
61  virtual void finalize(Thread *thread);
62  virtual bool prepare_finalize(Thread *thread);
63 
64  void register_inifin(AspectIniFin *inifin);
65  void unregister_inifin(AspectIniFin *inifin);
66 
67  bool has_threads_for_aspect(const char *aspect_name);
68 
69  void register_default_inifins(BlackBoard *blackboard,
70  ThreadCollector *collector,
71  Configuration *config,
72  Logger *logger,
73  Clock *clock,
74  FawkesNetworkHub *fnethub,
75  MainLoopEmployer *mloop_employer,
76  LoggerEmployer *logger_employer,
77  BlockedTimingExecutor *btexec,
78  NetworkNameResolver *nnresolver,
79  ServicePublisher *service_publisher,
80  ServiceBrowser *service_browser,
81  PluginManager *pmanager);
82 
83  private:
84  std::map<std::string, AspectIniFin *> __inifins;
85  std::map<std::string, AspectIniFin *> __default_inifins;
86  std::map<std::string, std::list<Thread *> > __threads;
87 };
88 
89 
90 } // end namespace fawkes
91 
92 #endif
Service browser.
Service publisher interface.
virtual void init(Thread *thread)
This method is called by the ThreadManager for each newly added Thread.
Definition: manager.cpp:118
Fawkes library namespace.
This is supposed to be the central clock in Fawkes.
Definition: clock.h:34
Logger employer The LoggerEmployer shall pipe all log messages of the system to added loggers...
Thread collector.
virtual ~AspectManager()
Constructor.
Definition: manager.cpp:65
Thread class encapsulation of pthreads.
Definition: thread.h:42
void register_inifin(AspectIniFin *inifin)
Register initializer/finalizer.
Definition: manager.cpp:78
Fawkes Plugin Manager.
Definition: manager.h:53
void unregister_inifin(AspectIniFin *inifin)
Unregister initializer/finalizer.
Definition: manager.cpp:91
Fawkes Network Hub.
Definition: hub.h:33
Thread initializer interface.
Blocked timing executor.
Definition: executor.h:35
Aspect and aspect initializer/finalizer manager.
Definition: manager.h:55
virtual bool prepare_finalize(Thread *thread)
Prepare finalization of a thread.
Definition: manager.cpp:185
bool has_threads_for_aspect(const char *aspect_name)
Check if threads for a particular aspect still exist.
Definition: manager.cpp:111
Main loop employer The MainLoopEmployer calls the main loop for execution.
Definition: employer.h:31
Network name and address resolver.
Definition: resolver.h:48
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)
Register default aspect initializer/finalizer.
Definition: manager.cpp:225
The BlackBoard abstract class.
Definition: blackboard.h:49
virtual void finalize(Thread *thread)
Finalize a thread.
Definition: manager.cpp:159
Interface for configuration handling.
Definition: config.h:63
Aspect initializer/finalizer base class.
Definition: inifin.h:36
Thread finalizer interface.
Interface for logging.
Definition: logger.h:34