A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
multi-model-spectrum-channel.h
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 
36 typedef std::map<SpectrumModelUid_t, SpectrumConverter> SpectrumConverterMap_t;
37 
38 
44 {
45 public:
47 
48  Ptr<const SpectrumModel> m_txSpectrumModel;
49  SpectrumConverterMap_t m_spectrumConverterMap;
50 };
51 
52 typedef std::map<SpectrumModelUid_t, TxSpectrumModelInfo> TxSpectrumModelInfoMap_t;
53 
54 
60 {
61 public:
63 
64  Ptr<const SpectrumModel> m_rxSpectrumModel;
65  std::set<Ptr<SpectrumPhy> > m_rxPhySet;
66 };
67 
68 typedef std::map<SpectrumModelUid_t, RxSpectrumModelInfo> RxSpectrumModelInfoMap_t;
69 
70 
71 
72 
87 {
88 
89 public:
91 
92  static TypeId GetTypeId (void);
93 
94  // inherited from SpectrumChannel
98  virtual void AddRx (Ptr<SpectrumPhy> phy);
99  virtual void StartTx (Ptr<SpectrumSignalParameters> params);
100 
101 
102  // inherited from Channel
103  virtual uint32_t GetNDevices (void) const;
104  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
105 
106  virtual Ptr<SpectrumPropagationLossModel> GetSpectrumPropagationLossModel (void);
107 
108 
109 protected:
110  void DoDispose ();
111 
112 
113 
114 private:
125  TxSpectrumModelInfoMap_t::const_iterator FindAndEventuallyAddTxSpectrumModel (Ptr<const SpectrumModel> txSpectrumModel);
126 
133  virtual void StartRx (Ptr<SpectrumSignalParameters> params, Ptr<SpectrumPhy> receiver);
134 
135 
136 
142 
148 
154 
155 
162  TxSpectrumModelInfoMap_t m_txSpectrumModelInfoMap;
163 
164 
170  RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap;
171 
172  uint32_t m_numDevices;
173 
174  double m_maxLossDb;
175 
176  TracedCallback<Ptr<SpectrumPhy>, Ptr<SpectrumPhy>, double > m_pathLossTrace;
177 };
178 
179 
180 
181 }
182 
183 
184 
185 #endif /* MULTI_MODEL_SPECTRUM_CHANNEL_H */
Ptr< SpectrumPropagationLossModel > m_spectrumPropagationLoss
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
RxSpectrumModelInfoMap_t m_rxSpectrumModelInfoMap
Ptr< PropagationDelayModel > m_propagationDelay
Ptr< PropagationLossModel > m_propagationLoss
virtual uint32_t GetNDevices(void) const
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)
virtual void AddSpectrumPropagationLossModel(Ptr< SpectrumPropagationLossModel > loss)
virtual void StartTx(Ptr< SpectrumSignalParameters > params)
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
virtual void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
TxSpectrumModelInfoMap_t m_txSpectrumModelInfoMap
a unique identifier for an interface.
Definition: type-id.h:44
virtual void StartRx(Ptr< SpectrumSignalParameters > params, Ptr< SpectrumPhy > receiver)