add a string-based constructor
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 10 Jun 2008 13:08:22 -0700
changeset 3879 3a887a06b795
parent 3878 3b7d0c1fce02
child 3880 b685a65a4b72
add a string-based constructor
src/devices/wifi/wifi-mode.cc
src/devices/wifi/wifi-mode.h
--- a/src/devices/wifi/wifi-mode.cc	Tue Jun 10 12:17:34 2008 -0700
+++ b/src/devices/wifi/wifi-mode.cc	Tue Jun 10 13:08:22 2008 -0700
@@ -107,6 +107,13 @@
 WifiMode::WifiMode (uint32_t uid)
   : m_uid (uid)
 {}
+WifiMode::WifiMode (std::string name)
+{
+  if (!WifiModeFactory::GetFactory ()->Search (name, this))
+    {
+      NS_FATAL_ERROR ("Invalid requested wifi mode: " << name);
+    }
+}
 
 ATTRIBUTE_HELPER_CPP (WifiMode);
 
--- a/src/devices/wifi/wifi-mode.h	Tue Jun 10 12:17:34 2008 -0700
+++ b/src/devices/wifi/wifi-mode.h	Tue Jun 10 13:08:22 2008 -0700
@@ -106,7 +106,7 @@
    * its initialization.
    */
   WifiMode ();
-
+  WifiMode (std::string name);
 private:
   friend class WifiModeFactory;
   WifiMode (uint32_t uid);