Fawkes API  Fawkes Development Version
manager.h
00001 
00002 /***************************************************************************
00003  *  manager.h - Fawkes Aspect Manager
00004  *
00005  *  Created: Thu Nov 25 00:27:42 2010 (based on inifin.h)
00006  *  Copyright  2006-2010  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __ASPECT_MANAGER_H_
00025 #define __ASPECT_MANAGER_H_
00026 
00027 #include <core/threading/thread_initializer.h>
00028 #include <core/threading/thread_finalizer.h>
00029 
00030 #include <map>
00031 #include <list>
00032 #include <string>
00033 
00034 namespace fawkes {
00035 #if 0 /* just to make Emacs auto-indent happy */
00036 }
00037 #endif
00038 
00039 class BlackBoard;
00040 class Configuration;
00041 class Logger;
00042 class Clock;
00043 class FawkesNetworkHub;
00044 class PluginManager;
00045 class Thread;
00046 class ThreadCollector;
00047 class NetworkNameResolver;
00048 class ServicePublisher;
00049 class ServiceBrowser;
00050 class LoggerEmployer;
00051 class BlockedTimingExecutor;
00052 class MainLoopEmployer;
00053 class AspectIniFin;
00054 
00055 class AspectManager : public ThreadInitializer, public ThreadFinalizer
00056 {
00057  public:
00058   virtual ~AspectManager();
00059 
00060   virtual void init(Thread *thread);
00061   virtual void finalize(Thread *thread);
00062   virtual bool prepare_finalize(Thread *thread);
00063 
00064   void register_inifin(AspectIniFin *inifin);
00065   void unregister_inifin(AspectIniFin *inifin);
00066 
00067   bool has_threads_for_aspect(const char *aspect_name);
00068 
00069   void register_default_inifins(BlackBoard *blackboard,
00070                                 ThreadCollector *collector,
00071                                 Configuration *config,
00072                                 Logger *logger,
00073                                 Clock *clock,
00074                                 FawkesNetworkHub *fnethub,
00075                                 MainLoopEmployer *mloop_employer,
00076                                 LoggerEmployer *logger_employer,
00077                                 BlockedTimingExecutor *btexec,
00078                                 NetworkNameResolver *nnresolver,
00079                                 ServicePublisher *service_publisher,
00080                                 ServiceBrowser *service_browser,
00081                                 PluginManager *pmanager);
00082 
00083  private:
00084   std::map<std::string, AspectIniFin *> __inifins;
00085   std::map<std::string, AspectIniFin *> __default_inifins;
00086   std::map<std::string, std::list<Thread *> > __threads;
00087 };
00088 
00089 
00090 } // end namespace fawkes
00091 
00092 #endif