Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

zeitgeist::ParameterList Class Reference

list of values. More...

#include <parameterlist.h>

List of all members.

Public Types

typedef std::vector< boost::any > TVector

Public Member Functions

 ParameterList ()
virtual ~ParameterList ()
void AddValue (const boost::any &value)
 inserts a value at the end of the managed sequence
ParameterListAddList ()
 inserts an empty ParameterList as a new value at the end of the managed sequence and returns a reference to the new list.
int GetSize () const
 returns the number of values contained in the managed sequence
bool IsEmpty () const
 returns true if the managed sequence is empty
void Clear ()
 removes all elements from the managed sequence
void Pop_Front ()
 removes the first element from the managed sequence
void Pop_Back ()
 removes the last element from the managed sequence
TVector::const_iterator begin () const
 returns an iterator pointing at the begin of the managed sequence
TVector::const_iterator end () const
 returns an iterator pointing at the end of the managed sequence
TVector::const_iterator operator[] (int n) const
 returns an iterator pointing at the nth element of the managed sequence
TVector::iterator operator[] (int n)
 returns an iterator pointing at the nth element of the managed sequence
TVector::iterator begin ()
 returns an iterator pointing at the begin of the managed sequence
TVector::iterator end ()
 returns an iterator pointing at the end of the managed sequence
template<typename T>
bool AdvanceAnyValue (TVector::const_iterator &iter, T &value) const
 AdvanceAnyValue is a generic templated helper function for consumers of ParameterLists.
template<typename T>
f_inline bool GetValue (const TVector::const_iterator &iter, T &value) const
 GetValue is a generic templated helper function for consumers of ParameterLists.
template<typename T>
f_inline bool GetAnyValue (const TVector::const_iterator &iter, T &value) const
bool AdvanceValue (TVector::const_iterator &iter, std::string &value) const
 Below are AdvanceValue helper functions spezialiced for a type.
bool AdvanceValue (TVector::const_iterator &iter, float &value) const
bool AdvanceValue (TVector::const_iterator &iter, double &value) const
bool AdvanceValue (TVector::const_iterator &iter, int &value) const
bool AdvanceValue (TVector::const_iterator &iter, bool &value) const
bool AdvanceValue (TVector::const_iterator &iter, unsigned int &value) const
bool AdvanceValue (TVector::const_iterator &iter, salt::Vector3f &value) const
bool AdvanceValue (TVector::const_iterator &iter, salt::Vector2f &value) const

Protected Member Functions

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline bool GetVectorValue (TVector::const_iterator &iter, salt::TVector< DATATYPE, ELEMENTS, TYPE > &value) const
 This is a specialized GetValue helper to read any salt::TVector from a TParameterList.
template<typename TYPE>
f_inline bool ConvertStringValue (TVector::const_iterator &iter, TYPE &value) const
 This is a specialized GetValue helper to read a scalar value from a TParameterList.
template<typename TFrom, typename TTo>
f_inline bool GetValueInternal (TVector::const_iterator &iter, TTo &value) const
 helper that tries to any_cast the TFrom value at iter to a TTo Value, on success it returns true and advances the iterator

Protected Attributes

TVector mList


Detailed Description

list of values.

Boost::Any is used as a typesafe container to realize a sequence of values of arbitrary types.

Definition at line 38 of file parameterlist.h.


Member Typedef Documentation

typedef std::vector<boost::any> zeitgeist::ParameterList::TVector
 

Definition at line 41 of file parameterlist.h.


Constructor & Destructor Documentation

ParameterList::ParameterList  ) 
 

Definition at line 29 of file parameterlist.cpp.

Referenced by AddList().

ParameterList::~ParameterList  )  [virtual]
 

Definition at line 33 of file parameterlist.cpp.


Member Function Documentation

ParameterList & ParameterList::AddList  ) 
 

inserts an empty ParameterList as a new value at the end of the managed sequence and returns a reference to the new list.

Using AddList instead of AddValue avoids copying a list on insertion.

Definition at line 44 of file parameterlist.cpp.

References mList, and ParameterList().

Referenced by VisionPerceptor::AddSense(), RestrictedVisionPerceptor::AddSense(), RestrictedVisionPerceptor::DynamicAxisPercept(), UniversalJointPerceptor::InsertAxisAngle(), HingePerceptor::InsertAxisAngle(), Hinge2Perceptor::InsertAxisAngle(), UniversalJointPerceptor::InsertAxisRate(), HingePerceptor::InsertAxisRate(), Hinge2Perceptor::InsertAxisRate(), GameStatePerceptor::InsertInitialPercept(), GameStatePerceptor::InsertSoccerParam(), PerfectVisionPerceptor::Percept(), GameStatePerceptor::Percept(), AgentStatePerceptor::Percept(), SexpParser::SexpToList(), VisionPerceptor::StaticAxisPercept(), and RestrictedVisionPerceptor::StaticAxisPercept().

