BALL 1.5.0
Loading...
Searching...
No Matches
expression.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_KERNEL_EXPRESSION_H
6#define BALL_KERNEL_EXPRESSION_H
7
8#ifndef BALL_DATATYPE_STRINGHASHMAP_H
10#endif
11
12#ifndef BALL_KERNEL_EXPRESSIONPARSER_H
14#endif
15
16namespace BALL
17{
18 class Atom;
19 class ExpressionTree;
20
80 {
81 public:
82
84
85
88
89
91 typedef void * (*CreationMethod) ();
92
94
97
101
104 Expression(const Expression& expression);
105
109 Expression(const String& expression_string);
110
113 virtual ~Expression();
114
116
119
122 bool hasPredicate(const String& name) const;
123
126 bool operator == (const Expression& expression) const;
127
129
132
136 virtual bool operator () (const Atom& atom) const;
137
143 ExpressionPredicate* getPredicate(const String& name,
144 const String& args = "") const;
145
148 void registerPredicate(const String& name, CreationMethod creation_method);
149
153 void setExpression(const String& expression);
154
157 const String& getExpressionString() const;
158
161 const ExpressionTree* getExpressionTree() const;
162
165 const StringHashMap<CreationMethod>& getCreationMethods() const;
166
168
171
174 Expression& operator = (const Expression& expression);
175
178 virtual void clear();
179
181
182 protected:
183
184 /*_ @name Protected methods
185 */
187
188 /*_ Construct the expression tree from the SyntaxTree
189 * @throw Exception::ParseError if a syntax error was encountered
190 */
191 ExpressionTree* constructExpressionTree_(const ExpressionParser::SyntaxTree& tree);
192
193 /*_ Register the predicates defined by default.
194 See also: BALL/KERNEL/standardPredicates.h
195 */
196 void registerStandardPredicates_();
197
199 /*_ @name Protected attributes
200 */
202
203 /*_ The methods to create the ExpressionPredicate instances
204 */
205 StringHashMap<CreationMethod> create_methods_;
206
207 /*_ The ExpressionTree constructed from the string.
208 This tree contains the instances of the predicates.
209 */
210 ExpressionTree* expression_tree_;
211
212 /*_ The string describing the expression.
213 */
214 String expression_string_;
215
217 };
218}
219
220#endif // BALL_KERNEL_EXPRESSION_H
221
#define BALL_CREATE(name)
Definition create.h:62
char Atom[5]
Definition PDBdefs.h:257
#define BALL_EXPORT