A Discrete-Event Network Simulator
API
multi-model-spectrum-channel.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 CTTC
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  */
20 
21 
22 #ifndef MULTI_MODEL_SPECTRUM_CHANNEL_H
23 #define MULTI_MODEL_SPECTRUM_CHANNEL_H
24 
25 #include <ns3/spectrum-value.h>
26 #include <ns3/spectrum-converter.h>
27 #include <ns3/spectrum-channel.h>
28 #include <ns3/spectrum-propagation-loss-model.h>
29 #include <ns3/propagation-delay-model.h>
30 #include <map>
31 #include <set>
32 
33 namespace ns3 {
34 
35 
40 typedef std::map<SpectrumModelUid_t, SpectrumConverter> SpectrumConverterMap_t;
41 
48 {
49 public:
55 
58 };
59 
60 
65 typedef std::map<SpectrumModelUid_t, TxSpectrumModelInfo> TxSpectrumModelInfoMap_t;
66 
67 
74 {
75 public:
81 
83  std::vector<Ptr<SpectrumPhy> > m_rxPhys;
84 };
85 
90 typedef std::map<SpectrumModelUid_t, RxSpectrumModelInfo> RxSpectrumModelInfoMap_t;
91 
92 
107 {
108 
109 public:
111 
116  static TypeId GetTypeId (void);
117 
118  // inherited from SpectrumChannel
119  virtual void RemoveRx (Ptr<SpectrumPhy> phy);
120  virtual void AddRx (Ptr<SpectrumPhy> phy);
121  virtual void StartTx (Ptr<SpectrumSignalParameters> params);
122 
123 
124  // inherited from Channel
125  virtual std::size_t GetNDevices (void) const;
126  virtual Ptr<NetDevice> GetDevice (std::size_t i) const;
127 
128 
129 protected:
130  void DoDispose ();
131 
132 private:
143  TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel (Ptr<const SpectrumModel> txSpectrumModel);
144 
151  virtual void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
152 
160 
161 
167 
171  std::size_t m_numDevices;
172 
173 };
174 
175 
176 
177 }
178 
179 
180 
181 #endif /* MULTI_MODEL_SPECTRUM_CHANNEL_H */
This SpectrumChannel implementation can handle the presence of SpectrumPhy instances which can use di...
virtual std::size_t GetNDevices(void) const
TxSpectrumModelInfoMap_t m_txSpectrumModelInfoMap
Data structure holding, for each TX SpectrumModel, all the converters to any RX SpectrumModel,...
std::size_t m_numDevices
Number of devices connected to the channel.
static TypeId GetTypeId(void)
Get the type ID.
TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel(Ptr< const SpectrumModel > txSpectrumModel)
This method checks if m_rxSpectrumModelInfoMap contains an entry for the given TX SpectrumModel.
virtual void RemoveRx(Ptr< SpectrumPhy > phy)
Remove a SpectrumPhy from a channel.
void DoDispose()
Destructor implementation.
virtual void StartRx(Ptr< SpectrumSignalParameters > params, Ptr< SpectrumPhy > receiver)
Used internally to reschedule transmission after the propagation delay.
virtual void StartTx(Ptr< SpectrumSignalParameters > params)
Used by attached PHY instances to transmit signals on the channel.
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
virtual void AddRx(Ptr< SpectrumPhy > phy)
Add a SpectrumPhy to a channel, so it can receive packets.
RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap
Data structure holding, for each RX spectrum model, all the corresponding SpectrumPhy instances.
The Rx spectrum model information.
std::vector< Ptr< SpectrumPhy > > m_rxPhys
Container of the Rx Spectrum phy objects.
RxSpectrumModelInfo(Ptr< const SpectrumModel > rxSpectrumModel)
Constructor.
Ptr< const SpectrumModel > m_rxSpectrumModel
Rx Spectrum model.
Defines the interface for spectrum-aware channel implementations.
The Tx spectrum model information.
Ptr< const SpectrumModel > m_txSpectrumModel
Tx Spectrum model.
SpectrumConverterMap_t m_spectrumConverterMap
Spectrum converter.
TxSpectrumModelInfo(Ptr< const SpectrumModel > txSpectrumModel)
Constructor.
a unique identifier for an interface.
Definition: type-id.h:59
std::map< SpectrumModelUid_t, TxSpectrumModelInfo > TxSpectrumModelInfoMap_t
Container: SpectrumModelUid_t, TxSpectrumModelInfo.
std::map< SpectrumModelUid_t, SpectrumConverter > SpectrumConverterMap_t
Container: SpectrumModelUid_t, SpectrumConverter.
std::map< SpectrumModelUid_t, RxSpectrumModelInfo > RxSpectrumModelInfoMap_t
Container: SpectrumModelUid_t, RxSpectrumModelInfo.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:93