libdap Updated for version 3.21.1
libdap4 is an implementation of OPeNDAP's DAP protocol.
libdap::Byte Class Reference

Holds a single byte. More...

#include <Byte.h>

Inheritance diagram for libdap::Byte:
Inheritance graph

Public Member Functions

unsigned int buf2val (void **val) override
 Byte (const Byte &copy_from)
 Byte (const string &n)
 The Byte constructor.
 Byte (const string &n, const string &d)
 The Byte server-side constructor.
void compute_checksum (Crc32 &checksum) override
bool d4_ops (BaseType *b, int op) override
void deserialize (D4StreamUnMarshaller &um, DMR &dmr) override
bool deserialize (UnMarshaller &um, DDS *, bool) override
 Deserialize the char on stdin and put the result in _BUF.
void dump (ostream &strm) const override
 dumps information about this object
Byteoperator= (const Byte &rhs)
bool ops (BaseType *b, int op) override
void print_val (FILE *out, string space="", bool print_decl_p=true) override
void print_val (ostream &out, string space="", bool print_decl_p=true) override
BaseTypeptr_duplicate () override
bool serialize (ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval) override
void serialize (D4StreamMarshaller &m, DMR &dmr, bool filter=false) override
 Serialize a Byte.
virtual bool set_value (const dods_byte value)
std::vector< BaseType * > * transform_to_dap2 (AttrTable *parent_attr_table) override
 DAP4 to DAP2 transform.
unsigned int val2buf (void *val, bool reuse=false) override
virtual dods_byte value () const
unsigned int width (bool=false) const override
int64_t width_ll (bool=false) const override

Protected Attributes

dods_byte d_buf

Detailed Description

Holds a single byte.

This class is used to hold eight bits of information. No sign information is implied in its value.

See also
BaseType

Definition at line 59 of file Byte.h.

Constructor & Destructor Documentation

◆ Byte() [1/3]

libdap::Byte::Byte ( const string & n)

The Byte constructor.

The Byte constructor requires only the name of the variable to be created. The name may be omitted, which will create a nameless variable. This may be adequate for some applications.

Parameters
nA string containing the name of the variable to be created.

Definition at line 86 of file Byte.cc.

◆ Byte() [2/3]

libdap::Byte::Byte ( const string & n,
const string & d )

The Byte server-side constructor.

This Byte constructor requires the name of the variable to be created and the name of the dataset from which this variable is being created. This constructor is used in server-side processing, loading structure in from a dataset.

Parameters
nA string containing the name of the variable to be created.
dA string containing the name of the dataset from which the variable is being created.

Definition at line 98 of file Byte.cc.

◆ ~Byte()

virtual libdap::Byte::~Byte ( )
inlinevirtual

Definition at line 67 of file Byte.h.

◆ Byte() [3/3]

libdap::Byte::Byte ( const Byte & copy_from)

Definition at line 100 of file Byte.cc.

Member Function Documentation

◆ buf2val()

unsigned int libdap::Byte::buf2val ( void ** val)
override

Definition at line 185 of file Byte.cc.

◆ compute_checksum()

void libdap::Byte::compute_checksum ( Crc32 & checksum)
override

Definition at line 148 of file Byte.cc.

◆ d4_ops()

bool libdap::Byte::d4_ops ( BaseType * b,
int op )
override
See also
BaseType::d4_ops(BaseType *, int)

Definition at line 257 of file Byte.cc.

◆ deserialize() [1/2]

void libdap::Byte::deserialize ( D4StreamUnMarshaller & um,
DMR & dmr )
override

Definition at line 165 of file Byte.cc.

◆ deserialize() [2/2]

bool libdap::Byte::deserialize ( UnMarshaller & um,
DDS * ,
bool  )
override

Deserialize the char on stdin and put the result in _BUF.

Definition at line 142 of file Byte.cc.

◆ dump()

void libdap::Byte::dump ( ostream & strm) const
override

dumps information about this object

Displays the pointer value of this instance and information about this instance.

Parameters
strmC++ i/o stream to dump the information to
Returns
void

Definition at line 336 of file Byte.cc.

◆ operator=()

Byte & libdap::Byte::operator= ( const Byte & rhs)

Definition at line 104 of file Byte.cc.

◆ ops()

bool libdap::Byte::ops ( BaseType * b,
int op )
override

Definition at line 228 of file Byte.cc.

◆ print_val() [1/2]

void libdap::Byte::print_val ( FILE * out,
string space = "",
bool print_decl_p = true )
override

Definition at line 214 of file Byte.cc.

◆ print_val() [2/2]

void libdap::Byte::print_val ( ostream & out,
string space = "",
bool print_decl_p = true )
override

Definition at line 220 of file Byte.cc.

◆ ptr_duplicate()

BaseType * libdap::Byte::ptr_duplicate ( )
override

Definition at line 102 of file Byte.cc.

◆ serialize() [1/2]

bool libdap::Byte::serialize ( ConstraintEvaluator & eval,
DDS & dds,
Marshaller & m,
bool ce_eval )
override

Serialize the contents of member _BUF (the object's internal buffer, used to hold data) and write the result to stdout. If FLUSH is true, write the contents of the output buffer to the kernel. FLUSH is false by default. If CE_EVAL is true, evaluate the current constraint expression; only send data if the CE evaluates to true.

Returns
False if a failure to read, send or flush is detected, true otherwise.

Definition at line 122 of file Byte.cc.

◆ serialize() [2/2]

void libdap::Byte::serialize ( D4StreamMarshaller & m,
DMR & dmr,
bool filter = false )
override

Serialize a Byte.

Parameters
m
dmrUnused
evalUnused
filterUnused
Exceptions
Erroris thrown if the value needs to be read and that operation fails.

Definition at line 158 of file Byte.cc.

◆ set_value()

bool libdap::Byte::set_value ( const dods_byte value)
virtual

Set the value of this instance.

Parameters
valueThe value
Returns
Always returns true; the return type of bool is for compatibility with the Passive* subclasses written by HAO.

Definition at line 203 of file Byte.cc.

◆ transform_to_dap2()

std::vector< BaseType * > * libdap::Byte::transform_to_dap2 ( AttrTable * parent_attr_table)
override

DAP4 to DAP2 transform.

Return a DAP2 'copy' of the variable.

NOTE: This little bit of magic ensures that the DAP4 shenanigans in which UInt8, Char , and Byte are synonymous is reduced to the DAP2 simplicity of Byte.

Parameters
rootThe root group that should hold this new variable. Add Group-level stuff here (e.g., D4Dimensions).
containerAdd the new variable to this container.
Returns
A pointer to the transformed variable

Definition at line 302 of file Byte.cc.

◆ val2buf()

unsigned int libdap::Byte::val2buf ( void * val,
bool reuse = false )
override

Store the value referenced by val in the object's internal buffer. reuse has no effect because this class does not dynamically allocate storage for the internal buffer.

Returns
The size (in bytes) of the value's representation.

Definition at line 172 of file Byte.cc.

◆ value()

dods_byte libdap::Byte::value ( ) const
virtual

Get the value of this instance.

Returns
The value.

Definition at line 212 of file Byte.cc.

◆ width()

unsigned int libdap::Byte::width ( bool = false) const
inlineoverride

Definition at line 73 of file Byte.h.

◆ width_ll()

int64_t libdap::Byte::width_ll ( bool = false) const
inlineoverride

Definition at line 75 of file Byte.h.

Member Data Documentation

◆ d_buf

dods_byte libdap::Byte::d_buf
protected

Definition at line 61 of file Byte.h.


The documentation for this class was generated from the following files: