32#include "dods-datatypes.h"
54 friend class D4EnumTest;
66 void m_duplicate(
const D4Enum &src);
67 void m_check_value(int64_t v)
const;
69 unsigned int m_type_width()
const {
70 switch (d_element_type) {
86 assert(!
"illegal type for D4Enum");
94 D4Enum(
const string &
name,
const string &enum_type);
100 D4Enum(
const D4Enum &src) :
BaseType(src) { m_duplicate(src); }
102 D4Enum &operator=(
const D4Enum &rhs) {
105 BaseType::operator=(rhs);
112 virtual D4EnumDef *enumeration()
const {
return d_enum_def; }
113 virtual void set_enumeration(
D4EnumDef *enum_def);
117 Type element_type() {
return d_element_type; }
118 void set_element_type(Type
type) { d_element_type =
type; }
120 bool is_signed()
const {
return d_is_signed; }
121 void set_is_signed(
Type t);
131 template <
typename T>
void value(T *v)
const { *v =
static_cast<T
>(d_buf); }
143 template <
typename T>
void set_value(T v,
bool check_value =
true) {
146 d_buf =
static_cast<int64_t
>(v);
164 unsigned int width(
bool =
false)
const override {
return (
int)m_type_width(); }
166 int64_t width_ll(
bool =
false)
const override {
return (int64_t)m_type_width(); }
170 void serialize(D4StreamMarshaller &m, DMR &dmr,
bool filter =
false)
override;
171 void deserialize(D4StreamUnMarshaller &um, DMR &dmr)
override;
173 void print_val(ostream &out,
string space =
"",
bool print_decl_p =
true)
override;
179 void dump(ostream &strm)
const override;
181 unsigned int val2buf(
void *,
bool);
184 std::vector<BaseType *> *
transform_to_dap2(AttrTable *parent_attr_table)
override;
virtual string name() const
Returns the name of the class instance.
virtual string dataset() const
Returns the name of the dataset used to create this instance.
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
virtual Type type() const
Returns the type of the class instance.
Evaluate a constraint expression.
void print_xml_writer(XMLWriter &xml, bool constrained) override
bool ops(BaseType *b, int op) override
Evaluate relational operators.
std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table) override
Convert an Enum to a DAP2 int type.
unsigned int buf2val(void **)
Reads the class data.
BaseType * ptr_duplicate() override
void print_val(ostream &out, string space="", bool print_decl_p=true) override
Prints the value of the variable.
unsigned int width(bool=false) const override
Return the number of bytes in an instance of an Enum. This returns the number of bytes an instance of...
void compute_checksum(Crc32 &checksum) override
include the data for this variable in the checksum DAP4 includes a checksum with every data response....
unsigned int val2buf(void *, bool)
Loads class data.
void serialize(D4StreamMarshaller &m, DMR &dmr, bool filter=false) override
Serialize a D4Enum Use the (integer) data type associated with an Enumeration definition to serialize...
void set_value(T v, bool check_value=true)
Set the value of the Enum Template member function to set the value of the Enum. The libdap library c...
void value(T *v) const
Get the value of an Enum Get the value of this instance. The caller is responsible for using a type T...
void dump(ostream &strm) const override
dumps information about this object
void deserialize(D4StreamUnMarshaller &um, DMR &dmr) override
abstract base class used to marshal/serialize dap data objects
abstract base class used to unmarshall/deserialize dap data objects
top level DAP object to house generic methods
Type
Identifies the data type.