56 #include "Operators.h" 57 #include "Marshaller.h" 58 #include "UnMarshaller.h" 61 #include "D4Attributes.h" 62 #include "D4StreamMarshaller.h" 63 #include "D4StreamUnMarshaller.h" 68 #include "dods-limits.h" 69 #include "InternalErr.h" 103 d_buf = copy_from.d_buf;
108 return new Byte(*
this);
111 Byte & Byte::operator=(
const Byte & rhs)
116 dynamic_cast <
BaseType & >(*this) = rhs;
125 return sizeof(dods_byte);
140 #if USE_LOCAL_TIMEOUT_SCHEME 148 #if USE_LOCAL_TIMEOUT_SCHEME 151 m.put_byte( d_buf ) ;
161 um.get_byte( d_buf ) ;
169 checksum.
AddData(reinterpret_cast<uint8_t*>(&d_buf),
sizeof(d_buf));
186 m.put_byte( d_buf ) ;
192 um.get_byte( d_buf ) ;
207 throw InternalErr(
"the incoming pointer does not contain any data.");
209 d_buf = *(dods_byte *) val;
222 *val =
new dods_byte;
224 *(dods_byte *) * val = d_buf;
252 fwrite(oss.str().data(),
sizeof(char), oss.str().length(), out);
259 out <<
" = " << (int) d_buf <<
";\n";
299 return USCmp<dods_byte, dods_int8>(op, d_buf,
static_cast<Int8*
>(b)->
value());
301 return Cmp<dods_byte, dods_byte>(op, d_buf,
static_cast<Byte*
>(b)->
value());
303 return USCmp<dods_byte, dods_int16>(op, d_buf,
static_cast<Int16*
>(b)->
value());
305 return Cmp<dods_byte, dods_uint16>(op, d_buf,
static_cast<UInt16*
>(b)->
value());
307 return USCmp<dods_byte, dods_int32>(op, d_buf,
static_cast<Int32*
>(b)->
value());
309 return Cmp<dods_byte, dods_uint32>(op, d_buf,
static_cast<UInt32*
>(b)->
value());
311 return USCmp<dods_byte, dods_int64>(op, d_buf,
static_cast<Int64*
>(b)->
value());
313 return Cmp<dods_byte, dods_uint64>(op, d_buf,
static_cast<UInt64*
>(b)->
value());
315 return USCmp<dods_byte, dods_float32>(op, d_buf,
static_cast<Float32*
>(b)->
value());
317 return USCmp<dods_byte, dods_float64>(op, d_buf,
static_cast<Float64*
>(b)->
value());
320 throw Error(malformed_expr,
"Relational operators can only compare compatible types (number, string).");
322 throw Error(malformed_expr,
"Relational operators only work with scalar types.");
344 std::vector<BaseType *> *
347 DBG(cerr << __func__ <<
"() - BEGIN" << endl;);
351 oss << __func__ <<
"() - Something Bad Happened. This transform should produce only ";
352 oss <<
" a single BaseType yet it produced " << vec->size();
353 throw new Error(internal_error,oss.str());
357 DBG(cerr << __func__ <<
"() - type(): " <<
type() << endl;);
358 DBG(cerr << __func__ <<
"() - dest->type(): " << dest->type() << endl;);
363 if(
type()!=dods_byte_c){
364 dest->set_type(dods_byte_c);
366 DBG (dest->get_attr_table().print(cerr););
368 DBG(cerr << __func__ <<
"() - END" << endl;);
382 strm << DapIndent::LMarg <<
"Byte::dump - (" 383 << (
void *)
this <<
")" << endl;
386 strm << DapIndent::LMarg <<
"value: " << d_buf << endl;
387 DapIndent::UnIndent();
virtual bool read()
Read data into a local buffer.
Holds an 8-bit signed integer value.
Holds a64-bit signed integer.
virtual bool read_p()
Has this variable been read?
abstract base class used to unmarshall/deserialize dap data objects
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
DAP4 to DAP2 transform.
virtual unsigned int buf2val(void **val)
Reads the class data.
virtual void print_decl(FILE *out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false)
Print an ASCII representation of the variable structure.
virtual void dump(ostream &strm) const
dumps information about this object
Contains the attributes for a dataset.
virtual bool deserialize(UnMarshaller &um, DDS *, bool)
Deserialize the char on stdin and put the result in _BUF.
Byte(const string &n)
The Byte constructor.
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval)
Read data from the stream made by D4StreamMarshaller.
Holds an unsigned 16-bit integer.
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
virtual dods_byte value() const
Holds a 32-bit floating point value.
A class for software fault reporting.
virtual unsigned int val2buf(void *val, bool reuse=false)
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
Holds a 16-bit signed integer value.
virtual Type type() const
Returns the type of the class instance.
virtual bool d4_ops(BaseType *b, int op)
virtual void set_read_p(bool state)
Sets the value of the read_p property.
virtual bool set_value(const dods_byte value)
virtual unsigned int width(bool constrained=false) const
How many bytes does this use Return the number of bytes of storage this variable uses. For scalar types, this is pretty simple (an int32 uses 4 bytes, etc.). For arrays and Constructors, it is a bit more complex. Note that a scalar String variable uses sizeof(String*) bytes, not the length of the string. In other words, the value returned is independent of the type. Also note width() of a String array returns the number of elements in the array times sizeof(String*). That is, each different array size is a different data type.
Holds a 64-bit unsigned integer.
void AddData(const uint8_t *pData, const uint32_t length)
virtual void print_val(FILE *out, string space="", bool print_decl_p=true)
Prints the value of the variable.
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
DAP4 to DAP2 transform.
Evaluate a constraint expression.
The basic data type for the DODS DAP types.
abstract base class used to marshal/serialize dap data objects
Holds a 64-bit (double precision) floating point value.
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 ...
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
A class for error processing.
virtual void compute_checksum(Crc32 &checksum)
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
Holds a 32-bit unsigned integer.
virtual void dump(ostream &strm) const
dumps information about this object
Holds a 32-bit signed integer.
virtual BaseType * ptr_duplicate()
virtual string dataset() const
Returns the name of the dataset used to create this instance.