![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * Glue * 00003 * __________________________________________________________________________ * 00004 * * 00005 * Copyright (C) 2005-2006 * 00006 * Lehrstuhl fuer Kommunikationsnetze (ComNets) * 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany * 00008 * phone: ++49-241-80-27910 (phone), fax: ++49-241-80-22242 * 00009 * email: wns@comnets.rwth-aachen.de * 00010 * www: http://wns.comnets.rwth-aachen.de * 00011 ******************************************************************************/ 00012 00013 #ifndef GLUE_PILOT_HPP 00014 #define GLUE_PILOT_HPP 00015 00016 #include <WNS/ldk/FunctionalUnit.hpp> 00017 #include <WNS/ldk/CommandTypeSpecifier.hpp> 00018 #include <WNS/ldk/Command.hpp> 00019 #include <WNS/ldk/HasReceptor.hpp> 00020 #include <WNS/ldk/HasConnector.hpp> 00021 #include <WNS/ldk/HasDeliverer.hpp> 00022 #include <WNS/logger/Logger.hpp> 00023 #include <WNS/Cloneable.hpp> 00024 #include <WNS/events/PeriodicTimeout.hpp> 00025 00026 #include <list> 00027 00028 namespace glue { 00029 00030 class Pilot : 00031 public wns::ldk::FunctionalUnit, 00032 public wns::ldk::CommandTypeSpecifier<wns::ldk::EmptyCommand>, 00033 public wns::ldk::HasReceptor<>, 00034 public wns::ldk::HasConnector<>, 00035 public wns::ldk::HasDeliverer<>, 00036 public wns::Cloneable<Pilot>, 00037 private wns::events::PeriodicTimeout 00038 { 00039 public: 00040 00041 class Observer 00042 { 00043 public: 00044 struct Information 00045 { 00046 }; 00047 00048 virtual ~Observer() {}; 00049 00050 virtual void 00051 receivedBeacon(const Information& info) = 0; 00052 }; 00053 00054 Pilot(wns::ldk::fun::FUN* fun, wns::pyconfig::View& config); 00055 00056 virtual ~Pilot(); 00057 00058 void 00059 enable(); 00060 00061 void 00062 disable(); 00063 00064 void 00065 attach(Observer* observer); 00066 00067 void 00068 detach(Observer* observer); 00069 00070 void 00071 sendBeacon(); 00072 00073 private: 00074 // FunctionalUnit / CompoundHandlerInterface 00075 virtual bool 00076 doIsAccepting(const wns::ldk::CompoundPtr& compound) const; 00077 00078 virtual void 00079 doSendData(const wns::ldk::CompoundPtr& compound); 00080 00081 virtual void 00082 doWakeup(); 00083 00084 virtual void 00085 doOnData(const wns::ldk::CompoundPtr& compound); 00086 00087 // PeriodicTimeout 00088 virtual void 00089 periodically(); 00090 00091 // Own functions 00092 Observer::Information 00093 createObserverInformation(const wns::ldk::CompoundPtr& compound); 00094 00095 void 00096 notifyObservers(const Observer::Information& info); 00097 00098 typedef std::list<Observer*> ObserverList; 00099 00100 bool enabled; 00101 double timeout; 00102 ObserverList observers; 00103 bool delayedSend; 00104 wns::logger::Logger logger; 00105 }; 00106 00107 } 00108 00109 #endif // GLUE_PILOT_HPP
1.5.5