![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WIFIMAC * 00003 * __________________________________________________________________________ * 00004 * * 00005 * Copyright (C) 1999-2007 * 00006 * Chair of Communication Networks (ComNets) * 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany * 00008 * phone: ++49-241-80-27910 (phone), fax: ++49-241-80-22242 * 00009 * email: wns@comnets.rwth-aachen.de * 00010 * www: http://rise.comnets.rwth-aachen.de * 00011 ******************************************************************************/ 00012 00013 #ifndef WIFIMAC_CONVERGENCE_ITXSTARTEND_HPP 00014 #define WIFIMAC_CONVERGENCE_ITXSTARTEND_HPP 00015 00016 #include <WNS/Subject.hpp> 00017 #include <WNS/ldk/Compound.hpp> 00018 00019 namespace wifimac { namespace convergence { 00020 00021 enum TxStartEndState { 00022 start, 00023 end 00024 }; 00025 00032 class ITxStartEnd 00033 { 00034 public: 00035 virtual ~ITxStartEnd() 00036 {} 00037 00039 virtual void onTxStart(const wns::ldk::CompoundPtr& compound) = 0; 00041 virtual void onTxEnd(const wns::ldk::CompoundPtr& compound) = 0; 00042 }; 00043 00044 class TxStartEndNotification : 00045 virtual public wns::Subject<ITxStartEnd> 00046 { 00047 public: 00048 00049 struct OnTxStartEnd 00050 { 00051 OnTxStartEnd(const wns::ldk::CompoundPtr& _compound, const TxStartEndState _state): 00052 compound(_compound), 00053 state(_state) 00054 {} 00055 00056 void operator()(ITxStartEnd* tx) 00057 { 00058 assure(compound, "compound is NULL"); 00059 00060 if(state == start) 00061 { 00062 // The functor calls the txStartIndication implemented by the 00063 // Observer 00064 tx->onTxStart(compound); 00065 } 00066 else 00067 { 00068 // The functor calls the txEndIndication implemented by the 00069 // Observer 00070 tx->onTxEnd(compound); 00071 } 00072 } 00073 private: 00074 wns::ldk::CompoundPtr compound; 00075 TxStartEndState state; 00076 }; 00077 }; 00078 } 00079 } 00080 00081 #endif // not defined WIFIMAC_SCHEDULER_TXSTARTENDINTERFACE_HPP
1.5.5