![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiMeMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2011 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 5, D-52074 Aachen, Germany 00009 * phone: ++49-241-80-27910, 00010 * fax: ++49-241-80-22242 00011 * email: info@openwns.org 00012 * www: http://www.openwns.org 00013 * _____________________________________________________________________________ 00014 * 00015 * openWNS is free software; you can redistribute it and/or modify it under the 00016 * terms of the GNU Lesser General Public License version 2 as published by the 00017 * Free Software Foundation; 00018 * 00019 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00020 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00021 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00022 * details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00026 * 00027 ******************************************************************************/ 00028 00029 #ifndef WIMEMAC_CONVERGENCE_IRXSTARTEND_HPP 00030 #define WIMEMAC_CONVERGENCE_IRXSTARTEND_HPP 00031 00032 #include <WNS/Subject.hpp> 00033 #include <WNS/simulator/Time.hpp> 00034 00035 namespace wimemac { namespace convergence { 00036 00037 class IRxStartEnd 00038 { 00039 public: 00040 virtual ~IRxStartEnd() 00041 {} 00042 00043 virtual void onRxStart(const wns::simulator::Time expRxDuration) = 0; 00044 virtual void onRxEnd() = 0; 00045 virtual void onRxError() = 0; 00046 }; 00047 00051 class RxStartEndNotification : 00052 virtual public wns::Subject<IRxStartEnd> 00053 { 00054 public: 00055 // @brief functor for IRxStartEnd::rxStartIndicationon calls 00056 struct OnRxStartEnd 00057 { 00058 OnRxStartEnd(const wns::simulator::Time _expRxDuration, const bool _isStart, const bool _rxError): 00059 expRxDuration(_expRxDuration), 00060 isStart(_isStart), 00061 rxError(_rxError) 00062 {} 00063 00064 void operator()(IRxStartEnd* rx) 00065 { 00066 if(isStart) 00067 { 00068 rx->onRxStart(expRxDuration); 00069 } 00070 else 00071 { 00072 if(rxError) 00073 { 00074 rx->onRxError(); 00075 } 00076 else 00077 { 00078 rx->onRxEnd(); 00079 } 00080 } 00081 } 00082 private: 00083 wns::simulator::Time expRxDuration; 00084 bool isStart; 00085 bool rxError; 00086 }; 00087 }; 00088 } 00089 } 00090 00091 #endif // not defined WIMEMAC_CONVERGENCE_IRXSTARTEND_HPP
1.5.5