Here is the call graph for this function:

void ParameterList::AddValue const boost::any &  value  ) 
 

inserts a value at the end of the managed sequence

Definition at line 38 of file parameterlist.cpp.

References mList.

Referenced by VisionPerceptor::AddSense(), RestrictedVisionPerceptor::AddSense(), RestrictedVisionPerceptor::DynamicAxisPercept(), GameStateItem::GetInitialPredicates(), getParameterList(), GameStateItem::GetPredicates(), UniversalJointPerceptor::InsertAxisAngle(), HingePerceptor::InsertAxisAngle(), Hinge2Perceptor::InsertAxisAngle(), UniversalJointPerceptor::InsertAxisRate(), HingePerceptor::InsertAxisRate(), Hinge2Perceptor::InsertAxisRate(), GameStatePerceptor::InsertInitialPercept(), GameStatePerceptor::InsertSoccerParam(), SparkMonitorClient::ParseCustomPredicates(), PerfectVisionPerceptor::Percept(), HearPerceptor::Percept(), GameStatePerceptor::Percept(), AgentStatePerceptor::Percept(), kerosin::CCylinder::SetParams(), SexpParser::SexpToList(), VisionPerceptor::StaticAxisPercept(), and RestrictedVisionPerceptor::StaticAxisPercept().

template<typename T>
bool zeitgeist::ParameterList::AdvanceAnyValue TVector::const_iterator &  iter,
T &  value
const [inline]
 

AdvanceAnyValue is a generic templated helper function for consumers of ParameterLists.

It tries to cast the parameter at iter to a value of type T. If successful it returns true, assigns the casted parameter to value and increments the iterator iter. Otherwise false is returned and value and iter are unchanged. Note that AdvanceValue increments iter to transparently allow specialized functions for types that are represented by more than one entry in the ParameterList. An example is a three dimensional vector represented by a sequence of three floats.

Note: the AdvanceAnyValue and AdvanceValue have distinct names, as C++ does not support partly specialized template function (currently only partly specialized classes) and would always call the generic template function instead of a partly specialized variant.

Parameters:
iter position of the parameter
value extracted value of the parameter
Returns:
true if extraction successful, false otherwise

Definition at line 123 of file parameterlist.h.

Referenced by GetAnyValue().

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
salt::Vector2f value
const
 

Definition at line 271 of file parameterlist.cpp.

References GetVectorValue().

Here is the call graph for this function:

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
salt::Vector3f value
const
 

Definition at line 265 of file parameterlist.cpp.

References GetVectorValue().

Here is the call graph for this function:

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
unsigned int &  value
const
 

Definition at line 255 of file parameterlist.cpp.

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
bool &  value
const
 

Definition at line 215 of file parameterlist.cpp.

References str.

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
int &  value
const
 

Definition at line 204 of file parameterlist.cpp.

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
double &  value
const
 

Definition at line 192 of file parameterlist.cpp.

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
float &  value
const
 

Definition at line 180 of file parameterlist.cpp.

bool ParameterList::AdvanceValue TVector::const_iterator &  iter,
std::string &  value
const
 

Below are AdvanceValue helper functions spezialiced for a type.

Definition at line 137 of file parameterlist.cpp.

References str.

Referenced by SexpMonitor::AddPredicates(), oxygen::Predicate::AdvanceValue(), GetValue(), GetVectorValue(), and SoccerMonitor::ParsePlayModes().

ParameterList::TVector::iterator ParameterList::begin  ) 
 

returns an iterator pointing at the begin of the managed sequence

Definition at line 111 of file parameterlist.cpp.

References mList.

ParameterList::TVector::const_iterator ParameterList::begin  )  const
 

returns an iterator pointing at the begin of the managed sequence

Definition at line 85 of file parameterlist.cpp.

References mList.

Referenced by SexpMonitor::AddPredicates(), oxygen::Predicate::begin(), oxygen::Predicate::Iterator::begin(), and SoccerMonitor::ParsePlayModes().

void ParameterList::Clear  ) 
 

removes all elements from the managed sequence

Definition at line 63 of file parameterlist.cpp.

References mList.

Referenced by VisionPerceptor::DynamicAxisPercept(), RestrictedVisionPerceptor::DynamicAxisPercept(), PerfectVisionPerceptor::Percept(), HearPerceptor::Percept(), GameStatePerceptor::Percept(), AgentStatePerceptor::Percept(), VisionPerceptor::StaticAxisPercept(), and RestrictedVisionPerceptor::StaticAxisPercept().

