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 NetDevice;
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 
98  virtual Ptr<WifiMac> Create (Ptr<NetDevice> device, WifiStandard standard) const;
99 
100 
101 protected:
105 };
106 
107 } // namespace ns3
108 
109 
110 /***************************************************************
111  * Implementation of the templates declared above.
112  ***************************************************************/
113 
114 namespace ns3 {
115 
116 template <typename... Args>
117 void
118 WifiMacHelper::SetType (std::string type, Args&&... args)
119 {
120  m_mac.SetTypeId (type);
121  m_mac.Set (args...);
122 }
123 
124 template <typename... Args>
125 void
126 WifiMacHelper::SetProtectionManager (std::string type, Args&&... args)
127 {
129  m_protectionManager.Set (args...);
130 }
131 
132 template <typename... Args>
133 void
134 WifiMacHelper::SetAckManager (std::string type, Args&&... args)
135 {
136  m_ackManager.SetTypeId (type);
137  m_ackManager.Set (args...);
138 }
139 
140 } // namespace ns3
141 
142 #endif /* WIFI_MAC_HELPER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
void SetType(std::string type, Args &&... args)
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.
ObjectFactory m_ackManager
Factory to create an acknowledgment manager.
virtual Ptr< WifiMac > Create(Ptr< NetDevice > device, WifiStandard standard) const
WifiMacHelper()
Create a WifiMacHelper to make life easier for people who want to work with Wifi MAC layers...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiStandard
Identifies the allowed configurations that a Wifi device is configured to use.
create MAC layers for a ns3::WifiNetDevice.
Instantiate subclasses of ns3::Object.
virtual ~WifiMacHelper()
Destroy a WifiMacHelper.
ObjectFactory m_mac
MAC object factory.
void SetAckManager(std::string type, Args &&... args)
Helper function used to set the Acknowledgment Manager.
ObjectFactory m_protectionManager
Factory to create a protection manager.
void SetProtectionManager(std::string type, Args &&... args)
Helper function used to set the Protection Manager.