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::set<Ptr<SpectrumPhy> > m_rxPhySet;
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 AddRx (Ptr<SpectrumPhy> phy);
120  virtual void StartTx (Ptr<SpectrumSignalParameters> params);
121 
122 
123  // inherited from Channel
124  virtual std::size_t GetNDevices (void) const;
125  virtual Ptr<NetDevice> GetDevice (std::size_t i) const;
126 
127 
128 protected:
129  void DoDispose ();
130 
131 private:
142  TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel (Ptr<const SpectrumModel> txSpectrumModel);
143 
150  virtual void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
151 
159 
160 
166 
170  std::size_t m_numDevices;
171 
172 };
173 
174 
175 
176 }
177 
178 
179 
180 #endif /* MULTI_MODEL_SPECTRUM_CHANNEL_H */
std::set< Ptr< SpectrumPhy > > m_rxPhySet
Container of the Rx Spectrum phy objects.
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
The Rx spectrum model information.
std::map< SpectrumModelUid_t, SpectrumConverter > SpectrumConverterMap_t
Container: SpectrumModelUid_t, SpectrumConverter.
RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap
Data structure holding, for each RX spectrum model, all the corresponding SpectrumPhy instances...
This SpectrumChannel implementation can handle the presence of SpectrumPhy instances which can use di...
std::size_t m_numDevices
Number of devices connected to the channel.
phy
Definition: third.py:86
Ptr< const SpectrumModel > m_rxSpectrumModel
Rx Spectrum model.
Ptr< const SpectrumModel > m_txSpectrumModel
Tx Spectrum model.
static TypeId GetTypeId(void)
Get the type ID.
virtual void AddRx(Ptr< SpectrumPhy > phy)
Add a SpectrumPhy to a channel, so it can receive packets.
TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel(Ptr< const SpectrumModel > txSpectrumModel)
This method checks if m_rxSpectrumModelInfoMap contains an entry for the given TX SpectrumModel...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual std::size_t GetNDevices(void) const
RxSpectrumModelInfo(Ptr< const SpectrumModel > rxSpectrumModel)
Constructor.
std::map< SpectrumModelUid_t, RxSpectrumModelInfo > RxSpectrumModelInfoMap_t
Container: SpectrumModelUid_t, RxSpectrumModelInfo.
void DoDispose()
Destructor implementation.
SpectrumConverterMap_t m_spectrumConverterMap
Spectrum converter.
virtual void StartTx(Ptr< SpectrumSignalParameters > params)
Used by attached PHY instances to transmit signals on the channel.
TxSpectrumModelInfoMap_t m_txSpectrumModelInfoMap
Data structure holding, for each TX SpectrumModel, all the converters to any RX SpectrumModel, and all the corresponding SpectrumPhy instances.
Defines the interface for spectrum-aware channel implementations.
TxSpectrumModelInfo(Ptr< const SpectrumModel > txSpectrumModel)
Constructor.
a unique identifier for an interface.
Definition: type-id.h:58
virtual void StartRx(Ptr< SpectrumSignalParameters > params, Ptr< SpectrumPhy > receiver)
Used internally to reschedule transmission after the propagation delay.
std::map< SpectrumModelUid_t, TxSpectrumModelInfo > TxSpectrumModelInfoMap_t
Container: SpectrumModelUid_t, TxSpectrumModelInfo.
The Tx spectrum model information.