User Manual, Developers Guide and API Documentation

CommandInformation.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiMeMac                                                                    *
00003  * This file is part of openWNS (open Wireless Network Simulator)
00004  * _____________________________________________________________________________
00005  *
00006  * Copyright (C) 2004-2011
00007  * Chair of Communication Networks (ComNets)
00008  * Kopernikusstr. 5, 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 WIMEMAC_HELPER_CONTEXTPROVIDER_COMMANDINFORMATION_HPP
00030 #define WIMEMAC_HELPER_CONTEXTPROVIDER_COMMANDINFORMATION_HPP
00031 
00032 // declaration of the commands which are read by the specific command readers
00033 //#include <WIMEMAC/pathselection/BeaconLinkQualityMeasurement.hpp>
00034 #include <DLL/UpperConvergence.hpp>
00035 #include <WIMEMAC/convergence/PhyMode.hpp>
00036 #include <WNS/service/dll/Address.hpp>
00037 
00038 #include <WNS/probe/bus/CommandContextProvider.hpp>
00039 
00040 namespace wimemac { namespace helper { namespace contextprovider {
00041 
00042 
00050     class IsUnicast:
00051         virtual public wns::probe::bus::CommandContextProvider<dll::UpperCommand>
00052     {
00053     public:
00054         IsUnicast(wns::ldk::fun::FUN* fun, std::string ucCommandName):
00055             wns::probe::bus::CommandContextProvider<dll::UpperCommand>(fun, ucCommandName, "MAC.CompoundIsUnicast")
00056             {};
00057     private:
00058         virtual void
00059         doVisitCommand(wns::probe::bus::IContext& c, const dll::UpperCommand* command) const
00060             {
00061                 if(command->peer.targetMACAddress.isValid())
00062                 {
00063                     c.insertInt(getKey(), 1);
00064                 }
00065                 else
00066                 {
00067                     c.insertInt(getKey(), 0);
00068                 }
00069             };
00070     };
00071 
00076     class SourceAddress:
00077         virtual public wns::probe::bus::CommandContextProvider<dll::UpperCommand>
00078     {
00079     public:
00080         SourceAddress(wns::ldk::fun::FUN* fun, std::string ucCommandName):
00081             wns::probe::bus::CommandContextProvider<dll::UpperCommand>(fun, ucCommandName, "MAC.CompoundSourceAddress")
00082             {};
00083 
00084     private:
00085         virtual void
00086         doVisitCommand(wns::probe::bus::IContext& c, const dll::UpperCommand* command) const
00087             {
00088                 if(command->peer.sourceMACAddress.isValid())
00089                 {
00090                     // if the command is activated, we add the tx address to the
00091                     // context
00092                     c.insertInt(this->key,
00093                                 command->peer.sourceMACAddress.getInteger());
00094                 }
00095             }
00096     };
00097 
00102     class TargetAddress:
00103         virtual public wns::probe::bus::CommandContextProvider<dll::UpperCommand>
00104     {
00105     public:
00106         TargetAddress(wns::ldk::fun::FUN* fun, std::string ucCommandName):
00107             wns::probe::bus::CommandContextProvider<dll::UpperCommand>(fun, ucCommandName, "MAC.CompoundTargetAddress")
00108             {};
00109 
00110     private:
00111         virtual void
00112         doVisitCommand(wns::probe::bus::IContext& c, const dll::UpperCommand* command) const
00113             {
00114                 if(command->peer.targetMACAddress.isValid())
00115                 {
00116                     // if the command is activated, we add the tx address to the
00117                     // context
00118                     c.insertInt(this->key,
00119                                 command->peer.targetMACAddress.getInteger());
00120                 }
00121             }
00122     };
00123 
00130     class DataBitsPerSymbol:
00131         virtual public wns::probe::bus::CommandContextProvider<wimemac::lowerMAC::ManagerCommand>
00132     {
00133     public:
00134         DataBitsPerSymbol(wns::ldk::fun::FUN* fun, std::string managerCommandName):
00135             wns::probe::bus::CommandContextProvider<wimemac::lowerMAC::ManagerCommand>(fun, managerCommandName, "MAC.CompoundDBPS")
00136             {};
00137 
00138     private:
00139         virtual void
00140         doVisitCommand(wns::probe::bus::IContext& c, const wimemac::lowerMAC::ManagerCommand* command) const
00141             {
00142                 wimemac::convergence::PhyMode phymode = command->getPhyMode();
00143                 c.insertInt(this->key, phymode.getDataRate());
00144             }
00145     };
00146 
00153     class SpatialStreams :
00154         virtual public wns::probe::bus::CommandContextProvider<wimemac::lowerMAC::ManagerCommand>
00155     {
00156     public:
00157         SpatialStreams(wns::ldk::fun::FUN* fun, std::string managerCommandName):
00158             wns::probe::bus::CommandContextProvider<wimemac::lowerMAC::ManagerCommand>(fun, managerCommandName, "MAC.CompoundSpatialStreams")
00159             {};
00160 
00161     private:
00162         virtual void
00163         doVisitCommand(wns::probe::bus::IContext& c, const wimemac::lowerMAC::ManagerCommand* command) const
00164             {
00165                 wimemac::convergence::PhyMode mcs = command->getPhyMode();
00166                 c.insertInt(this->key, mcs.getNumberOfSpatialStreams());
00167             }
00168     };
00169 }}}
00170 
00171 #endif //WIMEMAC_HELPER_CONTEXTPROVIDER_COMMANDINFORMATION_HPP

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