libdap::ConstraintEvaluator Class Reference

Evaluate a constraint expression. More...

`#include <ConstraintEvaluator.h>`

## 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

## Public Member Functions

void | append_clause (bool_func func, rvalue_list *args)
| Add a clause to a constraint expression.
void | append_clause (btp_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)
BaseType * | eval_function (DDS &dds, const std::string &dataset)
| Evaluate a function-valued constraint expression.
DataDDS * | eval_function_clauses (DataDDS &dds)
| Evaluate a function-valued constraint expression that contains several function calls. Takes and returns a DataDDS.
DDS * | eval_function_clauses (DDS &dds)
| Evaluate a function-valued constraint expression that contains several function calls.
bool | eval_selection (DDS &dds, const std::string &dataset)
| Evaluate a boolean-valued constraint expression. This is main method for the evaluator and is called by the BaseType::serialize() methods.
bool | find_function (const std::string &name, bool_func *f) const
| Find a Boolean function with a given name in the function list.
bool | find_function (const std::string &name, btp_func *f) const
| Find a BaseType function with a given name in the function list.
bool | find_function (const std::string &name, proj_func *f) const
| Find a projection function with a given name in the function list.
bool | function_clauses ()
| Does the current constraint expression contain function clauses.
bool | functional_expression ()
| Does the current constraint expression return a BaseType pointer? This method does not evaluate the clause, it provides information to the evaluator regarding how to evaluate the clause.
void | parse_constraint (const std::string &constraint, DDS &dds)
| Parse the constraint expression given the current DDS.

## Friends

class | func_name_is

## Detailed Description

Evaluate a constraint expression.

Definition at line 41 of file ConstraintEvaluator.h.

## Member Typedef Documentation

## Clause_citer

typedef std::vector<Clause*>::const_iterator libdap::ConstraintEvaluator::Clause_citer

Definition at line 59 of file ConstraintEvaluator.h.

## Clause_iter

typedef std::vector<Clause*>::iterator libdap::ConstraintEvaluator::Clause_iter

Definition at line 60 of file ConstraintEvaluator.h.

## Constants_citer

typedef std::vector<BaseType*>::const_iterator libdap::ConstraintEvaluator::Constants_citer

Definition at line 62 of file ConstraintEvaluator.h.

## Constants_iter

typedef std::vector<BaseType*>::iterator libdap::ConstraintEvaluator::Constants_iter

Definition at line 63 of file ConstraintEvaluator.h.

## Constructor & Destructor Documentation

## ConstraintEvaluator()

libdap::ConstraintEvaluator::ConstraintEvaluator | ( |  | ) |

Definition at line 50 of file ConstraintEvaluator.cc.

## ~ConstraintEvaluator()

libdap::ConstraintEvaluator::~ConstraintEvaluator | ( |  | ) |

virtual

Definition at line 61 of file ConstraintEvaluator.cc.

## Member Function Documentation

## append_clause() [1/3]

void libdap::ConstraintEvaluator::append_clause | ( | bool_func | func,
|  | rvalue_list * | args )

Add a clause to a constraint expression.

This function adds a boolean function clause to the constraint expression.

Parameters

  func | A pointer to a boolean function from the list of supported functions.
  args | A list of arguments to that function.

Definition at line 119 of file ConstraintEvaluator.cc.

## append_clause() [2/3]

void libdap::ConstraintEvaluator::append_clause | ( | btp_func | func,
|  | rvalue_list * | args )

Add a clause to a constraint expression.

This function adds a real-valued (BaseType) function clause to the constraint expression.

Parameters

  func | A pointer to a BaseType function from the list of supported functions.
  args | A list of arguments to that function.

Definition at line 134 of file ConstraintEvaluator.cc.

## append_clause() [3/3]

void libdap::ConstraintEvaluator::append_clause | ( | int | op,
|  | rvalue * | arg1,
|  | rvalue_list * | arg2 )

Add a clause to a constraint expression.

This function adds an operator clause to the constraint expression.

Parameters

  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 104 of file ConstraintEvaluator.cc.

## append_constant()

void libdap::ConstraintEvaluator::append_constant | ( | BaseType * | btp | ) |

The Constraint Evaluator maintains a list of BaseType pointers for all the constants that the constraint expression parser generates. These objects are deleted by the Constraint Evaluator 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.

Definition at line 147 of file ConstraintEvaluator.cc.

## boolean_expression()

bool libdap::ConstraintEvaluator::boolean_expression | ( |  | ) |

Does the current constraint expression return a boolean value?

Definition at line 281 of file ConstraintEvaluator.cc.

## clause_begin()

ConstraintEvaluator::Clause_iter libdap::ConstraintEvaluator::clause_begin | ( |  | ) |

