#include <predicate.h>
Public Member Functions | |
std::string | getName () |
Gets the name of this Predicate. | |
bool | getValue () |
Gets the value of this Predicate. | |
Predicate (const std::string &name, const Dependencies &deps, bool initial_value=false) | |
Predicate (const std::string &name, bool initial_value=false) | |
std::string | setName (const std::string &new_name) |
Sets the name of this Predicate. | |
void | setTrigger (const boost::function< void(bool) > trigger) |
Protected Member Functions | |
void | setValue (bool val) |
Sets the value of this Predicate. Should be called from within update(). | |
Private Attributes | |
std::string | name_ |
uint8_t | requested_updates_ |
The logical value of this Predicate;. | |
boost::function< void(bool) > | trigger_ |
bool | value_ |
The name of this Predicate;. |
The Predicate class is a base class for logical predicates. A "Predicate" is an object with an associated truth value that can depend on arbitrary sources of information. This base class provides functionalities to ease the definition of predicates and their interface with the PredicateManager class.
Definition at line 47 of file predicate.h.
predicate_manager::Predicate::Predicate | ( | const std::string & | name, |
const Dependencies & | deps, | ||
bool | initial_value = false |
||
) |
Predicate constructor.
name | The name of this Predicate. |
deps | The Dependencies of this Predicate (e.g. a set of names of other Predicates that may influence its value). |
initial_value | The initial value of this predicate. It may be overridden according to its dependencies. |
predicate_manager::Predicate::Predicate | ( | const std::string & | name, |
bool | initial_value = false |
||
) |
std::string Predicate::getName | ( | ) |
Gets the name of this Predicate.
Definition at line 84 of file predicate.cpp.
bool Predicate::getValue | ( | ) |
Gets the value of this Predicate.
Definition at line 89 of file predicate.cpp.
std::string Predicate::setName | ( | const std::string & | new_name | ) |
Sets the name of this Predicate.
Definition at line 94 of file predicate.cpp.
void Predicate::setTrigger | ( | const boost::function< void(bool) > | trigger | ) |
Sets the trigger function for this Predicate. The trigger function is called whenever the Predicate changes its value (this is used by the PredicateManager).
Definition at line 99 of file predicate.cpp.
void Predicate::setValue | ( | bool | val | ) | [protected] |
Sets the value of this Predicate. Should be called from within update().
hands over control to PM, so the dependents can be updated.
Definition at line 56 of file predicate.cpp.
std::string predicate_manager::Predicate::name_ [private] |
Definition at line 89 of file predicate.h.
uint8_t predicate_manager::Predicate::requested_updates_ [private] |
The logical value of this Predicate;.
The number of times that this Predicate's setValue() function has been recursively called. If it exceeds a given threshold (MAX_CYCLIC_UPDATES), the Predicate is considered to be in a livelock.
Definition at line 96 of file predicate.h.
boost::function<void ( bool ) > predicate_manager::Predicate::trigger_ [private] |
bool predicate_manager::Predicate::value_ [private] |
The name of this Predicate;.
Definition at line 90 of file predicate.h.