32 #include "dods-datatypes.h" 35 #include "InternalErr.h" 36 #include "dods-datatypes.h" 37 #include "dods-limits.h" 45 class ConstraintEvaluator;
63 friend class D4EnumTest;
75 void m_duplicate(
const D4Enum &src);
76 void m_check_value(int64_t v)
const;
78 unsigned int m_type_width()
const {
79 switch(d_element_type) {
95 assert(!
"illegal type for D4Enum");
103 D4Enum(
const string &
name,
const string &enum_type);
114 static_cast<BaseType &
>(*this) = rhs;
121 virtual D4EnumDef *enumeration()
const {
return d_enum_def; }
122 virtual void set_enumeration(
D4EnumDef *enum_def);
126 Type element_type() {
return d_element_type; }
127 void set_element_type(
Type type) { d_element_type =
type; }
129 bool is_signed()
const {
return d_is_signed; }
130 void set_is_signed(
Type t);
140 template<
typename T>
void value(T *v)
const {
141 *v =
static_cast<T
>(d_buf);
154 template <
typename T>
void set_value(T v,
bool check_value =
true)
156 if (check_value) m_check_value(v);
157 d_buf =
static_cast<int64_t
>(v);
175 virtual unsigned int width(
bool =
false)
const {
return m_type_width();}
182 virtual void print_val(ostream &out,
string space =
"",
bool print_decl_p =
true);
188 virtual void dump(ostream &strm)
const;
190 unsigned int val2buf(
void *,
bool);
virtual string name() const
Returns the name of the class instance.
unsigned int val2buf(void *, bool)
Loads class data.
Contains the attributes for a dataset.
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...
Read data from the stream made by D4StreamMarshaller.
BaseType(const string &n, const Type &t, bool is_dap4=false)
The BaseType constructor.
virtual void print_val(ostream &out, string space="", bool print_decl_p=true)
Prints the value of the variable.
Type
Identifies the data type.
top level DAP object to house generic methods
virtual std::vector< BaseType * > * transform_to_dap2(AttrTable *parent_attr_table)
Convert an Enum to a DAP2 int 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...
virtual void dump(ostream &strm) const
dumps information about this object
virtual Type type() const
Returns the type of the class instance.
virtual void compute_checksum(Crc32 &checksum)
include the data for this variable in the checksum DAP4 includes a checksum with every data response...
virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr)
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...
virtual void print_xml_writer(XMLWriter &xml, bool constrained)
virtual BaseType * ptr_duplicate()
The basic data type for the DODS DAP types.
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...
virtual bool ops(BaseType *b, int op)
Evaluate relational operators.
unsigned int buf2val(void **)
Reads the class data.
virtual string dataset() const
Returns the name of the dataset used to create this instance.