merge
This commit is contained in:
@@ -174,6 +174,30 @@ GlobalValue::End (void)
|
||||
{
|
||||
return GetVector ()->end ();
|
||||
}
|
||||
|
||||
bool
|
||||
GlobalValue::GetValueByNameFailSafe (std::string name, AttributeValue &value)
|
||||
{
|
||||
for (GlobalValue::Iterator gvit = GlobalValue::Begin (); gvit != GlobalValue::End (); ++gvit)
|
||||
{
|
||||
if ((*gvit)->GetName () == name)
|
||||
{
|
||||
(*gvit)->GetValue (value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false; // not found
|
||||
}
|
||||
|
||||
void
|
||||
GlobalValue::GetValueByName (std::string name, AttributeValue &value)
|
||||
{
|
||||
if (! GetValueByNameFailSafe (name, value))
|
||||
{
|
||||
NS_FATAL_ERROR ("Could not find GlobalValue named \"" << name << "\"");
|
||||
}
|
||||
}
|
||||
|
||||
GlobalValue::Vector *
|
||||
GlobalValue::GetVector (void)
|
||||
{
|
||||
|
||||
@@ -114,6 +114,30 @@ public:
|
||||
* \returns an iterator which represents a pointer to the last GlobalValue registered.
|
||||
*/
|
||||
static Iterator End (void);
|
||||
|
||||
|
||||
/**
|
||||
* finds the GlobalValue with the given name and returns its value
|
||||
*
|
||||
* @param name the name of the GlobalValue to be found
|
||||
* @param value where to store the value of the found GlobalValue
|
||||
*
|
||||
* @return true if the GlobalValue was found, false otherwise
|
||||
*/
|
||||
static bool GetValueByNameFailSafe (std::string name, AttributeValue &value);
|
||||
|
||||
/**
|
||||
* finds the GlobalValue with the given name and returns its
|
||||
* value. This method cannot fail, i.e., it will trigger a
|
||||
* NS_FATAL_ERROR if the requested GlobalValue is not found.
|
||||
*
|
||||
* @param name the name of the GlobalValue to be found
|
||||
* @param value where to store the value of the found GlobalValue
|
||||
*
|
||||
*/
|
||||
static void GetValueByName (std::string name, AttributeValue &value);
|
||||
|
||||
|
||||
private:
|
||||
friend class GlobalValueTests;
|
||||
static Vector *GetVector (void);
|
||||
|
||||
Reference in New Issue
Block a user