BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
BALL::Expression Class Reference

#include <BALL/KERNEL/expression.h>

List of all members.

Public Types

Type Definitions
typedef void *(* CreationMethod )()

Public Member Functions

Constructors and Destructor
 Expression ()
 Expression (const Expression &expression)
 Expression (const String &expression_string)
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)
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)
void registerStandardPredicates_ ()

Protected Attributes

StringHashMap< CreationMethod > create_methods_
ExpressionTree * expression_tree_
String expression_string_

Detailed Description

Expression class. This class provides a frontend to ExpressionTree.

Expressions may be built from the following modules:
AND & a conjunction
OR & a disjunction
predicate(argument) & a predicate class that is derived from {ExpressionPredicate) and provides operator () (const Atom& atom) const.
Additionally brackets can be used for grouping. At least one bracket pair must exist which encloses the argument of a predicate. Empty arguments are allowed.
See also:
ExpressionTree

Definition at line 36 of file expression.h.


Member Typedef Documentation

A creation method for predicates.

Definition at line 48 of file expression.h.


Constructor & Destructor Documentation

Default Constructor.

BALL::Expression::Expression ( const Expression &  expression)

Copy Constructor.

BALL::Expression::Expression ( const String &  expression_string)

Construct an Expression with a string

Exceptions:
Exception::ParseErrorif a syntax error was encountered
virtual BALL::Expression::~Expression ( ) [virtual]

Destructor.


Member Function Documentation

virtual void BALL::Expression::clear ( ) [virtual]

Clear method

Get the creation methods.

Get the expression string.

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.

Parameters:
namethe name of the predicate
argsthe optional argument of the predicate
bool BALL::Expression::hasPredicate ( const String &  name) const
virtual bool BALL::Expression::operator() ( const Atom &  atom) const [virtual]

Evaluate the expression of atom

Parameters:
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::setExpression ( const String &  expression)

Set the expression and build a tree for it.

Exceptions:
Exception::ParseErrorif a syntax error was encountered

Member Data Documentation

Definition at line 162 of file expression.h.

Definition at line 171 of file expression.h.

Definition at line 167 of file expression.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines