Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * inifin.h - Fawkes Aspect initializer/finalizer 00004 * 00005 * Created: Tue Jan 30 13:34:54 2007 00006 * Copyright 2006-2008 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_INIFIN_H_ 00025 #define __ASPECT_INIFIN_H_ 00026 00027 #include <core/threading/thread_initializer.h> 00028 #include <core/threading/thread_finalizer.h> 00029 #include <core/threading/thread_notification_listener.h> 00030 00031 #include <utils/constraints/dependency_onetomany.h> 00032 #include <utils/constraints/unique.h> 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 TimeSource; 00051 class LoggerEmployer; 00052 class BlockedTimingExecutor; 00053 class MainLoopEmployer; 00054 class MainLoopAspect; 00055 #ifdef HAVE_FIREVISION 00056 class VisionMasterAspect; 00057 class VisionAspect; 00058 #endif 00059 00060 class AspectIniFin 00061 : public ThreadInitializer, 00062 public ThreadFinalizer, 00063 public ThreadNotificationListener 00064 { 00065 public: 00066 AspectIniFin(BlackBoard *blackboard, ThreadCollector *collector, 00067 Configuration *config, Logger *logger, Clock *clock); 00068 virtual ~AspectIniFin(); 00069 00070 virtual void init(Thread *thread); 00071 virtual void finalize(Thread *thread); 00072 virtual bool prepare_finalize(Thread *thread); 00073 00074 void set_fnet_hub(FawkesNetworkHub *fnethub); 00075 void set_mainloop_employer(MainLoopEmployer *employer); 00076 void set_logger_employer(LoggerEmployer *employer); 00077 void set_blocked_timing_executor(BlockedTimingExecutor *btexec); 00078 void set_network_members(NetworkNameResolver *nnresolver, 00079 ServicePublisher *service_publisher, 00080 ServiceBrowser *service_browser); 00081 void set_plugin_manager(PluginManager *manager); 00082 00083 virtual bool thread_started(Thread *thread) throw(); 00084 virtual bool thread_init_failed(Thread *thread) throw(); 00085 00086 private: 00087 BlackBoard *__blackboard; 00088 ThreadCollector *__thread_collector; 00089 Configuration *__config; 00090 Logger *__logger; 00091 Clock *__clock; 00092 FawkesNetworkHub *__fnethub; 00093 NetworkNameResolver *__nnresolver; 00094 ServicePublisher *__service_publisher; 00095 ServiceBrowser *__service_browser; 00096 MainLoopEmployer *__mainloop_employer; 00097 BlockedTimingExecutor *__btexec; 00098 LoggerEmployer *__logger_employer; 00099 PluginManager *__plugin_manager; 00100 00101 #ifdef HAVE_FIREVISION 00102 OneToManyDependency<VisionMasterAspect, VisionAspect> __vision_dependency; 00103 #endif 00104 UniquenessConstraint<TimeSource> __timesource_uc; 00105 UniquenessConstraint<MainLoopAspect> __mainloop_uc; 00106 }; 00107 00108 } // end namespace fawkes 00109 00110 #endif