User Manual, Developers Guide and API Documentation

ILinkNotification.hpp

Go to the documentation of this file.
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_MANAGEMENT_ILINKNOTIFICATION_HPP
00030 #define WIFIMAC_MANAGEMENT_ILINKNOTIFICATION_HPP
00031 
00032 #include <WNS/Subject.hpp>
00033 #include <WNS/service/dll/Address.hpp>
00034 
00035 namespace wifimac { namespace management {
00036 
00040     class ILinkNotification
00041     {
00042     public:
00043         virtual ~ILinkNotification() {};
00044         virtual void onLinkIndication(const wns::service::dll::UnicastAddress myself,
00045                           const wns::service::dll::UnicastAddress peer) = 0;
00046     };
00047 
00052     class LinkNotificator :
00053         virtual public wns::Subject<ILinkNotification>
00054     {
00055     public:
00056     // @brief functor for ILinkNotification::onLinkIndication calls
00057         struct OnLinkIndication
00058         {
00059             OnLinkIndication(const wns::service::dll::UnicastAddress _myself,
00060                              const wns::service::dll::UnicastAddress _peer):
00061                 myself(_myself),
00062                 peer(_peer)
00063                 {}
00064 
00065                 void operator()(ILinkNotification* lni)
00066                 {
00067                     // The functor calls the onLinkIndication implemented by the
00068                     // Observer
00069                     lni->onLinkIndication(myself, peer);
00070                 }
00071             private:
00072                 wns::service::dll::UnicastAddress myself;
00073                 wns::service::dll::UnicastAddress peer;
00074             };
00075     };
00076 }}
00077 
00078 #endif

Generated on Thu May 24 03:32:10 2012 for openWNS by  doxygen 1.5.5