A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
spectrum-helper.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 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 #ifndef SPECTRUM_HELPER_H
22 #define SPECTRUM_HELPER_H
23 
24 #include <string>
25 #include <ns3/attribute.h>
26 #include <ns3/object-factory.h>
27 #include <ns3/node-container.h>
28 #include <ns3/net-device-container.h>
29 #include <ns3/propagation-loss-model.h>
30 #include <ns3/spectrum-propagation-loss-model.h>
31 
32 namespace ns3 {
33 
34 class SpectrumPhy;
35 class SpectrumChannel;
36 class Node;
37 class NetDevice;
38 
39 
45 {
46 public:
47  static SpectrumChannelHelper Default ();
48 
68  void SetChannel (std::string type,
69  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
70  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
71  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
72  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
73  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
74  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
75  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
76  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
98  void AddPropagationLoss (std::string name,
99  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
100  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
101  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
102  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
103  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
104  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
105  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
106  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
107 
108 
115 
137  void AddSpectrumPropagationLoss (std::string name,
138  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
139  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
140  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
141  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
142  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
143  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
144  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
145  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
146 
153 
175  void SetPropagationDelay (std::string name,
176  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
177  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
178  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
179  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
180  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
181  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
182  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
183  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
184 
190  Ptr<SpectrumChannel> Create (void) const;
191 
192 private:
193  Ptr<SpectrumPropagationLossModel> m_spectrumPropagationLossModel;
194  Ptr<PropagationLossModel> m_propagationLossModel;
195  ObjectFactory m_propagationDelay;
196  ObjectFactory m_channel;
197 };
198 
199 
200 
207 {
208 public:
228  void SetPhy (std::string name,
229  std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
230  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
231  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
232  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
233  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
234  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
235  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
236  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
237 
243  void SetChannel (Ptr<SpectrumChannel> channel);
244 
250  void SetChannel (std::string channelName);
251 
258  void SetPhyAttribute (std::string name, const AttributeValue &v);
259 
267  Ptr<SpectrumPhy> Create (Ptr<Node> node, Ptr<NetDevice> device) const;
268 
269 
270 
271 private:
272  ObjectFactory m_phy;
273  Ptr<SpectrumChannel> m_channel;
274 };
275 
276 
277 } // namespace ns3
278 
279 #endif /* SPECTRUM_HELPER_H */
void SetChannel(Ptr< SpectrumChannel > channel)
Hold a value for an Attribute.
Definition: attribute.h:51
Ptr< SpectrumChannel > Create(void) const
void AddPropagationLoss(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
A class for an empty attribute value.
Definition: attribute.h:204
void SetPropagationDelay(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
void SetPhy(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
void SetChannel(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
void AddSpectrumPropagationLoss(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
instantiate subclasses of ns3::Object.
Ptr< SpectrumPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const
void SetPhyAttribute(std::string name, const AttributeValue &v)