src/helper/wifi-helper.h
changeset 4406 39f119de91ef
parent 4264 9d2e96c4e6e4
child 4588 0698fdc1aaf9
--- a/src/helper/wifi-helper.h	Fri Apr 24 09:57:16 2009 +0200
+++ b/src/helper/wifi-helper.h	Fri Apr 24 10:01:41 2009 +0200
@@ -1,6 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
  * Copyright (c) 2008 INRIA
+ * Copyright (c) 2009 MIRKO BANCHI
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -16,6 +17,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
+ * Author: Mirko Banchi <mk.banchi@gmail.com>
  */
 #ifndef WIFI_HELPER_H
 #define WIFI_HELPER_H
@@ -29,6 +31,7 @@
 namespace ns3 {
 
 class WifiPhy;
+class WifiMac;
 class WifiNetDevice;
 class Node;
 
@@ -54,6 +57,25 @@
 };
 
 /**
+ * \brief create MAC objects
+ *
+ * This base class must be implemented by new MAC implementation which wish to integrate
+ * with the \ref ns3::WifiHelper class.
+ */
+class WifiMacHelper
+{
+public:
+  virtual ~WifiMacHelper ();
+  /**
+   * \returns a new MAC object.
+   *
+   * Subclasses must implement this method to allow the ns3::WifiHelper class
+   * to create MAC objects from ns3::WifiHelper::Install.
+   */
+  virtual Ptr<WifiMac> Create (void) const = 0;
+};
+
+/**
  * \brief helps to create WifiNetDevice objects
  *
  * This class can help to create a large set of similar
@@ -108,61 +130,33 @@
                                 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
                                 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
                                 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ());
-
-  /**
-   * \param type the type of ns3::WifiMac to create.
-   * \param n0 the name of the attribute to set
-   * \param v0 the value of the attribute to set
-   * \param n1 the name of the attribute to set
-   * \param v1 the value of the attribute to set
-   * \param n2 the name of the attribute to set
-   * \param v2 the value of the attribute to set
-   * \param n3 the name of the attribute to set
-   * \param v3 the value of the attribute to set
-   * \param n4 the name of the attribute to set
-   * \param v4 the value of the attribute to set
-   * \param n5 the name of the attribute to set
-   * \param v5 the value of the attribute to set
-   * \param n6 the name of the attribute to set
-   * \param v6 the value of the attribute to set
-   * \param n7 the name of the attribute to set
-   * \param v7 the value of the attribute to set
-   *
-   * All the attributes specified in this method should exist
-   * in the requested mac.
-   */
-  void SetMac (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 ());
-
   /**
    * \param phy the PHY helper to create PHY objects
+   * \param mac the MAC helper to create MAC objects
    * \param c the set of nodes on which a wifi device must be created
    * \returns a device container which contains all the devices created by this method.
    */
-  NetDeviceContainer Install (const WifiPhyHelper &phy, NodeContainer c) const;
+  NetDeviceContainer Install (const WifiPhyHelper &phy,
+                              const WifiMacHelper &mac, NodeContainer c) const;
   /**
    * \param phy the PHY helper to create PHY objects
+   * \param mac the MAC helper to create MAC objects
    * \param node the node on which a wifi device must be created
    * \returns a device container which contains all the devices created by this method.
    */
-  NetDeviceContainer Install (const WifiPhyHelper &phy, Ptr<Node> node) const;
+  NetDeviceContainer Install (const WifiPhyHelper &phy,
+                              const WifiMacHelper &mac, Ptr<Node> node) const;
   /**
    * \param phy the PHY helper to create PHY objects
+   * \param mac the MAC helper to create MAC objects
    * \param nodeName the name of node on which a wifi device must be created
    * \returns a device container which contains all the devices created by this method.
    */
-  NetDeviceContainer Install (const WifiPhyHelper &phy, std::string nodeName) const;
+  NetDeviceContainer Install (const WifiPhyHelper &phy,
+                              const WifiMacHelper &mac, std::string nodeName) const;
 
 private:
   ObjectFactory m_stationManager;
-  ObjectFactory m_mac;
 };
 
 } // namespace ns3