27 #include "ns3/core-config.h"
55 NS_FATAL_ERROR (
"Value set by user on " << name <<
" is invalid.");
66 char *envVar = getenv (
"NS_GLOBAL_VALUE");
71 std::string env = std::string (envVar);
72 std::string::size_type cur = 0;
73 std::string::size_type next = 0;
74 while (next != std::string::npos)
76 next = env.find (
";", cur);
77 std::string tmp = std::string (env, cur, next-cur);
78 std::string::size_type equal = tmp.find (
"=");
79 if (equal != std::string::npos)
81 std::string name = tmp.substr (0, equal);
82 std::string value = tmp.substr (equal+1, tmp.size () - equal - 1);
156 if ((*i)->GetName () == name)
158 if (!(*i)->SetValue (value))
174 if ((*i)->GetName () == name)
176 return (*i)->SetValue (value);
208 if ((*gvit)->GetName () == name)
210 (*gvit)->GetValue (value);
223 NS_FATAL_ERROR (
"Could not find GlobalValue named \"" << name <<
"\"");
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
hold variables of type string
void Set(const std::string &value)
Hold a value for an Attribute.
Vector::const_iterator Iterator
#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)
#define NS_FATAL_ERROR(msg)
fatal error handling
std::string GetName(void) const
void ResetInitialValue(void)
static Vector * GetVector(void)
static Iterator Begin(void)
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
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