48#ifndef constraint_evaluator_h
86 int64_t d_length_ll = -1;
92 char *d_buf =
nullptr;
94 vector<BaseType *> d_compound_buf;
99 unsigned int d_capacity = 0;
100 uint64_t d_capacity_ll = 0;
102 bool d_too_big_for_dap2 =
false;
108 template <
typename T>
void value_worker(T *v)
const;
109 template <
typename T>
void value_ll_worker(T *v)
const;
110 template <
typename T>
void value_worker(vector<unsigned int> *indices, T *b)
const;
111 template <
typename T>
void value_ll_worker(vector<uint64_t> *indices, T *b)
const;
113 template <
typename T>
bool set_value_worker(T *v,
int sz);
114 template <
typename T>
bool set_value_ll_worker(T *v, int64_t sz);
115 template <
typename T>
bool set_value_worker(vector<T> &v,
int sz);
116 template <
typename T>
bool set_value_ll_worker(vector<T> &v, int64_t sz);
118 bool m_is_cardinal_type()
const;
119 int64_t m_create_cardinal_data_buffer_for_type(int64_t num_elements);
120 void m_delete_cardinal_data_buffer();
121 template <
class CardType>
void m_set_cardinal_values_internal(
const CardType *fromArray, int64_t num_elements);
124 void m_duplicate(
const Vector &v);
191 unsigned int width(
bool constrained =
false)
const override {
195 return length() * d_proto->width(constrained);
203 int64_t
width_ll(
bool constrained =
false)
const override {
return length_ll() * d_proto->width_ll(constrained); }
210 int length()
const override {
return d_length; }
218 int64_t
length_ll()
const override {
return d_length_ll; }
235 unsigned int val2buf(
void *val,
bool reuse =
false)
override;
236 unsigned int buf2val(
void **val)
override;
238 int64_t
val2buf_ll(
void *val,
bool reuse =
false);
275 virtual bool set_value(
string *val,
int sz);
289 virtual bool set_value(vector<dods_byte> &val,
int sz);
290 virtual bool set_value(vector<dods_int8> &val,
int sz);
291 virtual bool set_value(vector<dods_int16> &val,
int sz);
292 virtual bool set_value(vector<dods_uint16> &val,
int sz);
293 virtual bool set_value(vector<dods_int32> &val,
int sz);
294 virtual bool set_value(vector<dods_uint32> &val,
int sz);
295 virtual bool set_value(vector<dods_int64> &val,
int sz);
296 virtual bool set_value(vector<dods_uint64> &val,
int sz);
297 virtual bool set_value(vector<dods_float32> &val,
int sz);
298 virtual bool set_value(vector<dods_float64> &val,
int sz);
299 virtual bool set_value(vector<string> &val,
int sz);
301 virtual bool set_value_ll(vector<dods_byte> &val, int64_t sz);
302 virtual bool set_value_ll(vector<dods_int8> &val, int64_t sz);
303 virtual bool set_value_ll(vector<dods_int16> &val, int64_t sz);
304 virtual bool set_value_ll(vector<dods_uint16> &val, int64_t sz);
305 virtual bool set_value_ll(vector<dods_int32> &val, int64_t sz);
306 virtual bool set_value_ll(vector<dods_uint32> &val, int64_t sz);
307 virtual bool set_value_ll(vector<dods_int64> &val, int64_t sz);
308 virtual bool set_value_ll(vector<dods_uint64> &val, int64_t sz);
309 virtual bool set_value_ll(vector<dods_float32> &val, int64_t sz);
310 virtual bool set_value_ll(vector<dods_float64> &val, int64_t sz);
311 virtual bool set_value_ll(vector<string> &val, int64_t sz);
323 virtual void value(vector<string> &b)
const;
325 virtual void value(vector<unsigned int> *indices,
dods_byte *b)
const;
326 virtual void value(vector<unsigned int> *indices,
dods_int8 *b)
const;
327 virtual void value(vector<unsigned int> *indices,
dods_int16 *b)
const;
329 virtual void value(vector<unsigned int> *indices,
dods_int32 *b)
const;
331 virtual void value(vector<unsigned int> *indices,
dods_int64 *b)
const;
335 virtual void value(vector<unsigned int> *index, vector<string> &b)
const;
347 virtual void value_ll(vector<uint64_t> *index, vector<string> &b)
const;
349 virtual void *
value();
362 bool is_dap4_projected(std::vector<std::string> &projected_dap4_inventory)
override;
364 void dump(ostream &strm)
const override;
The basic data type for the DODS DAP types.
virtual string name() const
Returns the name of the class instance.
virtual bool is_dap4() const
stack< BaseType * > btp_stack
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
Evaluate a constraint expression.
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Read data from the stream made by D4StreamMarshaller.
abstract base class used to marshal/serialize dap data objects
abstract base class used to unmarshall/deserialize dap data objects
Holds a one-dimensional collection of DAP2 data types.
unsigned int width(bool constrained=false) const override
Returns the width of the data, in bytes.
virtual void reserve_value_capacity_ll_byte(uint64_t numBytes)
bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false) override
Receive data from the net.
void set_send_p(bool state) override
Indicates that the data is ready to send.
int64_t width_ll(bool constrained=false) const override
Return the number of bytes needed to hold the array data.
void dump(ostream &strm) const override
dumps information about this object
virtual uint64_t get_value_capacity_ll() const
virtual BaseType * set_prototype(BaseType *btp)
Change the Vector/Array element type.
void compute_checksum(Crc32 &checksum) override
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
vector< BaseType * > & get_compound_buf()
virtual unsigned int get_value_capacity() const
void set_vec_nocopy(unsigned int i, BaseType *val)
Sets element i to value val. Set the ith element to val. Extend the vector if needed.
friend class MarshallerTest
Conditionally set to true in set_length_ll()
Vector & operator=(const Vector &rhs)
void add_var_nocopy(BaseType *v, Part p=nil) override
void add_var(BaseType *v, Part p=nil) override
Add the BaseType pointer to this constructor type instance.
int length() const override
Returns the number of elements in the vector. Note that some child classes of Vector use the length o...
int64_t val2buf_ll(void *val, bool reuse=false)
virtual void value_ll(vector< uint64_t > *indices, dods_byte *b) const
int64_t length_ll() const override
Get the number of elements in this Vector/Array This version of the function deprecates length() whic...
void set_read_p(bool state) override
Indicates that the data is ready to send.
int element_count(bool leaves) override
Count the members of constructor types.
void set_length_ll(int64_t l) override
Set the number of elements in this Vector/Array This version of the function deprecates set_length() ...
void set_vec(unsigned int i, BaseType *val)
Sets element i to value val.
bool is_dap4_projected(std::vector< std::string > &projected_dap4_inventory) override
void set_value_capacity(uint64_t l)
void set_name(const std::string &name) override
Sets the name of the class instance.
bool check_semantics(string &msg, bool all=false) override
Compare an object's current state with the semantics of its type.
void vec_resize_ll(int64_t l)
void intern_data() override
Read data into this variable.
virtual void reserve_value_capacity_ll()
unsigned int val2buf(void *val, bool reuse=false) override
Reads data into the Vector buffer.
int64_t buf2val_ll(void **val)
virtual bool set_value_ll(dods_byte *val, int64_t sz)
BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=nullptr) override
virtual uint64_t set_value_slice_from_row_major_vector(const Vector &rowMajorData, uint64_t startElement)
virtual bool set_value(dods_byte *val, int sz)
bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true) override
Serialize a Vector.
vector< string > & get_str()
void set_vec_nocopy_ll(uint64_t i, BaseType *val)
void set_vec_ll(uint64_t i, BaseType *val)
virtual void reserve_value_capacity()
virtual BaseType * prototype() const
unsigned int buf2val(void **val) override
Copies data from the Vector buffer.
void clear_local_data() override
Vector(const string &n, BaseType *v, const Type &t, bool is_dap4=false)
The Vector constructor.
virtual BaseType * var_ll(uint64_t i)
void set_length(int64_t l) override
Sets the length of the vector. This function does not allocate any new space.
top level DAP object to house generic methods
Type
Identifies the data type.
Part
Names the parts of multi-section constructor data types.