#include <BALL/KERNEL/expression.h>
Public Types | |
Type Definitions | |
typedef void *(* | CreationMethod )() |
Public Member Functions | |
Constructors and Destructor | |
Expression () | |
Expression (const Expression &expression) | |
Expression (const String &expression_string) throw (Exception::ParseError) | |
virtual | ~Expression () |
Predicates | |
bool | hasPredicate (const String &name) const |
bool | operator== (const Expression &expression) const |
Accessors | |
virtual bool | operator() (const Atom &atom) const |
ExpressionPredicate * | getPredicate (const String &name, const String &args="") const |
void | registerPredicate (const String &name, CreationMethod creation_method) |
void | setExpression (const String &expression) throw (Exception::ParseError) |
const String & | getExpressionString () const |
const ExpressionTree * | getExpressionTree () const |
const StringHashMap < CreationMethod > & | getCreationMethods () const |
Assignment | |
Expression & | operator= (const Expression &expression) |
virtual void | clear () |
Protected Member Functions | |
ExpressionTree * | constructExpressionTree_ (const ExpressionParser::SyntaxTree &tree) throw (Exception::ParseError) |
void | registerStandardPredicates_ () |
Protected Attributes | |
StringHashMap< CreationMethod > | create_methods_ |
ExpressionTree * | expression_tree_ |
String | expression_string_ |
Expression class. This class provides a frontend to ExpressionTree.
operator () (const Atom& atom) const
. typedef void*(* BALL::Expression::CreationMethod)() |
A creation method for predicates.
BALL::Expression::Expression | ( | ) |
Default Constructor.
BALL::Expression::Expression | ( | const Expression & | expression | ) |
Copy Constructor.
BALL::Expression::Expression | ( | const String & | expression_string | ) | throw (Exception::ParseError) |
Construct an Expression with a string
virtual BALL::Expression::~Expression | ( | ) | [virtual] |
Destructor.
virtual void BALL::Expression::clear | ( | ) | [virtual] |
Clear method
ExpressionTree* BALL::Expression::constructExpressionTree_ | ( | const ExpressionParser::SyntaxTree & | tree | ) | throw (Exception::ParseError) [protected] |
const StringHashMap<CreationMethod>& BALL::Expression::getCreationMethods | ( | ) | const |
Get the creation methods.
const String& BALL::Expression::getExpressionString | ( | ) | const |
Get the expression string.
const ExpressionTree* BALL::Expression::getExpressionTree | ( | ) | const |
Get the expression tree.
ExpressionPredicate* BALL::Expression::getPredicate | ( | const String & | name, | |
const String & | args = "" | |||
) | const |
Create a new predicate according to the name. If the predicate is not known, return 0.
name | the name of the predicate | |
args | the optional argument of the predicate |
Evaluate the expression of atom
atom |
Expression& BALL::Expression::operator= | ( | const Expression & | expression | ) |
Assignment operator
bool BALL::Expression::operator== | ( | const Expression & | expression | ) | const |
Equality operator
void BALL::Expression::registerPredicate | ( | const String & | name, | |
CreationMethod | creation_method | |||
) |
Register a new predicate class.
void BALL::Expression::registerStandardPredicates_ | ( | ) | [protected] |
void BALL::Expression::setExpression | ( | const String & | expression | ) | throw (Exception::ParseError) |
Set the expression and build a tree for it.
StringHashMap<CreationMethod> BALL::Expression::create_methods_ [protected] |
String BALL::Expression::expression_string_ [protected] |
ExpressionTree* BALL::Expression::expression_tree_ [protected] |