![]() |
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. 16, 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 CONSTANZE_GENERATOR_HPP 00029 #define CONSTANZE_GENERATOR_HPP 00030 00031 #include <WNS/events/CanTimeout.hpp> 00032 #include <WNS/pyconfig/View.hpp> 00033 #include <WNS/StaticFactory.hpp> 00034 #include <WNS/logger/Logger.hpp> 00035 #include <WNS/distribution/Distribution.hpp> 00036 #include <WNS/osi/PDU.hpp> 00037 00038 namespace constanze 00039 { 00040 class Binding; 00041 class StartTrigger; 00042 class StopTrigger; 00043 00049 class GeneratorBase 00050 { 00051 public: 00052 typedef wns::PyConfigViewCreator<GeneratorBase, GeneratorBase> Creator; 00053 typedef wns::StaticFactory<Creator> Factory; 00054 00055 explicit GeneratorBase(const wns::pyconfig::View& _pyco); 00056 virtual ~GeneratorBase(); 00057 00063 void registerBinding(constanze::Binding* _bind); 00064 00070 void bindingReady(); 00071 00076 void bindingReleased(); 00077 00081 virtual void start() = 0; // to be overloaded by derived classes 00085 virtual void stop() = 0; // to be overloaded by derived classes 00086 00090 virtual void sendData(const wns::osi::PDUPtr& pdu); 00091 00095 virtual void countPackets(const int packetSizeBits); 00096 00097 virtual unsigned long int countedPackets() const {return packetCounter;} 00098 virtual unsigned long int countedBits() const {return bitCounter;} 00099 00100 protected: 00101 00105 wns::pyconfig::View pyco; 00106 00110 wns::logger::Logger log; 00111 00116 constanze::Binding* binding; 00117 00118 private: 00122 constanze::StartTrigger* startTrigger; 00126 constanze::StopTrigger* stopTrigger; 00127 00129 unsigned long int packetCounter; 00131 unsigned long int bitCounter; 00132 }; 00133 00134 00138 class StartTrigger: 00139 protected wns::events::CanTimeout 00140 { 00141 public: 00142 StartTrigger( 00143 constanze::Binding* _binding, 00144 constanze::GeneratorBase* _generator, 00145 double _startTime); 00146 00147 virtual ~StartTrigger() 00148 {} 00149 00150 void bindingReady(); 00151 00152 protected: 00156 virtual void onTimeout(); 00157 00158 constanze::Binding* binding; 00159 00160 constanze::GeneratorBase* generator; 00161 00162 }; // StartTrigger 00163 00167 class StopTrigger: 00168 protected wns::events::CanTimeout 00169 { 00170 public: 00171 StopTrigger( 00172 constanze::Binding* _binding, 00173 constanze::GeneratorBase* _generator, 00174 double _stopTime); 00175 00176 virtual ~StopTrigger() 00177 {} 00178 00179 void bindingReady(); 00180 00181 protected: 00185 virtual void onTimeout(); 00186 00187 constanze::Binding* binding; 00188 00189 constanze::GeneratorBase* generator; 00190 }; // StopTrigger 00191 } // constanze 00192 00193 #endif // NOT defined CONSTANZE_GENERATOR_HPP 00194 00195 /* 00196 Local Variables: 00197 mode: c++ 00198 fill-column: 80 00199 c-basic-offset: 8 00200 c-comment-only-line-offset: 0 00201 c-tab-always-indent: t 00202 indent-tabs-mode: t 00203 tab-width: 8 00204 End: 00205 */
1.5.5