hold a so-called 'global value'. More...
#include <global-value.h>
Public Types | |
typedef Vector::const_iterator | Iterator |
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) |
Private Types | |
typedef std::vector < GlobalValue * > | Vector |
Static Private Member Functions | |
static Vector * | GetVector (void) |
Private Attributes | |
std::string | m_name |
std::string | m_help |
Ptr< AttributeValue > | m_initialValue |
Ptr< const AttributeChecker > | m_checker |
Friends | |
class | GlobalValueTests |
hold a so-called 'global value'.
Instances of this class are expected to be allocated as static global variables and should be used to store configurable global state.
Definition at line 39 of file global-value.h.
typedef Vector::const_iterator ns3::GlobalValue::Iterator |
Definition at line 43 of file global-value.h.
typedef std::vector<GlobalValue *> ns3::GlobalValue::Vector [private] |
Definition at line 41 of file global-value.h.
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. |
Definition at line 27 of file global-value.cc.
References GetVector(), m_checker, and NS_FATAL_ERROR.
GlobalValue::Iterator ns3::GlobalValue::Begin | ( | void | ) | [static] |
Definition at line 132 of file global-value.cc.
References GetVector().
Referenced by Bind(), BindFailSafe(), and ns3::CommandLine::PrintGlobals().
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. |
Iterate over the set of GlobalValues until a matching name is found and then set its value with GlobalValue::SetValue.
This method cannot fail. It will crash if the input is not valid.
Definition at line 104 of file global-value.cc.
References Begin(), End(), and NS_FATAL_ERROR.
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. |
Iterate over the set of GlobalValues until a matching name is found and then set its value with GlobalValue::SetValue.
Definition at line 120 of file global-value.cc.
GlobalValue::Iterator ns3::GlobalValue::End | ( | void | ) | [static] |
Definition at line 137 of file global-value.cc.
References GetVector().
Referenced by Bind(), BindFailSafe(), and ns3::CommandLine::PrintGlobals().
Ptr< const AttributeChecker > ns3::GlobalValue::GetChecker | ( | void | ) | const |
Definition at line 68 of file global-value.cc.
References m_checker.
std::string ns3::GlobalValue::GetHelp | ( | void | ) | const |
Definition at line 48 of file global-value.cc.
References m_help.
std::string ns3::GlobalValue::GetName | ( | void | ) | const |
Definition at line 43 of file global-value.cc.
References m_name.
void ns3::GlobalValue::GetValue | ( | AttributeValue & | value | ) | const |
Definition at line 53 of file global-value.cc.
References m_checker, m_initialValue, m_name, NS_FATAL_ERROR, and ns3::StringValue::Set().
Referenced by ns3::TimeStepPrecision::Get(), ns3::GetImpl(), and ns3::GlobalValueTests::RunTests().
GlobalValue::Vector * ns3::GlobalValue::GetVector | ( | void | ) | [static, private] |
Definition at line 142 of file global-value.cc.
Referenced by Begin(), End(), GlobalValue(), and ns3::GlobalValueTests::RunTests().
bool ns3::GlobalValue::SetValue | ( | const AttributeValue & | value | ) |
value | the new value to set in this GlobalValue. |
Definition at line 74 of file global-value.cc.
References ns3::AttributeValue::Copy(), ns3::StringValue::Get(), m_checker, m_initialValue, and ns3::PeekPointer().
Referenced by ns3::TimeStepPrecision::Set().
friend class GlobalValueTests [friend] |
Definition at line 110 of file global-value.h.
Ptr<const AttributeChecker> ns3::GlobalValue::m_checker [private] |
Definition at line 115 of file global-value.h.
Referenced by GetChecker(), GetValue(), GlobalValue(), and SetValue().
std::string ns3::GlobalValue::m_help [private] |
Definition at line 113 of file global-value.h.
Referenced by GetHelp().
Ptr<AttributeValue> ns3::GlobalValue::m_initialValue [private] |
Definition at line 114 of file global-value.h.
Referenced by GetValue(), and SetValue().
std::string ns3::GlobalValue::m_name [private] |
Definition at line 112 of file global-value.h.
Referenced by GetName(), and GetValue().