libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
libdap::D4FilterClause Class Reference

DAP4 filter clauses. More...

#include <D4FilterClause.h>

Public Types

enum  ops {
  null = 0, less = SCAN_LESS, greater = SCAN_GREATER, less_equal = SCAN_LESS_EQL,
  greater_equal = SCAN_GREATER_EQL, equal = SCAN_EQUAL, not_equal = SCAN_NOT_EQUAL, match = SCAN_REGEXP,
  map, ND
}
 

Public Member Functions

 D4FilterClause (const ops op, D4RValue *arg1, D4RValue *arg2)
 
 D4FilterClause (const D4FilterClause &src)
 
D4FilterClauseoperator= (const D4FilterClause &rhs)
 
bool value (DMR &dmr)
 Get the value of this relational expression. This version of value() works for function clauses, although that's not supported by the syntax at this time. More...
 
bool value ()
 Get the value of this relational expression. This version of value() will not work for clauses where one of the rvalues is a function call. This is not currently supported by the DAP4 specification, so it's probably no great loss. More...
 

Friends

class D4FilterClauseList
 

Detailed Description

DAP4 filter clauses.

The DAP4 constraint expression provides a way to filter the values of Sequences (and possibly arrays and coverages, although those are still more ideas than anything at this point). This class holds the operator and operands of one DAP4 constraint's filter clause. The object is built during the parse phase of the constraint evaluation but is not evaluated until the data are sent or interned (read into the DAP4 variable object so that they can be used as input to some process other than directly being sent to a remote client).

For filter clauses that are to be applied to a Sequence, each D4RValue will either be a constant or a BaseType* that will reference one of the Sequences fields. The method 'value()' is effectively the evaluator for the clause and nominally reads values from the rvalue objects.

Note
Potential optimization: Because Sequences might have an optimized representation as a STL vector of some built in types, there could be a value() method that takes a value and compares it to the clause's constant value using the supplied op.
The 'ND' and 'map' ops are 'still just an idea' parts.

Definition at line 114 of file D4FilterClause.h.

Constructor & Destructor Documentation

◆ D4FilterClause()

libdap::D4FilterClause::D4FilterClause ( const ops  op,
D4RValue arg1,
D4RValue arg2 
)
inline

Build a D4FilterClause. The clause will take ownership of the two pointer arguments and delete them.

Note
When comparing an unsigned variable (UInt16) with a constant, at parse time (i.e., when the D4FilterClause is made) check that the constant is >= 0 and store it in an unsigned value at that time. This will avoid having to make the test repeatedly during filter evaluation.
When parsing a constant, extract the value from the BaseType and store it in a local field, to avoid the overhead of extracting the value and looking up its type over an over.
Parameters
opThe operator
arg1The left-hand operand
arg2The right-hand operand

Definition at line 169 of file D4FilterClause.h.

Member Function Documentation

◆ value() [1/2]

bool libdap::D4FilterClause::value ( DMR dmr)

Get the value of this relational expression. This version of value() works for function clauses, although that's not supported by the syntax at this time.

Parameters
dmrThe DMR to use when evaluating a function
Returns
True if the clause is true, false otherwise.

Definition at line 146 of file D4FilterClause.cc.

◆ value() [2/2]

bool libdap::D4FilterClause::value ( )

Get the value of this relational expression. This version of value() will not work for clauses where one of the rvalues is a function call. This is not currently supported by the DAP4 specification, so it's probably no great loss.

Returns
True if the clause is true, false otherwise.

Definition at line 177 of file D4FilterClause.cc.


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