28#include "ns3/core-config.h"
47 m_initialValue(nullptr),
48 m_currentValue(nullptr),
143 if ((*i)->GetName() == name)
145 if (!(*i)->SetValue(value))
162 if ((*i)->GetName() == name)
164 return (*i)->SetValue(value);
198 if ((*gvit)->GetName() == name)
200 (*gvit)->GetValue(value);
213 NS_FATAL_ERROR(
"Could not find GlobalValue named \"" << name <<
"\"");
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
Hold a value for an Attribute.
static KeyFoundType Get(const std::string &envvar, const std::string &key="", const std::string &delim=";")
Get the value corresponding to a key from an environment variable.
Vector::const_iterator Iterator
Iterator type for the list of all global values.
std::string GetHelp() const
Get the help string.
std::vector< GlobalValue * > Vector
Container type for holding all the GlobalValues.
void GetValue(AttributeValue &value) const
Get the value.
static void Bind(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
static bool GetValueByNameFailSafe(std::string name, AttributeValue &value)
Finds the GlobalValue with the given name and returns its value.
static Iterator Begin()
The Begin iterator.
std::string GetName() const
Get the name.
std::string m_help
The help string.
Ptr< const AttributeChecker > m_checker
The AttributeChecker for this GlobalValue.
Ptr< AttributeValue > m_currentValue
The current value.
bool SetValue(const AttributeValue &value)
Set the value of this GlobalValue.
static void GetValueByName(std::string name, AttributeValue &value)
Finds the GlobalValue with the given name and returns its value.
void ResetInitialValue()
Reset to the initial value.
static bool BindFailSafe(std::string name, const AttributeValue &value)
Iterate over the set of GlobalValues until a matching name is found and then set its value with Globa...
Ptr< const AttributeChecker > GetChecker() const
Get the AttributeChecker.
Ptr< AttributeValue > m_initialValue
The initial value.
static Iterator End()
The End iterator.
GlobalValue(std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeChecker > checker)
Constructor.
std::string m_name
The name of this GlobalValue.
void InitializeFromEnv()
Initialize from the NS_GLOBAL_VALUE environment variable.
static Vector * GetVector()
Get the static vector of all GlobalValues.
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
void Set(const std::string &value)
Set the value.
Class Environment declaration.
NS_FATAL_x macro definitions.
ns3::GlobalValue declaration.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::StringValue attribute value declarations.
ns3::UintegerValue attribute value declarations and template implementations.