Returns the first clause in a parsed constraint expression.

Definition at line 77 of file ConstraintEvaluator.cc.

## clause_end()

ConstraintEvaluator::Clause_iter libdap::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 81 of file ConstraintEvaluator.cc.

## clause_value()

bool libdap::ConstraintEvaluator::clause_value | ( | Clause_iter & | iter,
|  | DDS & | dds )

Returns the value of the indicated clause of a constraint expression.

Definition at line 85 of file ConstraintEvaluator.cc.

## eval_function()

BaseType * libdap::ConstraintEvaluator::eval_function | ( | DDS & | dds,
|  | const std::string & | dataset )

Evaluate a function-valued constraint expression.

Deprecated

Definition at line 184 of file ConstraintEvaluator.cc.

## eval_function_clauses() [1/2]

DataDDS * libdap::ConstraintEvaluator::eval_function_clauses | ( | DataDDS & | dds | ) |

Evaluate a function-valued constraint expression that contains several function calls. Takes and returns a DataDDS.

See also
  ConstraintEvaluator::eval_function_clauses(DataDDS &dds)

Note
  Added for libdap 3.11

Definition at line 259 of file ConstraintEvaluator.cc.

## eval_function_clauses() [2/2]

DDS * libdap::ConstraintEvaluator::eval_function_clauses | ( | DDS & | dds | ) |

Evaluate a function-valued constraint expression that contains several function calls.

This method can be called for any function-valued constraint expression. Unlike eval_function(), it will package the return value in a new DDS object. The server should free this object once it has been serialized and sent.

Note
  While there is another type of function that can appear in a CE (a 'projection function') those are evaluated by the ce parser - they are used to insert new variables into the DDS as a side effect of CE evaluation. That kind of function can never appear here; these are all functions that return BaseType pointers.
  Added for libdap 3.11

Definition at line 233 of file ConstraintEvaluator.cc.

## eval_selection()

bool libdap::ConstraintEvaluator::eval_selection | ( | DDS & | dds,
|  | const std::string & | dataset )

Evaluate a boolean-valued constraint expression. This is main method for the evaluator and is called by the BaseType::serialize() methods.

Parameters

  dds | Use these variables when evaluating the expressions.
  dataset | This string is passed to the read() methods.

Returns
  True if the expression is true, false otherwise.

Definition at line 300 of file ConstraintEvaluator.cc.

## find_function() [1/3]

bool libdap::ConstraintEvaluator::find_function | ( | const std::string & | name,
|  | bool_func * | f ) const

Find a Boolean function with a given name in the function list.

Definition at line 150 of file ConstraintEvaluator.cc.

## find_function() [2/3]

bool libdap::ConstraintEvaluator::find_function | ( | const std::string & | name,
|  | btp_func * | f ) const

Find a BaseType function with a given name in the function list.

Definition at line 155 of file ConstraintEvaluator.cc.

## find_function() [3/3]

bool libdap::ConstraintEvaluator::find_function | ( | const std::string & | name,
|  | proj_func * | f ) const

Find a projection function with a given name in the function list.

Definition at line 160 of file ConstraintEvaluator.cc.

## function_clauses()

bool libdap::ConstraintEvaluator::function_clauses | ( |  | ) |

Does the current constraint expression contain function clauses.

This method does not evaluate the clauses, it provides information to the evaluator regarding how to evaluate the clause.

Note
  Added for libdap 3.11

Returns
  True if the current constraint contains function clauses, otherwise returns False

Definition at line 205 of file ConstraintEvaluator.cc.

## functional_expression()

bool libdap::ConstraintEvaluator::functional_expression | ( |  | ) |

Does the current constraint expression return a BaseType pointer? This method does not evaluate the clause, it provides information to the evaluator regarding how to evaluate the clause.

Returns
  True if the clause is a function that returns a BaseType* and false otherwise

Deprecated

Definition at line 173 of file ConstraintEvaluator.cc.

## parse_constraint()

void libdap::ConstraintEvaluator::parse_constraint | ( | const std::string & | constraint,
|  | DDS & | dds )

Parse the constraint expression given the current 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.

Parameters

  constraint | A string containing the constraint expression.
  dds | The DDS that provides the environment within which the constraint is evaluated.

Exceptions

  Throws | Error if the constraint does not parse.

Definition at line 333 of file ConstraintEvaluator.cc.

## Friends And Related Symbol Documentation

## func_name_is

friend class func_name_is

friend

Definition at line 56 of file ConstraintEvaluator.h.

The documentation for this class was generated from the following files:

- ConstraintEvaluator.h
- ConstraintEvaluator.cc