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

#include <D4RValue.h>

Public Types

enum  value_kind { unknown, basetype, function, constant }
 

Public Member Functions

 D4RValue (const D4RValue &src)
 
 D4RValue (BaseType *btp)
 
 D4RValue (D4Function f, D4RValueList *args)
 
 D4RValue (unsigned long long ui)
 
 D4RValue (long long i)
 
 D4RValue (double r)
 
 D4RValue (std::string s)
 
 D4RValue (std::vector< dods_byte > &byte_args)
 
 D4RValue (std::vector< dods_int8 > &byte_int8)
 
 D4RValue (std::vector< dods_uint16 > &byte_uint16)
 
 D4RValue (std::vector< dods_int16 > &byte_int16)
 
 D4RValue (std::vector< dods_uint32 > &byte_uint32)
 
 D4RValue (std::vector< dods_int32 > &byte_int32)
 
 D4RValue (std::vector< dods_uint64 > &byte_uint64)
 
 D4RValue (std::vector< dods_int64 > &byte_int64)
 
 D4RValue (std::vector< dods_float32 > &byte_float32)
 
 D4RValue (std::vector< dods_float64 > &byte_float64)
 
value_kind get_kind () const
 What kind of thing holds the value Values in DAP4 constraints are either constants, dataset variables or function results. It might be nice to know the source of a given value in order to optimize the evaluation of certain kinds of expressions. More...
 
D4RValueoperator= (D4RValue &rhs)
 
virtual BaseTypevalue (DMR &dmr)
 Get the value for a RValue object Return the BaseType * for a given RValue. For a dataset variable, read the variable's value and, for a function, evaluate that function. Since read() is called for a dataset variable each time this method is called, if the variable is part of a Sequence, the next value in the sequence will be returned. However, since this code also sets the read_p property after calling read(), if the variable does not have a new value, read() will not be called (using the read_p property, the read() method is called only when the variable has a new value to be read. More...
 
virtual BaseTypevalue ()
 Get the value for a RValue object. More...
 

Friends

class D4RValueList
 

Detailed Description

Holds the RValues for the D4 function parser and for the filter expression evaluator.

Definition at line 85 of file D4RValue.h.

Member Function Documentation

◆ get_kind()

value_kind libdap::D4RValue::get_kind ( ) const
inline

What kind of thing holds the value Values in DAP4 constraints are either constants, dataset variables or function results. It might be nice to know the source of a given value in order to optimize the evaluation of certain kinds of expressions.

Returns
The 'value_kind' of this value.

Definition at line 150 of file D4RValue.h.

◆ value() [1/2]

BaseType * libdap::D4RValue::value ( DMR dmr)
virtual

Get the value for a RValue object Return the BaseType * for a given RValue. For a dataset variable, read the variable's value and, for a function, evaluate that function. Since read() is called for a dataset variable each time this method is called, if the variable is part of a Sequence, the next value in the sequence will be returned. However, since this code also sets the read_p property after calling read(), if the variable does not have a new value, read() will not be called (using the read_p property, the read() method is called only when the variable has a new value to be read.

Note
Unlike the DAP2 functions, we have an easier-to-follow memory model for function values. The values (BaseType*) returned by this method will be packaged up in a RValueList and deleted when that list is deleted. Constant values and function result values will be deleted at that time; variables will not. Thus Server Functions should always allocate storage for their return values.
Todo:
Could move the operation that wraps a constant in a BaseType to this method while providing other ways to access the value(s) (methods to determine if the rvalue is a constant and what DAP type it is, e.g.). This would provide an optimization for the filter evaluator which may access the values many times. We might also modify the server side functions so they could access constant values more efficiently.
Parameters
dmrThe DMR to pass to a function.
Returns
A BaseType* that holds the value.

Definition at line 270 of file D4RValue.cc.

◆ value() [2/2]

BaseType * libdap::D4RValue::value ( )
virtual

Get the value for a RValue object.

This version of value() will not work for function RValues, but has the advantage that it can be used more easily for the D4RValue objects built for, and stored in, D4Filter- Clause instances.

See also
D4RValue::value(DMR&)
Returns
The value wrapped in a BaseType*

Definition at line 300 of file D4RValue.cc.


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