User Manual, Developers Guide and API Documentation

transmissionobject.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef _TRANSMISSIONOBJECT_HPP
00029 #define _TRANSMISSIONOBJECT_HPP
00030 
00031 #include <WNS/service/phy/phymode/PhyModeInterface.hpp>
00032 
00033 #include <WNS/PowerRatio.hpp>
00034 #include <WNS/container/FastListEnabler.hpp>
00035 #include <WNS/SmartPtr.hpp>
00036 #include <WNS/Assure.hpp>
00037 #include <WNS/Position.hpp>
00038 #include <WNS/osi/PDU.hpp>
00039 #include <WNS/Birthmark.hpp>
00040 
00041 
00042 namespace rise
00043 {
00044     namespace receiver {
00045         class ReceiverInterface;
00046     }
00047 
00048     class Transmitter;
00049 
00050     class TransmitterAspect
00051     {
00052     public:
00053         TransmitterAspect() :
00054             txPower(),
00055             numberOfSpatialStreams(1)
00056             {}
00057 
00058         virtual ~TransmitterAspect()
00059             {}
00060 
00061 
00066         virtual wns::Ratio
00067         getTransmittersAntennaGain(const wns::Position& receiverPosition) const = 0;
00068 
00069         virtual Transmitter*
00070         getTransmitter() const = 0;
00071 
00072         const wns::Power&
00073         getTxPower() const
00074             {
00075                 return this->txPower;
00076             }
00077 
00078         void
00079         setTxPower(wns::Power power)
00080             {
00081                 this->txPower=power;
00082             }
00083 
00087         const wns::service::phy::phymode::PhyModeInterface&
00088         getPhyMode() const
00089             {
00090                 return *(this->phyModePtr); // returns reference only
00091             }
00092 
00096         const wns::service::phy::phymode::PhyModeInterfacePtr
00097         getPhyModePtr() const
00098             {
00099                 return this->phyModePtr;
00100             }
00101 
00102         void
00103         setPhyModePtr(const wns::service::phy::phymode::PhyModeInterfacePtr _phyModePtr)
00104             {
00105                 this->phyModePtr=_phyModePtr; // SmartPtr
00106             }
00107 
00108         const int
00109         getNumberOfSpatialStreams() const
00110             {
00111                 return this->numberOfSpatialStreams;
00112             }
00113 
00114         void
00115         setNumberOfSpatialStreams(int _numSS)
00116             {
00117                 assure(_numSS > 0,
00118                        "Cannot have negative number of spatial streams");
00119                 this->numberOfSpatialStreams = _numSS;
00120             }
00121 
00122     private:
00126         wns::Power txPower;
00130         wns::service::phy::phymode::PhyModeInterfacePtr phyModePtr;
00131 
00135         int numberOfSpatialStreams;
00136     };
00137 
00138     class CastingAspect
00139     {
00140     public:
00145         virtual bool isForMe(const receiver::ReceiverInterface* aReceiver) const = 0;
00146         virtual ~CastingAspect() {}
00147     };
00148 
00149 
00150     namespace medium {
00151         class PhysicalResource;
00152     }
00153 
00154     class TransmissionInterface :
00155         virtual public wns::RefCountable,
00156         virtual public wns::HasBirthmark,
00157         virtual public TransmitterAspect,
00158         virtual public CastingAspect
00159     {
00164         friend class medium::PhysicalResource;
00165     public:
00166         TransmissionInterface();
00167 
00168         virtual ~TransmissionInterface();
00169 
00170         bool getIsStart() const
00171             {
00172                 return this->onAir;
00173             }
00174 
00175         void setIsStart(bool iS)
00176             {
00177                 this->onAir = iS;
00178             }
00179 
00180         medium::PhysicalResource* getPhysicalResource() const
00181             {
00182                 assure(this->pr != NULL, "Hasn't been set (set by PhysicalResource::startTransmission())");
00183                 return this->pr;
00184             }
00185 
00186     private:
00188         bool onAir;
00189 
00191         medium::PhysicalResource* pr;
00192 
00193         void setPhysicalResource(medium::PhysicalResource* _pr)
00194             {
00195                 assure(pr == NULL, "The TransmissionObject may only be transmitted on ONE physical resource");
00196                 this->pr = _pr;
00197             }
00198     };
00199 
00211     class TransmissionObject :
00212         virtual public TransmissionInterface,
00213         virtual public wns::container::SingleFastListEnabler<wns::SmartPtr<TransmissionObject> >
00214 
00215     {
00216     public:
00218         TransmissionObject(Transmitter* _transmitter,
00219                            const wns::Power& _txPower,
00220                            unsigned long int _linkMode = 0,
00221                            int numberOfSpatialStreams = 1);
00222 
00224         TransmissionObject(Transmitter* _transmitter,
00225                            wns::osi::PDUPtr _payload,
00226                            const wns::Power& _txPower,
00227                            unsigned long int _linkMode = 0,
00228                            int numberOfSpatialStreams = 1);
00229 
00232         TransmissionObject(Transmitter* _transmitter,
00233                            const wns::Power& _txPower,
00234                            const wns::service::phy::phymode::PhyModeInterfacePtr _phyModePtr,
00235                            unsigned long int _linkMode = 0);
00236 
00238         TransmissionObject(Transmitter* _transmitter,
00239                            wns::osi::PDUPtr _payload,
00240                            const wns::Power& _txPower,
00241                            const wns::service::phy::phymode::PhyModeInterfacePtr _phyModePtr,
00242                            unsigned long int _linkMode = 0);
00243 
00245         virtual ~TransmissionObject();
00246 
00248         unsigned long int getLinkMode() const
00249             {
00250                 return this->linkMode;
00251             }
00252 
00254         wns::osi::PDUPtr getPayload() const
00255             {
00256                 return this->payload;
00257             }
00258 
00259         virtual Transmitter* getTransmitter() const
00260             {
00261                 return this->transmitter;
00262             }
00263 
00264         std::string toString() const;
00265 
00266         enum linkmode
00267         {
00268             downlink   = 0,
00269             uplink,
00270             directlink
00271         };
00272         virtual wns::Ratio getTransmittersAntennaGain(const wns::Position& receiverPosition) const;
00273 
00274     private:
00275         Transmitter* transmitter;
00276 
00277         wns::osi::PDUPtr payload;
00278 
00283         unsigned long int linkMode;
00284     };
00285 }
00286 
00287 #endif // _TRANSMISSIONOBJECT_HPP
00288 
00289 

Generated on Sun May 27 03:31:58 2012 for openWNS by  doxygen 1.5.5