![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 5, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #ifndef WNS_LDK_PROBE_TICKTACK_HPP 00029 #define WNS_LDK_PROBE_TICKTACK_HPP 00030 00031 #include <WNS/ldk/fu/Plain.hpp> 00032 #include <WNS/probe/bus/ContextCollector.hpp> 00033 #include <WNS/pyconfig/View.hpp> 00034 #include <WNS/logger/Logger.hpp> 00035 #include <WNS/simulator/ISimulator.hpp> 00036 00037 #include <WNS/probe/bus/ContextCollector.hpp> 00038 00039 namespace wns { namespace ldk { namespace probe { 00040 00041 class TickTackCommand : 00042 public Command 00043 { 00044 public: 00045 TickTackCommand() 00046 { 00047 magic.tickTime = wns::simulator::getEventScheduler()->getTime(); 00048 magic.probed = false; 00049 } 00050 00051 struct {} local; 00052 struct {} peer; 00053 struct { 00054 wns::simulator::Time tickTime; 00055 bool probed; 00056 } magic; 00057 00058 }; 00059 00060 00065 class Tick : 00066 public fu::Plain<Tick, TickTackCommand> 00067 { 00068 public: 00069 // FUNConfigCreator interface realisation 00070 Tick(fun::FUN* fuNet, const wns::pyconfig::View& config); 00071 ~Tick(); 00072 00073 virtual 00074 void onFUNCreated(); 00075 00076 virtual void 00077 probeOutgoing(); 00078 00079 virtual void 00080 probeIncoming(); 00081 00082 private: 00083 virtual void 00084 doSendData(const CompoundPtr& compound); 00085 00086 virtual void 00087 doOnData(const CompoundPtr& compound); 00088 00089 virtual bool 00090 doIsAccepting(const CompoundPtr& compound) const 00091 { 00092 return getConnector()->hasAcceptor(compound); 00093 } 00094 00095 virtual void 00096 doWakeup() 00097 { 00098 getReceptor()->wakeup(); 00099 } 00100 00101 void 00102 writeCommand(const CompoundPtr& compound); 00103 00104 std::string probeName_; 00105 bool probeOutgoing_; 00106 wns::probe::bus::ContextCollectorPtr outSizeProbe_; 00107 wns::logger::Logger logger_; 00108 00109 }; 00110 00115 class Tack : 00116 public fu::Plain<Tack> 00117 { 00118 public: 00119 // FUNConfigCreator interface realisation 00120 Tack(fun::FUN* fuNet, const wns::pyconfig::View& config); 00121 ~Tack(); 00122 00123 virtual void 00124 onFUNCreated(); 00125 00126 virtual void 00127 probeOutgoing(); 00128 00129 virtual void 00130 probeIncoming(); 00131 00132 private: 00133 virtual void 00134 doSendData(const CompoundPtr& compound); 00135 00136 virtual void 00137 doOnData(const CompoundPtr& compound); 00138 00139 virtual bool 00140 doIsAccepting(const CompoundPtr& compound) const 00141 { 00142 return getConnector()->hasAcceptor(compound); 00143 } 00144 00145 virtual void 00146 doWakeup() 00147 { 00148 getReceptor()->wakeup(); 00149 } 00150 00151 void 00152 probeIfNotProbed(const CompoundPtr& compound); 00153 00154 std::string probeName_; 00155 wns::ldk::CommandReaderInterface* commandReader_; 00156 wns::probe::bus::ContextCollectorPtr delayProbe_; 00157 wns::probe::bus::ContextCollectorPtr inSizeProbe_; 00158 bool probeOutgoing_; 00159 00160 fun::FUN* fun_; 00161 00162 wns::logger::Logger logger_; 00163 }; 00164 00165 } // probe 00166 } // ldk 00167 } // wns 00168 00169 #endif // NOT defined WNS_LDK_PROBE_TICKTACK_HPP 00170 00171
1.5.5