41 class ConstraintEvaluator;
82 operator int8_t()
const {
return i8; }
83 operator uint8_t()
const {
return ui8; }
84 operator int16_t()
const {
return i16; }
85 operator uint16_t()
const {
return ui16; }
86 operator int32_t()
const {
return i32; }
87 operator uint32_t()
const {
return ui32; }
88 operator int64_t()
const {
return i64; }
89 operator uint64_t()
const {
return ui64; }
99 void m_duplicate(
const D4Enum &src) {
101 d_element_type = src.d_element_type;
104 unsigned int m_type_width()
const {
105 switch(d_element_type) {
121 assert(!
"illegal type for D4Enum");
132 d_element_type =
get_type(enum_type.c_str());
139 d_buf((uint64_t)0), d_element_type(type) {
146 d_buf((uint64_t)0), d_element_type(type) {
157 static_cast<BaseType &
>(*this) = rhs;
191 assert(!
"illegal type for D4Enum");
192 throw InternalErr(__FILE__, __LINE__,
"Illegal type");
206 template<
typename T>
void value(T *v)
const
208 switch (d_element_type) {
211 *v =
static_cast<T
>(d_buf.ui8);
214 *v =
static_cast<T
>(d_buf.ui16);
217 *v =
static_cast<T
>(d_buf.ui32);
220 *v =
static_cast<T
>(d_buf.ui64);
224 *v =
static_cast<T
>(d_buf.i8);
227 *v =
static_cast<T
>(d_buf.i16);
230 *v =
static_cast<T
>(d_buf.i32);
233 *v =
static_cast<T
>(d_buf.i64);
236 assert(!
"illegal type for D4Enum");
248 template <
typename T>
void set_value(T v) { d_buf = v; }
259 virtual unsigned int width(
bool =
false)
const {
return m_type_width(); }
266 virtual void print_val(ostream &out,
string space =
"",
bool print_decl_p =
true);
272 virtual void dump(ostream &strm)
const;
274 unsigned int val2buf(
void *,
bool);
virtual void set_enumeration(D4EnumDef *enum_def)
D4Enum(const string &name, const string &enum_type)
void set_value(T v)
Set the value of the Enum Template member function to set the value of the Enum. The libdap library c...
unsigned int val2buf(void *, bool)
Loads class data.
Read data from the stream made by D4StreamMarshaller.
D4Enum(const D4Enum &src)
virtual void print_val(ostream &out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Type
Identifies the data type.
Type type() const
Returns the type of the class instance.
A class for software fault reporting.
string dataset() const
Returns the name of the dataset used to create this instance.
D4Enum(const string &name, Type type)
Holds a DAP4 enumeration.
virtual void serialize(D4StreamMarshaller &m, DMR &dmr, bool filter=false)
Serialize a D4Enum Use the (integer) data type associated with an Enumeration definition to serialize...
Marshaller that knows how to marshal/serialize dap data objects to a C++ iostream using DAP4's receiv...
D4Enum & operator=(const D4Enum &rhs)
void set_element_type(Type type)
ObjectType get_type(const string &value)
virtual void compute_checksum(Crc32 &checksum)
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
void set_is_signed(Type t)
string name() const
Returns the name of the class instance.
virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr)
virtual void print_xml_writer(XMLWriter &xml, bool constrained)
virtual BaseType * ptr_duplicate()
The basic data type for the DODS DAP types.
virtual unsigned int width(bool=false) const
Return the number of bytes in an instance of an Enum. This returns the number of bytes an instance of...
virtual D4EnumDef * enumeration() const
void value(T *v) const
Copy the value of this Enum into v. Template member function that can be used to read the value of th...
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
D4Enum(const string &name, const string &dataset, Type type)
unsigned int buf2val(void **)
Reads the class data.
virtual void dump(ostream &strm) const
dumps information about this object
bool is_integer_type(Type t)