![]() |
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_ITXSTARTEND_HPP 00030 #define WIMEMAC_CONVERGENCE_ITXSTARTEND_HPP 00031 00032 #include <WNS/Subject.hpp> 00033 #include <WNS/ldk/Compound.hpp> 00034 00035 namespace wimemac { namespace convergence { 00036 00037 enum TxStartEndState { 00038 start, 00039 end 00040 }; 00041 00048 class ITxStartEnd 00049 { 00050 public: 00051 virtual ~ITxStartEnd() 00052 {} 00053 00055 virtual void onTxStart(const wns::ldk::CompoundPtr& compound) = 0; 00057 virtual void onTxEnd(const wns::ldk::CompoundPtr& compound) = 0; 00058 }; 00059 00060 class TxStartEndNotification : 00061 virtual public wns::Subject<ITxStartEnd> 00062 { 00063 public: 00064 00065 struct OnTxStartEnd 00066 { 00067 OnTxStartEnd(const wns::ldk::CompoundPtr& _compound, const TxStartEndState _state): 00068 compound(_compound), 00069 state(_state) 00070 {} 00071 00072 void operator()(ITxStartEnd* tx) 00073 { 00074 assure(compound, "compound is NULL"); 00075 00076 if(state == start) 00077 { 00078 // The functor calls the txStartIndication implemented by the 00079 // Observer 00080 tx->onTxStart(compound); 00081 } 00082 else 00083 { 00084 // The functor calls the txEndIndication implemented by the 00085 // Observer 00086 tx->onTxEnd(compound); 00087 } 00088 } 00089 private: 00090 wns::ldk::CompoundPtr compound; 00091 TxStartEndState state; 00092 }; 00093 }; 00094 } 00095 } 00096 00097 #endif // not defined WIMEMAC_SCHEDULER_TXSTARTENDINTERFACE_HPP
1.5.5