#include <global-value.h>
Public Member Functions | |
GlobalValue (std::string name, std::string help, const AttributeValue &initialValue, Ptr< const AttributeChecker > checker) | |
std::string | GetName (void) const |
std::string | GetHelp (void) const |
void | GetValue (AttributeValue &value) const |
Ptr< const AttributeChecker > | GetChecker (void) const |
bool | SetValue (const AttributeValue &value) |
Static Public Member Functions | |
static void | Bind (std::string name, const AttributeValue &value) |
static bool | BindFailSafe (std::string name, const AttributeValue &value) |
static Iterator | Begin (void) |
static Iterator | End (void) |
Instances of this class are expected to be allocated as static global variables and should be used to store configurable global state. GlobalValues can be set directly by calling ns3::GlobalValue::SetValue but they can also be set through the NS_GLOBAL_VALUE environment variable. For example, NS_GLOBAL_VALUE='Name=Value;OtherName=OtherValue;' would set global values Name and OtherName to Value and OtherValue respectively.
Users of the ns3::CommandLine class also get the ability to set global values through commandline arguments to their program: --Name=Value will set global value Name to Value.
ns3::GlobalValue::GlobalValue | ( | std::string | name, | |
std::string | help, | |||
const AttributeValue & | initialValue, | |||
Ptr< const AttributeChecker > | checker | |||
) |
name | the name of this global value. | |
help | some help text which describes the purpose of this global value. | |
initialValue | the value to assign to this global value during construction. | |
checker | a pointer to an AttributeChecker which can verify that any user-supplied value to override the initial value matches the requested type constraints. |
static Iterator ns3::GlobalValue::Begin | ( | void | ) | [static] |
static void ns3::GlobalValue::Bind | ( | std::string | name, | |
const AttributeValue & | value | |||
) | [static] |
name | the name of the global value | |
value | the value to set in the requested global value. |
This method cannot fail. It will crash if the input is not valid.
static bool ns3::GlobalValue::BindFailSafe | ( | std::string | name, | |
const AttributeValue & | value | |||
) | [static] |
name | the name of the global value | |
value | the value to set in the requested global value. |
static Iterator ns3::GlobalValue::End | ( | void | ) | [static] |
Ptr<const AttributeChecker> ns3::GlobalValue::GetChecker | ( | void | ) | const |
std::string ns3::GlobalValue::GetHelp | ( | void | ) | const |
std::string ns3::GlobalValue::GetName | ( | void | ) | const |
void ns3::GlobalValue::GetValue | ( | AttributeValue & | value | ) | const |
bool ns3::GlobalValue::SetValue | ( | const AttributeValue & | value | ) |
value | the new value to set in this GlobalValue. |