User Manual, Developers Guide and API Documentation

EventList.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. 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 RISE_SCENARIO_MOBILITY_EVENTLIST_HPP
00029 #define RISE_SCENARIO_MOBILITY_EVENTLIST_HPP
00030 
00031 #include <RISE/scenario/mobility/Mobility.hpp>
00032 
00033 namespace rise { namespace scenario { namespace mobility {
00034 
00035     class EventList :
00036         public Mobility
00037     {
00038     public:
00042         explicit
00043         EventList(const wns::pyconfig::View& mobilityView);
00044 
00048         virtual
00049         ~EventList();
00050 
00054         virtual void
00055         move();
00056 
00060         virtual void
00061         moveTo(const wns::Position& pos);
00062 
00066         virtual void
00067         moveTo(const wns::PositionOffset& pos);
00068 
00072         virtual void
00073         periodically();
00074 
00078         void
00079         addEvent(const wns::pyconfig::View& eventView);
00080 
00081         template <typename POSITIONTYPE>
00082         class PositionUpdateEvent
00083         {
00084         public:
00085             PositionUpdateEvent(MobilityInterface* m, const POSITIONTYPE& p) :
00086                 station(m),
00087                 newPosition(p)
00088             {}
00089 
00090             void
00091             operator()()
00092             {
00093                 station->moveTo(newPosition);
00094             }
00095 
00096         private:
00097             MobilityInterface* station;
00098             POSITIONTYPE newPosition;
00099         };
00100         typedef PositionUpdateEvent<wns::PositionOffset> RelativePositionUpdateEvent;
00101         typedef PositionUpdateEvent<wns::Position> AbsolutePositionUpdateEvent;
00102 
00103     }; // EventList
00104 
00105 } // mobility
00106 } // scenario
00107 } // rise
00108 
00109 #endif // RISE_SCENARIO_MOBILITY_EVENTLIST_HPP
00110 
00111 

Generated on Wed May 23 03:31:53 2012 for openWNS by  doxygen 1.5.5