A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
multi-model-spectrum-channel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 CTTC
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 */
8
9#ifndef MULTI_MODEL_SPECTRUM_CHANNEL_H
10#define MULTI_MODEL_SPECTRUM_CHANNEL_H
11
12#include "spectrum-channel.h"
13#include "spectrum-converter.h"
15#include "spectrum-value.h"
16
17#include <ns3/propagation-delay-model.h>
18
19#include <map>
20#include <set>
21
22namespace ns3
23{
24
25/**
26 * \ingroup spectrum
27 * Container: SpectrumModelUid_t, SpectrumConverter
28 */
29typedef std::map<SpectrumModelUid_t, SpectrumConverter> SpectrumConverterMap_t;
30
31/**
32 * \ingroup spectrum
33 * The Tx spectrum model information. This class is used to convert
34 * one spectrum model into another one.
35 */
37{
38 public:
39 /**
40 * Constructor.
41 * \param txSpectrumModel the Tx Spectrum model.
42 */
44
47};
48
49/**
50 * \ingroup spectrum
51 * Container: SpectrumModelUid_t, TxSpectrumModelInfo
52 */
53typedef std::map<SpectrumModelUid_t, TxSpectrumModelInfo> TxSpectrumModelInfoMap_t;
54
55/**
56 * \ingroup spectrum
57 * The Rx spectrum model information. This class is used to convert
58 * one spectrum model into another one.
59 */
61{
62 public:
63 /**
64 * Constructor.
65 * \param rxSpectrumModel the Rx Spectrum model.
66 */
68
70 std::vector<Ptr<SpectrumPhy>> m_rxPhys; //!< Container of the Rx Spectrum phy objects.
71};
72
73/**
74 * \ingroup spectrum
75 * Container: SpectrumModelUid_t, RxSpectrumModelInfo
76 */
77typedef std::map<SpectrumModelUid_t, RxSpectrumModelInfo> RxSpectrumModelInfoMap_t;
78
79/**
80 * \ingroup spectrum
81 *
82 * This SpectrumChannel implementation can handle the presence of
83 * SpectrumPhy instances which can use
84 * different spectrum models, i.e., different SpectrumModel.
85 *
86 * \note It is allowed for a receiving SpectrumPhy to switch to a
87 * different SpectrumModel during the simulation. The requirement
88 * for this to work is that, after the SpectrumPhy switched its
89 * SpectrumModel, MultiModelSpectrumChannel::AddRx () is
90 * called again passing the pointer to that SpectrumPhy.
91 */
93{
94 public:
96
97 /**
98 * \brief Get the type ID.
99 * \return the object TypeId
100 */
101 static TypeId GetTypeId();
102
103 // inherited from SpectrumChannel
104 void RemoveRx(Ptr<SpectrumPhy> phy) override;
105 void AddRx(Ptr<SpectrumPhy> phy) override;
106 void StartTx(Ptr<SpectrumSignalParameters> params) override;
107
108 // inherited from Channel
109 std::size_t GetNDevices() const override;
110 Ptr<NetDevice> GetDevice(std::size_t i) const override;
111
112 protected:
113 void DoDispose() override;
114
115 private:
116 /**
117 * This method checks if m_rxSpectrumModelInfoMap contains an entry
118 * for the given TX SpectrumModel. If such entry exists, it returns
119 * an iterator pointing to it. If not, it creates a new entry in
120 * m_txSpectrumModelInfoMap, and returns an iterator to it.
121 *
122 * \param txSpectrumModel The TX SpectrumModel being considered
123 *
124 * \return An iterator pointing to the corresponding entry in m_txSpectrumModelInfoMap
125 */
126 TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel(
127 Ptr<const SpectrumModel> txSpectrumModel);
128
129 /**
130 * Used internally to reschedule transmission after the propagation delay.
131 *
132 * \param params The signal parameters.
133 * \param receiver A pointer to the receiver SpectrumPhy.
134 */
135 virtual void StartRx(Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
136
137 /**
138 * Data structure holding, for each TX SpectrumModel, all the
139 * converters to any RX SpectrumModel, and all the corresponding
140 * SpectrumPhy instances.
141 *
142 */
144
145 /**
146 * Data structure holding, for each RX spectrum model, all the
147 * corresponding SpectrumPhy instances.
148 */
150
151 /**
152 * Number of devices connected to the channel.
153 */
154 std::size_t m_numDevices;
155};
156
157} // namespace ns3
158
159#endif /* MULTI_MODEL_SPECTRUM_CHANNEL_H */
This SpectrumChannel implementation can handle the presence of SpectrumPhy instances which can use di...
void RemoveRx(Ptr< SpectrumPhy > phy) override
Remove a SpectrumPhy from a channel.
Ptr< NetDevice > GetDevice(std::size_t i) const override
void AddRx(Ptr< SpectrumPhy > phy) override
Add a SpectrumPhy to a channel, so it can receive packets.
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.
void DoDispose() override
Destructor implementation.
void StartTx(Ptr< SpectrumSignalParameters > params) override
Used by attached PHY instances to transmit signals on the channel.
TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel(Ptr< const SpectrumModel > txSpectrumModel)
This method checks if m_rxSpectrumModelInfoMap contains an entry for the given TX SpectrumModel.
static TypeId GetTypeId()
Get the type ID.
virtual void StartRx(Ptr< SpectrumSignalParameters > params, Ptr< SpectrumPhy > receiver)
Used internally to reschedule transmission after the propagation delay.
RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap
Data structure holding, for each RX spectrum model, all the corresponding SpectrumPhy instances.
Smart pointer class similar to boost::intrusive_ptr.
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:48
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.