template<typename TYPE>
f_inline bool zeitgeist::ParameterList::ConvertStringValue TVector::const_iterator &  iter,
TYPE &  value
const [inline, protected]
 

This is a specialized GetValue helper to read a scalar value from a TParameterList.

It tries to generate the value from a string representation

Definition at line 228 of file parameterlist.h.

References str.

ParameterList::TVector::iterator ParameterList::end  ) 
 

returns an iterator pointing at the end of the managed sequence

Definition at line 117 of file parameterlist.cpp.

References mList.

ParameterList::TVector::const_iterator ParameterList::end  )  const
 

returns an iterator pointing at the end of the managed sequence

Definition at line 91 of file parameterlist.cpp.

References mList.

Referenced by SexpMonitor::AddPredicates(), oxygen::Predicate::Iterator::end(), oxygen::Predicate::Iterator::operator++(), and SoccerMonitor::ParsePlayModes().

template<typename T>
f_inline bool zeitgeist::ParameterList::GetAnyValue const TVector::const_iterator &  iter,
T &  value
const [inline]
 

Definition at line 141 of file parameterlist.h.

References AdvanceAnyValue().

Referenced by oxygen::Predicate::GetAnyValue().

Here is the call graph for this function:

int ParameterList::GetSize  )  const
 

returns the number of values contained in the managed sequence

Definition at line 51 of file parameterlist.cpp.

References mList.

Referenced by readRGBA(), and oxygen::StdMeshImporter::UnitCCylinder().

template<typename T>
f_inline bool zeitgeist::ParameterList::GetValue const TVector::const_iterator &  iter,
T &  value
const [inline]
 

GetValue is a generic templated helper function for consumers of ParameterLists.

It has the same semantics as it's corresponding AdvanceValue except that it takes a const reference to iter that it does not increment.

Definition at line 134 of file parameterlist.h.

References AdvanceValue().

Referenced by oxygen::Predicate::GetValue(), readRGBA(), and oxygen::StdMeshImporter::UnitCCylinder().

Here is the call graph for this function:

template<typename TFrom, typename TTo>
f_inline bool zeitgeist::ParameterList::GetValueInternal TVector::const_iterator &  iter,
TTo &  value
const [inline, protected]
 

helper that tries to any_cast the TFrom value at iter to a TTo Value, on success it returns true and advances the iterator

Definition at line 263 of file parameterlist.h.

template<typename DATATYPE, int ELEMENTS, typename TYPE>
f_inline bool zeitgeist::ParameterList::GetVectorValue TVector::const_iterator &  iter,
salt::TVector< DATATYPE, ELEMENTS, TYPE > &  value
const [inline, protected]
 

This is a specialized GetValue helper to read any salt::TVector from a TParameterList.

It first tries to interprete a single element of the TParameterList as a TVector. If this fails it tries to build a vector from a sequence of values in the ParameterList. Depending on the way the Vector is built iter is incremented either by one element or the number of scalar elements that make up a vector of the given type.

Note: If GetVectorValue builds a vector from a sequence of scalars it uses the AdvanceValue function specialized for the scalar value type of that TVector. For example in the common case of a float vector this enables GetVectorValue to handle any mixture of float, int and string representation within the TParameterList.

Parameters:
iter 
value a vector extracted from a parameter list
Returns:
true if extraction successful

Definition at line 180 of file parameterlist.h.

References AdvanceValue(), and mList.

Referenced by AdvanceValue().

Here is the call graph for this function:

bool ParameterList::IsEmpty  )  const
 

returns true if the managed sequence is empty

Definition at line 57 of file parameterlist.cpp.

References mList.

ParameterList::TVector::iterator ParameterList::operator[] int  n  ) 
 

returns an iterator pointing at the nth element of the managed sequence

Definition at line 123 of file parameterlist.cpp.

References mList.

ParameterList::TVector::const_iterator ParameterList::operator[] int  n  )  const
 

returns an iterator pointing at the nth element of the managed sequence

Definition at line 97 of file parameterlist.cpp.

References mList.

void ParameterList::Pop_Back  ) 
 

removes the last element from the managed sequence

Definition at line 76 of file parameterlist.cpp.

References mList.

void ParameterList::Pop_Front  ) 
 

removes the first element from the managed sequence

Definition at line 68 of file parameterlist.cpp.

References mList.

Referenced by FUNCTION().


Member Data Documentation

TVector zeitgeist::ParameterList::mList [protected]
 

Definition at line 44 of file parameterlist.h.

Referenced by AddList(), AddValue(), begin(), Clear(), end(), GetSize(), GetVectorValue(), IsEmpty(), operator[](), Pop_Back(), and Pop_Front().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:50:57 2006 for rcssserver3d by  doxygen 1.4.4