27 #include "ns3/core-config.h"
54 NS_FATAL_ERROR (
"Value set by user on " << name <<
" is invalid.");
65 char *envVar = getenv (
"NS_GLOBAL_VALUE");
70 std::string env = std::string (envVar);
71 std::string::size_type cur = 0;
72 std::string::size_type next = 0;
73 while (next != std::string::npos)
75 next = env.find (
";", cur);
76 std::string tmp = std::string (env, cur, next-cur);
77 std::string::size_type equal = tmp.find (
"=");
78 if (equal != std::string::npos)
80 std::string name = tmp.substr (0, equal);
81 std::string value = tmp.substr (equal+1, tmp.size () - equal - 1);
155 if ((*i)->GetName () == name)
157 if (!(*i)->SetValue (value))
173 if ((*i)->GetName () == name)
175 return (*i)->SetValue (value);
207 if ((*gvit)->GetName () == name)
209 (*gvit)->GetValue (value);
222 NS_FATAL_ERROR (
"Could not find GlobalValue named \"" << name <<
"\"");
NS_FATAL_x macro definitions.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Hold variables of type string.
void Set(const std::string &value)
Set the value.
String attribute value declarations.
Hold a value for an Attribute.
Unsigned integer attribute value declarations and template implementations.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Vector::const_iterator Iterator
#define NS_FATAL_ERROR(msg)
Fatal error handling.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Ptr< AttributeValue > m_initialValue
GlobalValue(std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeChecker > checker)
std::string GetName(void) const
void ResetInitialValue(void)
static Vector * GetVector(void)
static Iterator Begin(void)
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
Ptr< const AttributeChecker > m_checker
std::vector< GlobalValue * > Vector
static void Bind(std::string name, const AttributeValue &value)
static bool GetValueByNameFailSafe(std::string name, AttributeValue &value)
finds the GlobalValue with the given name and returns its value
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool SetValue(const AttributeValue &value)
Ptr< AttributeValue > m_currentValue
static Iterator End(void)
static bool BindFailSafe(std::string name, const AttributeValue &value)
std::string GetHelp(void) const
static void GetValueByName(std::string name, AttributeValue &value)
finds the GlobalValue with the given name and returns its value.
Ptr< const AttributeChecker > GetChecker(void) const
void InitializeFromEnv(void)
void GetValue(AttributeValue &value) const