A Discrete-Event Network Simulator
API
uan-helper.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008 University of Washington
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Leonard Tracy <lentracy@u.washington.edu>
18  */
19 
20 #ifndef UAN_HELPER_H
21 #define UAN_HELPER_H
22 
23 #include "ns3/attribute.h"
24 #include "ns3/net-device-container.h"
25 #include "ns3/node-container.h"
26 #include "ns3/object-factory.h"
27 #include "ns3/uan-net-device.h"
28 
29 #include <string>
30 
31 namespace ns3
32 {
33 
34 class UanChannel;
35 
41 class UanHelper
42 {
43  public:
44  UanHelper();
45  virtual ~UanHelper();
46 
57  template <typename... Ts>
58  void SetMac(std::string type, Ts&&... args);
59 
70  template <typename... Ts>
71  void SetPhy(std::string phyType, Ts&&... args);
72 
83  template <typename... Ts>
84  void SetTransducer(std::string type, Ts&&... args);
94  static void EnableAscii(std::ostream& os, uint32_t nodeid, uint32_t deviceid);
104  static void EnableAscii(std::ostream& os, NetDeviceContainer d);
114  static void EnableAscii(std::ostream& os, NodeContainer n);
122  static void EnableAsciiAll(std::ostream& os);
123 
138 
152 
170 
182  int64_t AssignStreams(NetDeviceContainer c, int64_t stream);
183 
184  private:
189 };
190 
191 /***************************************************************
192  * Implementation of the templates declared above.
193  ***************************************************************/
194 
195 template <typename... Ts>
196 void
197 UanHelper::SetMac(std::string type, Ts&&... args)
198 {
199  m_mac = ObjectFactory(type, std::forward<Ts>(args)...);
200 }
201 
202 template <typename... Ts>
203 void
204 UanHelper::SetPhy(std::string phyType, Ts&&... args)
205 {
206  m_phy = ObjectFactory(phyType, std::forward<Ts>(args)...);
207 }
208 
209 template <typename... Ts>
210 void
211 UanHelper::SetTransducer(std::string type, Ts&&... args)
212 {
213  m_transducer = ObjectFactory(type, std::forward<Ts>(args)...);
214 }
215 
216 } // end namespace ns3
217 
218 #endif /* UAN_HELPER_H */
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
UAN configuration helper.
Definition: uan-helper.h:42
ObjectFactory m_device
The device.
Definition: uan-helper.h:185
void SetPhy(std::string phyType, Ts &&... args)
Set PHY attributes.
Definition: uan-helper.h:204
void SetTransducer(std::string type, Ts &&... args)
Set the transducer attributes.
Definition: uan-helper.h:211
void SetMac(std::string type, Ts &&... args)
Set MAC attributes.
Definition: uan-helper.h:197
ObjectFactory m_phy
The PHY layer.
Definition: uan-helper.h:187
ObjectFactory m_transducer
The transducer.
Definition: uan-helper.h:188
static void EnableAscii(std::ostream &os, uint32_t nodeid, uint32_t deviceid)
Enable ascii output on the specified deviceid within the specified nodeid if it is of type ns3::UanNe...
Definition: uan-helper.cc:99
ObjectFactory m_mac
The MAC layer.
Definition: uan-helper.h:186
NetDeviceContainer Install(NodeContainer c) const
This method creates a simple ns3::UanChannel (with a default ns3::UanNoiseModelDefault and ns3::UanPr...
Definition: uan-helper.cc:145
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: uan-helper.cc:192
static void EnableAsciiAll(std::ostream &os)
Enable ascii output on each device which is of the ns3::UanNetDevice type and dump that to the specif...
Definition: uan-helper.cc:139
UanHelper()
Default constructor.
Definition: uan-helper.cc:87
virtual ~UanHelper()
Destructor.
Definition: uan-helper.cc:94
Every class exported by the ns3 library is enclosed in the ns3 namespace.
channel
Definition: third.py:88