ns3::GlobalValue Class Reference

hold a so-called 'global value'. More...

#include <global-value.h>

Collaboration diagram for ns3::GlobalValue:
Collaboration graph
[legend]

List of all members.

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 AttributeCheckerGetChecker (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 VectorGetVector (void)

Private Attributes

std::string m_name
std::string m_help
Ptr< AttributeValuem_initialValue
Ptr< const AttributeCheckerm_checker

Friends

class GlobalValueTests

Detailed Description

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.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

ns3::GlobalValue::GlobalValue ( std::string  name,
std::string  help,
const AttributeValue initialValue,
Ptr< const AttributeChecker checker 
)
Parameters:
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.


Member Function Documentation

GlobalValue::Iterator ns3::GlobalValue::Begin ( void   )  [static]
Returns:
an iterator which represents a pointer to the first GlobalValue registered.

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]
Parameters:
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]
Parameters:
name the name of the global value
value the value to set in the requested global value.
Returns:
true if the value could be set successfully, false otherwise.

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.

References Begin(), and End().

GlobalValue::Iterator ns3::GlobalValue::End ( void   )  [static]
Returns:
an iterator which represents a pointer to the last GlobalValue registered.

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
Returns:
the checker associated to this GlobalValue.

Definition at line 68 of file global-value.cc.

References m_checker.

std::string ns3::GlobalValue::GetHelp ( void   )  const
Returns:
the help text of this GlobalValue.

Definition at line 48 of file global-value.cc.

References m_help.

std::string ns3::GlobalValue::GetName ( void   )  const
Returns:
the name of this GlobalValue.

Definition at line 43 of file global-value.cc.

References m_name.

void ns3::GlobalValue::GetValue ( AttributeValue value  )  const
Returns:
the current value of this GlobalValue.

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  ) 
Parameters:
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().


Friends And Related Function Documentation

friend class GlobalValueTests [friend]

Definition at line 110 of file global-value.h.


Member Data Documentation

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().

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().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:10:20 2009 for NS-3 by  doxygen 1.6.3