User Manual, Developers Guide and API Documentation

CompoundSize.hpp

Go to the documentation of this file.
00001 /******************************************************************************
00002  * WiFiMAC (IEEE 802.11)                                                      *
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_HELPER_CONTEXTPROVIDER_COMPOUNDSIZE_HPP
00030 #define WIFIMAC_HELPER_CONTEXTPROVIDER_COMPOUNDSIZE_HPP
00031 
00032 #include <WNS/probe/bus/CompoundContextProvider.hpp>
00033 #include <WNS/ldk/CommandReaderInterface.hpp>
00034 #include <WNS/ldk/fun/FUN.hpp>
00035 
00036 namespace wifimac { namespace helper { namespace contextprovider {
00037 
00038     class CompoundSize:
00039         virtual public wns::probe::bus::CompoundContextProvider
00040     {
00041     public:
00042         CompoundSize(std::string specificKey) :
00043             key(specificKey)
00044             {};
00045         ~CompoundSize() {};
00046 
00047         virtual const std::string&
00048         getKey() const
00049             {
00050                 return this->key;
00051             }
00052     protected:
00053         const std::string key;
00054     private:
00055         virtual void 
00056         doVisit(wns::probe::bus::IContext& c, const wns::ldk::CompoundPtr& compound) const = 0;
00057     };
00058 
00059     class CompleteLengthInBits:
00060         virtual public CompoundSize
00061     {
00062     public:
00063         CompleteLengthInBits():
00064             CompoundSize("MAC.CompleteLengthInBits")
00065             {};
00066 
00067         virtual
00068         ~CompleteLengthInBits() {};
00069 
00070     private:
00071         void
00072         doVisit(wns::probe::bus::IContext& c, const wns::ldk::CompoundPtr& compound) const
00073             {
00074                 Bit commandPoolSize;
00075                 Bit dataSize;
00076                 compound->getCommandPool()->calculateSizes(commandPoolSize, dataSize);
00077                 c.insertInt(this->key, commandPoolSize + dataSize);
00078             };
00079     };
00080 
00081     class CommandPoolLengthInBits:
00082         virtual public CompoundSize
00083     {
00084     public:
00085         CommandPoolLengthInBits():
00086             CompoundSize("MAC.CommandPoolLengthInBits")
00087             {};
00088 
00089         virtual
00090         ~CommandPoolLengthInBits() {};
00091 
00092     private:
00093         void
00094         doVisit(wns::probe::bus::IContext& c, const wns::ldk::CompoundPtr& compound) const
00095             {
00096                 Bit commandPoolSize;
00097                 Bit dataSize;
00098                 compound->getCommandPool()->calculateSizes(commandPoolSize, dataSize);
00099                 c.insertInt(this->key, commandPoolSize);
00100             };
00101     };
00102 
00103     class DataLengthInBits:
00104         virtual public CompoundSize
00105     {
00106     public:
00107         DataLengthInBits():
00108             CompoundSize("MAC.DataLengthInBits")
00109             {};
00110 
00111         virtual
00112         ~DataLengthInBits() {};
00113 
00114     private:
00115         void
00116         doVisit(wns::probe::bus::IContext& c, const wns::ldk::CompoundPtr& compound) const
00117             {
00118                 Bit commandPoolSize;
00119                 Bit dataSize;
00120                 compound->getCommandPool()->calculateSizes(commandPoolSize, dataSize);
00121                 c.insertInt(this->key, dataSize);
00122             };
00123     };
00124 
00125 }}}
00126 
00127 #endif //WIFIMAC_HELPER_CONTEXTPROVIDER_COMPOUNDSIZE_HPP

Generated on Tue May 22 03:32:04 2012 for openWNS by  doxygen 1.5.5