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

oxygen::Predicate Class Reference

assemble a string representing a given list of predicates. More...

#include <predicate.h>

Collaboration diagram for oxygen::Predicate:

Collaboration graph
[legend]
List of all members.

Public Member Functions

const Iterator begin () const
bool FindParameter (Iterator &iter, const std::string &name) const
 find a parameter with a given name.
template<typename T>
f_inline bool GetValue (const Iterator &iter, const std::string &name, T &value) const
 finds and returns the first value of a parameter with a given name.
template<typename T>
f_inline bool AdvanceValue (Iterator &iter, const std::string &name, T &value) const
 finds and returns the first value of a parameter with a given name.
template<typename T>
f_inline bool AdvanceValue (Iterator &iter, T &value) const
 AdvanceValue tries to cast the parameter at iter to a value of type T.
template<typename T>
f_inline bool GetValue (const Iterator &iter, T &value) const
 GetValue has the same semantics as AdvanceValue except that it takes a const reference to iter that it does not increment.
template<typename T>
f_inline bool GetAnyValue (const Iterator &iter, T &value) const
bool DescentList (Iterator &iter) const
 tries to inteprete the value iter points to as a ParameterList and points iter to it's first element.

Public Attributes

std::string name
 the name of this predicate
zeitgeist::ParameterList parameter
 the list of parameter values

Static Protected Attributes

static const zeitgeist::ParameterList nullParamList
 The null element for Predicate::Iterator.

Classes

class  Iterator
 ParameterList::TVectr::const_iterator together with a reference to the ParameterList the iterator belongs to. More...

Detailed Description

assemble a string representing a given list of predicates.

It is used as an internal representation for commands issued by agents and is interpreted by Effector classes. A BaseParser object is responsible to translate the received agent commands into a list of Predicates. An Effector is therefore independent from the command format used between an agent and the simulator.

Predicates are further used to collect sensor data from the agents perceptors. A BaseParser is then used to translate these percepts into the format used to describe them to the corresponding agent. Again, the Perceptor is independent from the format used to transmit its data to the agent.

Definition at line 49 of file predicate.h.


Member Function Documentation

template<typename T>
f_inline bool oxygen::Predicate::AdvanceValue Iterator iter,
T &  value
const [inline]
 

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

Definition at line 201 of file predicate.h.

References zeitgeist::ParameterList::AdvanceValue(), oxygen::Predicate::Iterator::GetIterator(), and oxygen::Predicate::Iterator::GetList().

Here is the call graph for this function:

template<typename T>
f_inline bool oxygen::Predicate::AdvanceValue Iterator iter,
const std::string &  name,
T &  value
const [inline]
 

finds and returns the first value of a parameter with a given name.

On success value contains the first parameter value and iter points to the second parameter value

Definition at line 185 of file predicate.h.

References FindParameter().

Referenced by UniversalJointEffector::GetActionObject(), SayEffector::GetActionObject(), PanTiltEffector::GetActionObject(), KickEffector::GetActionObject(), HingeEffector::GetActionObject(), Hinge2Effector::GetActionObject(), and GetValue().

Here is the call graph for this function:

const Iterator oxygen::Predicate::begin  )  const [inline]
 

Definition at line 126 of file predicate.h.

References zeitgeist::ParameterList::begin(), and parameter.

Referenced by UniversalJointEffector::GetActionObject(), SceneEffector::GetActionObject(), SayEffector::GetActionObject(), PanTiltEffector::GetActionObject(), KickEffector::GetActionObject(), InitEffector::GetActionObject(), HingeEffector::GetActionObject(), Hinge2Effector::GetActionObject(), ForceEffector::GetActionObject(), DriveEffector::GetActionObject(), and BeamEffector::GetActionObject().

Here is the call graph for this function:

bool Predicate::DescentList Iterator iter  )  const
 

tries to inteprete the value iter points to as a ParameterList and points iter to it's first element.

Returns true on success

Definition at line 166 of file predicate.cpp.

References oxygen::Predicate::Iterator::GetIterator().

Here is the call graph for this function:

bool oxygen::Predicate::FindParameter Iterator iter,
const std::string &  name
const
 

find a parameter with a given name.

For this method, we assume that parameters are represented by lists consisting of a name (a string) and (a number of) values. An example for the predicate init: init.name = "init"; init.parameter = [["teamname", "RoboLog"], ["unum", 1]];

The part after init is the list of parameters. To extract the teamname, do something like Predicate::iterator iter(myPredicate); if (FindParameter(iter, "teamname")) { GetValue(iter,name); }

Parameters:
iter on success, iter will point to the first value of the parameter you are looking for. It will be unchanged otherwise.
name Name of the parameter to find.
Returns:
true if parameter name was found.

