User Manual, Developers Guide and API Documentation

IRxStartEnd.hpp

Go to the documentation of this file.
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_IRXSTARTEND_HPP
00014 #define WIFIMAC_CONVERGENCE_IRXSTARTEND_HPP
00015 
00016 #include <WNS/Subject.hpp>
00017 #include <WNS/simulator/Time.hpp>
00018 
00019 namespace wifimac { namespace convergence {
00020 
00021         class IRxStartEnd
00022         {
00023         public:
00024             virtual ~IRxStartEnd()
00025                 {}
00026 
00027             virtual void onRxStart(const wns::simulator::Time expRxDuration) = 0;
00028             virtual void onRxEnd() = 0;
00029             virtual void onRxError() = 0;
00030         };
00031 
00035         class RxStartEndNotification :
00036         virtual public wns::Subject<IRxStartEnd>
00037         {
00038         public:
00039             // @brief functor for IRxStartEnd::rxStartIndicationon calls
00040             struct OnRxStartEnd
00041             {
00042                 OnRxStartEnd(const wns::simulator::Time _expRxDuration, const bool _isStart, const bool _rxError):
00043                     expRxDuration(_expRxDuration),
00044                     isStart(_isStart),
00045                     rxError(_rxError)
00046                     {}
00047 
00048                 void operator()(IRxStartEnd* rx)
00049                     {
00050                         if(isStart)
00051                         {
00052                             rx->onRxStart(expRxDuration);
00053                         }
00054                         else
00055                         {
00056                             if(rxError)
00057                             {
00058                                 rx->onRxError();
00059                             }
00060                             else
00061                             {
00062                                 rx->onRxEnd();
00063                             }
00064                         }
00065                     }
00066             private:
00067                 wns::simulator::Time expRxDuration;
00068                 bool isStart;
00069                 bool rxError;
00070             };
00071         };
00072     }
00073 }
00074 
00075 #endif // not defined WIFIMAC_CONVERGENCE_IRXSTARTEND_HPP

Generated on Sun May 27 03:32:06 2012 for openWNS by  doxygen 1.5.5