User Manual, Developers Guide and API Documentation

StationManager.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * DLLBase (DLL Base classes to create FUN-based DLL)                         *
00003  * __________________________________________________________________________ *
00004  *                                                                            *
00005  * Copyright (C) 2006                                                         *
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://wns.comnets.rwth-aachen.de                                     *
00011  ******************************************************************************/
00012 
00013 #ifndef DLL_STATIONMANAGER_HPP
00014 #define DLL_STATIONMANAGER_HPP
00015 
00016 #include <WNS/logger/Logger.hpp>
00017 #include <WNS/pyconfig/View.hpp>
00018 #include <WNS/Singleton.hpp>
00019 #include <WNS/container/Registry.hpp>
00020 
00021 #include <DLL/Layer2.hpp>
00022 
00023 #include <cstdlib>
00024 #include <vector>
00025 
00026 namespace wns { namespace node {
00027     class Node;
00028 }}
00029 
00030 namespace dll {
00031 //  class RANG;
00032 
00033     typedef std::list<wns::node::Interface*> NodeList;
00034     typedef std::list<wns::service::dll::UnicastAddress> MACList;
00035 
00036     inline std::string
00037     printNodeList(const dll::NodeList& list) {
00038         std::stringstream s;
00039         s << "(";
00040         for (dll::NodeList::const_iterator iter = list.begin();
00041              iter != list.end(); ++iter)
00042         {
00043           s << (*iter)->getName() << ",";
00044         }
00045         s << ")";
00046         return s.str();
00047     }
00048 
00059     class StationManager
00060     {
00061         typedef wns::container::Registry<ILayer2::StationIDType, ILayer2*> LayerLookup;
00062         typedef wns::container::Registry<wns::node::Interface*, ILayer2*> NodeLookup;
00063         typedef wns::container::Registry<wns::service::dll::UnicastAddress, ILayer2*> MACAdrLookup;
00064 
00065     public:
00067         StationManager();
00069         virtual ~StationManager();
00070 
00072         void registerStation(ILayer2::StationIDType id, wns::service::dll::UnicastAddress adr, ILayer2* layer);
00073 
00076         ILayer2* getStationByMAC(wns::service::dll::UnicastAddress mac) const;
00077         ILayer2* getStationByID(ILayer2::StationIDType) const;
00078         ILayer2* getStationByNode(wns::node::Interface*) const;
00079         wns::node::Interface* getNodeByID(ILayer2::StationIDType) const;
00080         NodeList getNodeList() const;
00082 
00083     private:
00084         MACAdrLookup macAdrLookup;
00085         LayerLookup layerLookup;
00086         NodeLookup nodeLookup;
00087     };
00088 
00089     typedef wns::SingletonHolder<StationManager> TheStationManager;
00090 }
00091 
00092 
00093 #endif // NOT defined DLL_STATIONMANAGER_HPP
00094 
00095 

Generated on Sat Feb 11 03:31:32 2012 for openWNS by  doxygen 1.5.5