User Manual, Developers Guide and API Documentation

CanTimeout.hpp

Go to the documentation of this file.
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_EVENTS_CANTIMEOUT_HPP
00029 #define WNS_EVENTS_CANTIMEOUT_HPP
00030 
00031 #include <WNS/events/scheduler/IEvent.hpp>
00032 
00033 
00034 namespace wns { namespace events {
00035 
00036     namespace scheduler {
00037         class Interface;
00038     }
00039 
00046     class CanTimeout
00047     {
00051         class TimeoutEvent
00052         {
00053         public:
00057             explicit
00058             TimeoutEvent(CanTimeout* _target);
00059 
00063             virtual
00064             ~TimeoutEvent();
00065 
00069             virtual void
00070             operator()();
00071 
00072             virtual void
00073             print(std::ostream& aStreamRef = std::cout) const;
00074 
00075         private:
00079             CanTimeout* target;
00080         };
00081 
00082     public:
00086         CanTimeout();
00087 
00091         virtual
00092         ~CanTimeout();
00093 
00097         //{@
00108         void
00109         setTimeout(double delay);
00110 
00123         void
00124         setNewTimeout(double delay);
00125 
00129         bool
00130         hasTimeoutSet() const;
00131 
00138         void
00139         cancelTimeout();
00141 
00148         virtual void
00149         onTimeout() = 0;
00150 
00151     private:
00157         scheduler::IEventPtr event;
00158 
00162         wns::events::scheduler::Interface* scheduler;
00163     }; // CanTimeout
00164 
00165 } // events
00166 } // wns
00167 
00168 #endif // NOT defined WNS_EVENTS_CANTIMEOUT_HPP
00169 
00170 /*
00171   Local Variables:
00172   mode: c++
00173   fill-column: 80
00174   c-basic-offset: 8
00175   c-comment-only-line-offset: 0
00176   c-tab-always-indent: t
00177   indent-tabs-mode: t
00178   tab-width: 8
00179   End:
00180 */

Generated on Tue May 22 03:31:34 2012 for openWNS by  doxygen 1.5.5