A Discrete-Event Network Simulator
API
wifi-mac-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016
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: Sébastien Deronne <sebastien.deronne@gmail.com>
19  */
20 
21 #ifndef WIFI_MAC_HELPER_H
22 #define WIFI_MAC_HELPER_H
23 
24 #include "ns3/object-factory.h"
25 #include "ns3/wifi-standards.h"
26 
27 namespace ns3 {
28 
29 class WifiMac;
30 class WifiNetDevice;
31 
48 {
49 public:
54  WifiMacHelper ();
58  virtual ~WifiMacHelper ();
59 
68  template <typename... Args>
69  void SetType (std::string type, Args&&... args);
70 
78  template <typename... Args>
79  void SetProtectionManager (std::string type, Args&&... args);
80 
88  template <typename... Args>
89  void SetAckManager (std::string type, Args&&... args);
90 
99  template <typename... Args>
100  void SetMultiUserScheduler (std::string type, Args&&... args);
101 
109  virtual Ptr<WifiMac> Create (Ptr<WifiNetDevice> device, WifiStandard standard) const;
110 
111 
112 protected:
117 };
118 
119 } // namespace ns3
120 
121 
122 /***************************************************************
123  * Implementation of the templates declared above.
124  ***************************************************************/
125 
126 namespace ns3 {
127 
128 template <typename... Args>
129 void
130 WifiMacHelper::SetType (std::string type, Args&&... args)
131 {
132  m_mac.SetTypeId (type);
133  m_mac.Set (args...);
134 }
135 
136 template <typename... Args>
137 void
138 WifiMacHelper::SetProtectionManager (std::string type, Args&&... args)
139 {
141  m_protectionManager.Set (args...);
142 }
143 
144 template <typename... Args>
145 void
146 WifiMacHelper::SetAckManager (std::string type, Args&&... args)
147 {
148  m_ackManager.SetTypeId (type);
149  m_ackManager.Set (args...);
150 }
151 
152 template <typename... Args>
153 void
154 WifiMacHelper::SetMultiUserScheduler (std::string type, Args&&... args)
155 {
156  m_muScheduler.SetTypeId (type);
157  m_muScheduler.Set (args...);
158 }
159 
160 } // namespace ns3
161 
162 #endif /* WIFI_MAC_HELPER_H */
Instantiate subclasses of ns3::Object.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
create MAC layers for a ns3::WifiNetDevice.
ObjectFactory m_mac
MAC object factory.
void SetAckManager(std::string type, Args &&... args)
Helper function used to set the Acknowledgment Manager.
virtual ~WifiMacHelper()
Destroy a WifiMacHelper.
virtual Ptr< WifiMac > Create(Ptr< WifiNetDevice > device, WifiStandard standard) const
ObjectFactory m_protectionManager
Factory to create a protection manager.
ObjectFactory m_muScheduler
Multi-user Scheduler object factory.
void SetProtectionManager(std::string type, Args &&... args)
Helper function used to set the Protection Manager.
WifiMacHelper()
Create a WifiMacHelper to make life easier for people who want to work with Wifi MAC layers.
void SetMultiUserScheduler(std::string type, Args &&... args)
Helper function used to set the Multi User Scheduler that can be aggregated to an HE AP's MAC.
ObjectFactory m_ackManager
Factory to create an acknowledgment manager.
void SetType(std::string type, Args &&... args)
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
Every class exported by the ns3 library is enclosed in the ns3 namespace.