#include <ConstraintEvaluator.h>
Collaboration diagram for ConstraintEvaluator:
Public Types | |
typedef std::vector< Clause * >::const_iterator | Clause_citer |
typedef std::vector< Clause * >::iterator | Clause_iter |
typedef std::vector< BaseType * >::const_iterator | Constants_citer |
typedef std::vector< BaseType * >::iterator | Constants_iter |
typedef std::list< function >::const_iterator | Functions_citer |
typedef std::list< function >::iterator | Functions_iter |
Public Member Functions | |
void | append_clause (btp_func func, rvalue_list *args) |
Add a clause to a constraint expression. | |
void | append_clause (bool_func func, rvalue_list *args) |
Add a clause to a constraint expression. | |
void | append_clause (int op, rvalue *arg1, rvalue_list *arg2) |
Add a clause to a constraint expression. | |
void | append_constant (BaseType *btp) |
bool | boolean_expression () |
Does the current constraint expression return a boolean value? | |
Clause_iter | clause_begin () |
Clause_iter | clause_end () |
bool | clause_value (Clause_iter &i, DDS &dds, const string &dataset) |
ConstraintEvaluator () | |
BaseType * | eval_function (DDS &dds, const string &dataset) |
Evaluate a function-valued constraint expression. | |
bool | eval_selection (DDS &dds, const string &dataset) |
Evaluate a boolean-valued constraint expression. This is main method for the evaluator ans is called by the BaseType::serialize() methods. | |
bool | functional_expression () |
Does the current constraint expression return a BaseType pointer? | |
void | parse_constraint (const string &constraint, DDS &dds) |
Parse the constraint expression given the current DDS. | |
virtual | ~ConstraintEvaluator () |
External Function Accessors | |
The Constraint Evaluator carries with it a list of external functions it can use while evaluate a constraint expression. If a constraint contains any of these functions, the entries in the list allow the parser to evaluate it. The functions are of three types: those that return boolean values, those that return real (also called BaseType) values, and those that are applied during evaluation of the project for side effect
| |
void | add_function (const string &name, proj_func f) |
Add a projection function to the list. | |
void | add_function (const string &name, btp_func f) |
Add a BaseType function to the list. | |
void | add_function (const string &name, bool_func f) |
Add a boolean function to the list. | |
bool | find_function (const string &name, proj_func *f) const |
Find a projection function with a given name in the function list. | |
bool | find_function (const string &name, btp_func *f) const |
Find a BaseType function with a given name in the function list. | |
bool | find_function (const string &name, bool_func *f) const |
Find a Boolean function with a given name in the function list. | |
Friends | |
class | func_name_is |
Classes | |
struct | function |
Definition at line 35 of file ConstraintEvaluator.h.
typedef std::vector<Clause *>::const_iterator ConstraintEvaluator::Clause_citer |
Definition at line 79 of file ConstraintEvaluator.h.
typedef std::vector<Clause *>::iterator ConstraintEvaluator::Clause_iter |
Definition at line 80 of file ConstraintEvaluator.h.
typedef std::vector<BaseType *>::const_iterator ConstraintEvaluator::Constants_citer |
Definition at line 82 of file ConstraintEvaluator.h.
typedef std::vector<BaseType *>::iterator ConstraintEvaluator::Constants_iter |
Definition at line 83 of file ConstraintEvaluator.h.
typedef std::list<function>::const_iterator ConstraintEvaluator::Functions_citer |
Definition at line 85 of file ConstraintEvaluator.h.
typedef std::list<function>::iterator ConstraintEvaluator::Functions_iter |
Definition at line 86 of file ConstraintEvaluator.h.
ConstraintEvaluator::ConstraintEvaluator | ( | ) |
Definition at line 49 of file ConstraintEvaluator.cc.
References libdap::register_functions().
Here is the call graph for this function:
ConstraintEvaluator::~ConstraintEvaluator | ( | ) | [virtual] |
Definition at line 54 of file ConstraintEvaluator.cc.
void ConstraintEvaluator::add_function | ( | const string & | name, | |
proj_func | f | |||
) |
void ConstraintEvaluator::add_function | ( | const string & | name, | |
btp_func | f | |||
) |
void ConstraintEvaluator::add_function | ( | const string & | name, | |
bool_func | f | |||
) |
Definition at line 199 of file ConstraintEvaluator.cc.
References func_name_is.
Referenced by libdap::register_functions().
void ConstraintEvaluator::append_clause | ( | btp_func | func, | |
rvalue_list * | args | |||
) |
This function adds a real-valued (BaseType) function clause to the constraint expression.
func | A pointer to a BaseType function from the list of supported functions. | |
args | A list of arguments to that function. |
Definition at line 143 of file ConstraintEvaluator.cc.
void ConstraintEvaluator::append_clause | ( | bool_func | func, | |
rvalue_list * | args | |||
) |
This function adds a boolean function clause to the constraint expression.
func | A pointer to a boolean function from the list of supported functions. | |
args | A list of arguments to that function. |
Definition at line 126 of file ConstraintEvaluator.cc.
void ConstraintEvaluator::append_clause | ( | int | op, | |
rvalue * | arg1, | |||
rvalue_list * | arg2 | |||
) |
This function adds an operator clause to the constraint expression.
op | An integer indicating the operator in use. These values are generated by bison . | |
arg1 | A pointer to the argument on the left side of the operator. | |
arg2 | A pointer to a list of the arguments on the right side of the operator. |
Definition at line 109 of file ConstraintEvaluator.cc.
void ConstraintEvaluator::append_constant | ( | BaseType * | btp | ) |
The DDS maintains a list of BaseType pointers for all the constants that the constraint expression parser generates. These objects are deleted by the DDS destructor. Note that there are no list accessors; these constants are never accessed from the list. The list is simply a convenient way to make sure the constants are disposed of properly.
the constraint expression parser.
Definition at line 158 of file ConstraintEvaluator.cc.
bool ConstraintEvaluator::boolean_expression | ( | ) |
Definition at line 302 of file ConstraintEvaluator.cc.
ConstraintEvaluator::Clause_iter ConstraintEvaluator::clause_begin | ( | ) |
Returns the first clause in a parsed constraint expression.
Definition at line 70 of file ConstraintEvaluator.cc.
ConstraintEvaluator::Clause_iter ConstraintEvaluator::clause_end | ( | ) |
Returns a reference to the end of the list of clauses in a parsed constraint expression. It does not reference the last clause
Definition at line 78 of file ConstraintEvaluator.cc.
bool ConstraintEvaluator::clause_value | ( | Clause_iter & | iter, | |
DDS & | dds, | |||
const string & | dataset | |||
) |
Returns the value of the indicated clause of a constraint expression.
Definition at line 86 of file ConstraintEvaluator.cc.
Definition at line 286 of file ConstraintEvaluator.cc.
References Clause::value().
Referenced by DODSFilter::send_data().
Here is the call graph for this function:
bool ConstraintEvaluator::eval_selection | ( | DDS & | dds, | |
const string & | dataset | |||
) |
dds | Use these variables when evaluating the expressions. | |
dataset | This string is passed to the read() methods. |
Definition at line 324 of file ConstraintEvaluator.cc.
References DBG.
Referenced by Sequence::read_row(), Vector::serialize(), UInt32::serialize(), UInt16::serialize(), Structure::serialize(), Str::serialize(), Int32::serialize(), Int16::serialize(), Grid::serialize(), Float64::serialize(), Float32::serialize(), and Byte::serialize().
bool ConstraintEvaluator::find_function | ( | const string & | name, | |
proj_func * | f | |||
) | const |
Definition at line 258 of file ConstraintEvaluator.cc.
bool ConstraintEvaluator::find_function | ( | const string & | name, | |
btp_func * | f | |||
) | const |
Definition at line 242 of file ConstraintEvaluator.cc.
bool ConstraintEvaluator::find_function | ( | const string & | name, | |
bool_func * | f | |||
) | const |
Definition at line 226 of file ConstraintEvaluator.cc.
bool ConstraintEvaluator::functional_expression | ( | ) |
Definition at line 275 of file ConstraintEvaluator.cc.
References Clause::value_clause().
Referenced by DODSFilter::send_data(), and DODSFilter::send_dds().
Here is the call graph for this function:
void ConstraintEvaluator::parse_constraint | ( | const string & | constraint, | |
DDS & | dds | |||
) |
Evaluate the constraint expression; return the value of the expression. As a side effect, mark the DDS so that BaseType's mfuncs can be used to correctly read the variable's value and send it to the client.
constraint | A string containing the constraint expression. | |
dds | The DDS that provides the environment within which the constraint is evaluated. |
Throws | Error if the constraint does not parse. |
Definition at line 360 of file ConstraintEvaluator.cc.
References ce_expr_delete_buffer(), ce_expr_string(), ce_expr_switch_to_buffer(), and ce_exprparse().
Referenced by DODSFilter::send_data(), DODSFilter::send_dds(), and DODSFilter::send_ddx().
Here is the call graph for this function:
friend class func_name_is [friend] |