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


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


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.


Member Function Documentation

static Iterator ns3::GlobalValue::Begin ( void   )  [static]

Returns:
an iterator which represents a pointer to the first GlobalValue registered.

static 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.

static 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.

static Iterator ns3::GlobalValue::End ( void   )  [static]

Returns:
an iterator which represents a pointer to the last GlobalValue registered.

Ptr<const AttributeChecker> ns3::GlobalValue::GetChecker ( void   )  const

Returns:
the checker associated to this GlobalValue.

std::string ns3::GlobalValue::GetHelp ( void   )  const

Returns:
the help text of this GlobalValue.

std::string ns3::GlobalValue::GetName ( void   )  const

Returns:
the name of this GlobalValue.

void ns3::GlobalValue::GetValue ( AttributeValue value  )  const

Returns:
the current value of this GlobalValue.

bool ns3::GlobalValue::SetValue ( const AttributeValue value  ) 

Parameters:
value the new value to set in this GlobalValue.


The documentation for this class was generated from the following file:

Generated on Fri Apr 9 15:01:08 2010 for NS-3 by  doxygen 1.5.8