39 struct yy_buffer_state;
67 for (
Constants_iter j = constants.begin(); j != constants.end(); j++) {
73 for (
Clause_iter k = expr.begin(); k != expr.end(); k++) {
98 throw InternalErr(__FILE__, __LINE__,
"There are no CE clauses for *this* DDS object.");
100 return (*iter)->value(dds);
119 expr.push_back(clause);
135 expr.push_back(clause);
151 expr.push_back(clause);
163 constants.push_back(btp);
208 if (expr.size() != 1)
209 throw InternalErr(__FILE__, __LINE__,
"The length of the list of CE clauses is not 1.");
213 if (cp->
value(dds, &result))
233 for (
unsigned int i = 0; i < expr.size(); ++i) {
261 throw InternalErr(__FILE__, __LINE__,
"The constraint expression is empty.");
264 for (
unsigned int i = 0; i < expr.size(); ++i) {
267 if (cp->
value(dds, &result)) {
274 throw Error(
"A function was called but failed to return a value.");
290 throw InternalErr(__FILE__, __LINE__,
"The constraint expression is empty.");
295 for (
unsigned int i = 0; i < expr.size(); ++i) {
298 if (cp->
value(dds, &result)) {
303 throw Error(
"A function was called but failed to return a value.");
317 for (
Clause_iter i = expr.begin(); i != expr.end(); i++) {
318 boolean =
boolean && (*i)->boolean_clause();
334 DBG(cerr <<
"No selection recorded" << endl);
338 DBG(cerr <<
"Eval selection" << endl);
345 for (
Clause_iter i = expr.begin(); i != expr.end() && result; i++) {
347 if (!((*i)->boolean_clause()))
348 throw InternalErr(__FILE__, __LINE__,
"A selection expression must contain only boolean clauses.");
349 result = result && (*i)->value(dds);
virtual ~ConstraintEvaluator()
void ce_expr_delete_buffer(void *buffer)
static ServerFunctionsList * TheList()
std::vector< rvalue * > rvalue_list
virtual bool find_function(const std::string &name, bool_func *f) const
Find a boolean function with a given name in the function list.
bool boolean_expression()
Does the current constraint expression return a boolean value?
void add_var_nocopy(BaseType *bt)
Adds the variable to the DDS.
void * ce_expr_string(const char *yy_str)
BaseType * eval_function(DDS &dds, const std::string &dataset)
Evaluate a function-valued constraint expression.
A class for software fault reporting.
bool value(DDS &dds)
Evaluate a clause which returns a boolean value This method must only be evaluated for clauses with r...
DDS * eval_function_clauses(DDS &dds)
Evaluate a function-valued constraint expression that contains several function calls.
void ce_expr_switch_to_buffer(void *new_buffer)
string get_version() const
Get the server version string, unparsed.
void parse_constraint(const std::string &constraint, DDS &dds)
Parse the constraint expression given the current DDS.
std::vector< BaseType * >::iterator Constants_iter
BaseTypeFactory * get_factory() const
bool functional_expression()
Does the current constraint expression return a BaseType pointer? This method does not evaluate the c...
Clause_iter clause_begin()
The basic data type for the DODS DAP types.
void append_constant(BaseType *btp)
bool clause_value(Clause_iter &i, DDS &dds)
string get_protocol() const
bool eval_selection(DDS &dds, const std::string &dataset)
Evaluate a boolean-valued constraint expression. This is main method for the evaluator ans is called ...
Holds a fragment of a constraint expression.
bool function_clauses()
Does the current constraint expression contain function clauses.
A class for error processing.
string get_dataset_name() const
bool value_clause()
Return true if the clause returns a value in a BaseType pointer.
std::vector< Clause * >::iterator Clause_iter
int ce_exprparse(libdap::ce_parser_arg *arg)
void append_clause(int op, rvalue *arg1, rvalue_list *arg2)
Add a clause to a constraint expression.
bool find_function(const std::string &name, bool_func *f) const