![]() |
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 WNS_PERIODICTIMEOUT_HPP 00029 #define WNS_PERIODICTIMEOUT_HPP 00030 00031 #include <WNS/Assure.hpp> 00032 #include <WNS/simulator/Time.hpp> 00033 #include <WNS/events/scheduler/IEvent.hpp> 00034 00035 namespace wns { namespace events { 00036 00044 class PeriodicTimeout 00045 { 00046 class PeriodicTimeoutFunctor 00047 { 00048 public: 00049 PeriodicTimeoutFunctor(PeriodicTimeout* _dest, wns::simulator::Time _period); 00050 00051 virtual void 00052 operator()(); 00053 00054 virtual wns::simulator::Time 00055 getPeriod() const; 00056 00057 virtual void 00058 print(std::ostream& aStreamRef = std::cout) const; 00059 00060 virtual ~PeriodicTimeoutFunctor(){} 00061 00062 PeriodicTimeoutFunctor(const PeriodicTimeoutFunctor& other): 00063 period_(other.period_), 00064 dest_(other.dest_) 00065 {} 00066 private: 00067 wns::simulator::Time period_; 00068 PeriodicTimeout* dest_; 00069 00070 friend class PeriodicTimeout; 00071 }; 00072 00073 public: 00077 explicit 00078 PeriodicTimeout(); 00079 00083 virtual 00084 ~PeriodicTimeout(); 00085 00089 PeriodicTimeout(const PeriodicTimeout& other); 00090 00102 void 00103 startPeriodicTimeout(wns::simulator::Time _period, wns::simulator::Time delay = 0.0); 00104 00109 bool 00110 hasPeriodicTimeoutSet() const; 00111 00118 void 00119 cancelPeriodicTimeout(); 00120 00127 virtual void 00128 periodically() = 0; 00129 00130 private: 00131 wns::simulator::Time period_; 00132 scheduler::IEventPtr periodicEv_; 00133 00134 const PeriodicTimeout& operator=(const PeriodicTimeout& other); 00135 }; // PeriodicTimeout 00136 00137 } // events 00138 } // wns 00139 #endif // NOT defined WNS_PERIODICTIMEOUT_HPP 00140 00141
1.5.5