![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /****************************************************************************** 00002 * WiFiMac * 00003 * This file is part of openWNS (open Wireless Network Simulator) 00004 * _____________________________________________________________________________ 00005 * 00006 * Copyright (C) 2004-2007 00007 * Chair of Communication Networks (ComNets) 00008 * Kopernikusstr. 16, 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 WIFIMAC_CONVERGENCE_INETWORKALLOCATIONVECTOR_HPP 00030 #define WIFIMAC_CONVERGENCE_INETWORKALLOCATIONVECTOR_HPP 00031 00032 #include <WNS/Subject.hpp> 00033 #include <WNS/service/dll/Address.hpp> 00034 00035 namespace wifimac { namespace convergence { 00036 00049 class INetworkAllocationVector 00050 { 00051 public: 00052 virtual ~INetworkAllocationVector(){}; 00053 00054 /*** @brief called by ChannelState, implemented by observers on NAV ***/ 00055 virtual void onNAVBusy(const wns::service::dll::UnicastAddress setter) = 0; 00056 virtual void onNAVIdle() = 0; 00057 }; 00058 00059 class NAVNotification : 00060 virtual public wns::Subject<INetworkAllocationVector> 00061 { 00062 public: 00063 // @brief functor for INetworkAllocationVector::onChangedNAV calls 00064 struct OnChangedNAV 00065 { 00066 OnChangedNAV(const bool _newNAV, const wns::service::dll::UnicastAddress _setter): 00067 newNAV(_newNAV), 00068 setter(_setter) 00069 {} 00070 00071 void operator()(INetworkAllocationVector* nav) 00072 { 00073 // The functor calls the onChannelBusy/onChannelIdle implemented by the 00074 // Observer 00075 if (newNAV) 00076 nav->onNAVBusy(setter); 00077 else 00078 nav->onNAVIdle(); 00079 } 00080 private: 00081 bool newNAV; 00082 wns::service::dll::UnicastAddress setter; 00083 }; 00084 00085 }; 00086 00087 00088 } 00089 } 00090 00091 #endif // not defined WIFIMAC_CONVERGENCE_INETWORKALLOCATIONVECTOR_HPP
1.5.5