A Discrete-Event Network Simulator
API
wave-helper.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation;
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * Author: Junling Bu <linlinjavaer@gmail.com>
16  */
17 
18 #ifndef WAVE_HELPER_H
19 #define WAVE_HELPER_H
20 
21 #include "ns3/attribute.h"
22 #include "ns3/net-device-container.h"
23 #include "ns3/node-container.h"
24 #include "ns3/object-factory.h"
25 #include "ns3/trace-helper.h"
26 #include "ns3/yans-wifi-helper.h"
27 
28 #include <string>
29 
30 namespace ns3
31 {
32 
33 class WaveNetDevice;
34 class Node;
35 
42 {
43  public:
48  static YansWavePhyHelper Default();
49 
50  private:
62  void EnablePcapInternal(std::string prefix,
63  Ptr<NetDevice> nd,
64  bool promiscuous,
65  bool explicitFilename) override;
66 
80  std::string prefix,
81  Ptr<NetDevice> nd,
82  bool explicitFilename) override;
83 };
84 
116 {
117  public:
118  WaveHelper();
119  virtual ~WaveHelper();
120 
129  static WaveHelper Default();
130 
135  void CreateMacForChannel(std::vector<uint32_t> channelNumbers);
139  void CreatePhys(uint32_t phys);
140 
149  template <typename... Ts>
150  void SetRemoteStationManager(std::string type, Ts&&... args);
159  template <typename... Ts>
160  void SetChannelScheduler(std::string type, Ts&&... args);
161 
169  const WifiMacHelper& mac,
170  NodeContainer c) const;
178  const WifiMacHelper& mac,
179  Ptr<Node> node) const;
187  const WifiMacHelper& mac,
188  std::string nodeName) const;
189 
193  static void EnableLogComponents();
194 
209  int64_t AssignStreams(NetDeviceContainer c, int64_t stream);
210 
211  protected:
214  std::vector<uint32_t> m_macsForChannelNumber;
215  uint32_t m_physNumber;
216 };
217 
218 /***************************************************************
219  * Implementation of the templates declared above.
220  ***************************************************************/
221 
222 template <typename... Ts>
223 void
225 {
226  m_stationManager = ObjectFactory(type, std::forward<Ts>(args)...);
227 }
228 
229 template <typename... Ts>
230 void
232 {
233  m_channelScheduler = ObjectFactory(type, std::forward<Ts>(args)...);
234 }
235 
236 } // namespace ns3
237 #endif /* WAVE_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:78
helps to create WaveNetDevice objects
Definition: wave-helper.h:116
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the Phy and Mac aspects ...
Definition: wave-helper.cc:421
virtual ~WaveHelper()
Definition: wave-helper.cc:280
std::vector< uint32_t > m_macsForChannelNumber
MACs for channel number.
Definition: wave-helper.h:214
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wave-helper.cc:335
static void EnableLogComponents()
Helper to enable all WaveNetDevice log components with one statement.
Definition: wave-helper.cc:404
uint32_t m_physNumber
Phy number.
Definition: wave-helper.h:215
void CreateMacForChannel(std::vector< uint32_t > channelNumbers)
Definition: wave-helper.cc:303
void SetChannelScheduler(std::string type, Ts &&... args)
Definition: wave-helper.h:231
void SetRemoteStationManager(std::string type, Ts &&... args)
Definition: wave-helper.h:224
ObjectFactory m_channelScheduler
channel scheduler
Definition: wave-helper.h:213
ObjectFactory m_stationManager
station manager
Definition: wave-helper.h:212
void CreatePhys(uint32_t phys)
Definition: wave-helper.cc:320
static WaveHelper Default()
Definition: wave-helper.cc:285
create MAC layers for a ns3::WifiNetDevice.
create PHY objects
Definition: wifi-helper.h:50
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
Definition: wave-helper.h:42
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output the indicated net device.
Definition: wave-helper.cc:130
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ascii trace output on the indicated net device.
Definition: wave-helper.cc:180
static YansWavePhyHelper Default()
Create a phy helper in a default working state.
Definition: wave-helper.cc:122
Make it easy to create and manage PHY objects for the YANS model.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mac
Definition: third.py:85
phy
Definition: third.py:82