Referenced by AdvanceValue(), TrainerCommandParser::ParseBallCommand(), and TrainerCommandParser::ParsePlayerCommand().

template<typename T>
f_inline bool oxygen::Predicate::GetAnyValue const Iterator iter,
T &  value
const [inline]
 

Definition at line 216 of file predicate.h.

References zeitgeist::ParameterList::GetAnyValue(), oxygen::Predicate::Iterator::GetIterator(), and oxygen::Predicate::Iterator::GetList().

Here is the call graph for this function:

template<typename T>
f_inline bool oxygen::Predicate::GetValue const Iterator iter,
T &  value
const [inline]
 

GetValue has the same semantics as AdvanceValue except that it takes a const reference to iter that it does not increment.

Definition at line 210 of file predicate.h.

References oxygen::Predicate::Iterator::GetIterator(), oxygen::Predicate::Iterator::GetList(), and zeitgeist::ParameterList::GetValue().

Here is the call graph for this function:

template<typename T>
f_inline bool oxygen::Predicate::GetValue const Iterator iter,
const std::string &  name,
T &  value
const [inline]
 

finds and returns the first value of a parameter with a given name.

This method tries to cover the most common use case of a ParameterList. It assumes that the parameters are a set lists consisting of name value pairs, e.g. for the predicate init

init.name = "init"; init.parameter = [["teamname", "RoboLog"], ["unum", 1]];

For parameter entries with more than one value per parameter use the generic FindParameter/GetValue functions.

Parameters:
name Name of the parameter to find.
value reference to the value that will receive the parameter value on success
Returns:
true if parameter name was found.

Definition at line 174 of file predicate.h.

References AdvanceValue().

Referenced by SceneEffector::GetActionObject(), InitEffector::GetActionObject(), ForceEffector::GetActionObject(), DriveEffector::GetActionObject(), BeamEffector::GetActionObject(), TrainerCommandParser::ParseBallCommand(), TrainerCommandParser::ParseKickOffCommand(), TrainerCommandParser::ParsePlayerCommand(), and TrainerCommandParser::ParsePlayModeCommand().

Here is the call graph for this function:


Member Data Documentation

std::string oxygen::Predicate::name
 

the name of this predicate

Definition at line 228 of file predicate.h.

Referenced by SexpMonitor::AddPredicates(), VisionPerceptor::DynamicAxisPercept(), RestrictedVisionPerceptor::DynamicAxisPercept(), UniversalJointEffector::GetActionObject(), SceneEffector::GetActionObject(), SayEffector::GetActionObject(), PanTiltEffector::GetActionObject(), KickEffector::GetActionObject(), InitEffector::GetActionObject(), HingeEffector::GetActionObject(), Hinge2Effector::GetActionObject(), ForceEffector::GetActionObject(), DriveEffector::GetActionObject(), CreateEffector::GetActionObject(), CatchEffector::GetActionObject(), BeamEffector::GetActionObject(), GameStateItem::GetInitialPredicates(), GameStateItem::GetPredicates(), SparkMonitorClient::ParseCustomPredicates(), TrainerCommandParser::ParsePredicate(), SoccerMonitor::ParsePredicates(), PerfectVisionPerceptor::Percept(), HearPerceptor::Percept(), GameStatePerceptor::Percept(), AgentStatePerceptor::Percept(), VisionPerceptor::StaticAxisPercept(), and RestrictedVisionPerceptor::StaticAxisPercept().

const zeitgeist::ParameterList Predicate::nullParamList [static, protected]
 

The null element for Predicate::Iterator.

Definition at line 234 of file predicate.h.

zeitgeist::ParameterList oxygen::Predicate::parameter
 

the list of parameter values

Definition at line 231 of file predicate.h.

Referenced by SexpMonitor::AddPredicates(), VisionPerceptor::AddSense(), RestrictedVisionPerceptor::AddSense(), begin(), VisionPerceptor::DynamicAxisPercept(), RestrictedVisionPerceptor::DynamicAxisPercept(), GameStateItem::GetInitialPredicates(), GameStateItem::GetPredicates(), UniversalJointPerceptor::InsertAxisAngle(), HingePerceptor::InsertAxisAngle(), Hinge2Perceptor::InsertAxisAngle(), UniversalJointPerceptor::InsertAxisRate(), HingePerceptor::InsertAxisRate(), Hinge2Perceptor::InsertAxisRate(), GameStatePerceptor::InsertInitialPercept(), GameStatePerceptor::InsertSoccerParam(), SparkMonitorClient::ParseCustomPredicates(), SoccerMonitor::ParsePlayModes(), PerfectVisionPerceptor::Percept(), HearPerceptor::Percept(), GameStatePerceptor::Percept(), AgentStatePerceptor::Percept(), VisionPerceptor::StaticAxisPercept(), and RestrictedVisionPerceptor::StaticAxisPercept().


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