The basic data type for the DODS DAP types.
This defines the basic data type features for the DODS data access protocol (DAP) data types. All the DAP type classes (Float64, Array, etc.) subclass it. This class is an abstract one; no variables will ever be stored as BaseType instances, only as instances of its child classes. These classes and their methods give a user the capacity to set up sophisticated data types. They do {\it not} provide sophisticated ways to access and use this data. On the server side, in many cases, the class instances will have no data in them at all until the #serialize# function is called to send data to the client. On the client side, most DODS application programs will unpack the data promptly into whatever local data structure the programmer deems the most useful. In order to use these classes on the server side of a DODS client/server connection, you must write a #read# method for each of the data types you expect to encounter in the application. This function, whose purpose is to read data from a local source into the class instance data buffer, is called in #serialize#, when the data is about to be sent to the client. The #read# function may be called earlier, in the case of data subset requests (constraint expressions) whose evaluation requires it. (For example, the constraint expression ``#a,b&b>c#'' requires that #c# be read even though it will not be sent.) For some data types, the #read# function must be aware of the constraints to be returned. These cautions are outlined where they occur.
BaseType(const BaseType ©_from)
virtual BaseType* ptr_duplicate()
string name() const
void set_name(const string &n)
Type type() const
void set_type(const Type &t)
string type_name() const
bool is_simple_type()
bool is_vector_type()
bool is_constructor_type()
virtual int element_count(bool leaves = false)
bool synthesized_p()
void set_synthesized_p(bool state)
bool read_p()
virtual void set_read_p(bool state)
bool send_p()
virtual void set_send_p(bool state)
xdrproc_t xdr_coder()
virtual BaseType* var(const string &name = "", bool exact_match = true)
exact_match - True if only interested in variables whose full
names match #name# exactly. If false, returns the first variable whose
name matches #name#. For example, if #name# is x and point.x is a
variable, then var("x", false) would return a #BaseType# pointer to
point.x. If #exact_match# was #true# then #name# would need to be
"point.x" for #var# to return that pointer. This feature simplifies
constraint expressions for datasets which have complex, nested,
constructor variables.
virtual BaseType* var(const string &name, btp_stack &s)
s - Record the path to {\it name}.
virtual void add_var(BaseType *v, Part p = nil)
p - The part of the constructor data to be modified.
virtual unsigned int width()
virtual bool read(const string &dataset, int &error)
error - An integer indicating a returned error condition. The
exact meaning of this integer will vary among data APIs. However, for
all APIs, a return of 0 means no error was found (although there may
have been an EOF). An {\it error} returned greater than zero means an
error occurred.
virtual unsigned int buf2val(void **val)
virtual unsigned int val2buf(void *val, bool reuse = false)
reuse - A boolean value, indicating whether the class
internal data storage can be reused or not. If this argument is
TRUE, the class buffer is assumed to be large enough to hold the
incoming data, and it is {\it not} reallocated. If FALSE, new
storage is allocated. If the internal buffer has not been
allocated at all, this argument has no effect.
This is currently used only in the Vector class.
Vector::val2buf virtual bool serialize(const string &dataset, DDS &dds, XDR *sink, bool ce_eval = true)
dds - The Data Descriptor Structure object corresponding to
this dataset. See {\it The DODS User Manual} for information
about this structure.
sink - A valid XDR pointer to the process connection to the
net. This is generally created with a call to #new_xdrstdio()#.
ce_eval - A boolean value indicating whether to evaluate
the DODS constraint expression that may accompany this dataset.
The constraint expression is stored in {\it dds}.
virtual bool deserialize(XDR *source, DDS *dds, bool reuse = false)
dds - The Data Descriptor Structure object corresponding to
this dataset. See {\it The DODS User Manual} for information
about this structure. This would have been received from the
server in an earlier transmission.
reuse - A boolean value, indicating whether the class
internal data storage can be reused or not. If this argument is
TRUE, the class buffer is assumed to be large enough to hold the
incoming data, and it is {\it not} reallocated. If FALSE, new
storage is allocated. If the internal buffer has not been
allocated at all, this argument has no effect.
virtual void print_decl(ostream &os, string space = " ", bool print_semi = true, bool constraint_info = false, bool constrained = false)
space - Each line of the declaration will begin with the
characters in this string. Usually used for leading spaces.
print_semi - A boolean value indicating whether to print a
semicolon at the end of the declaration.
constraint_info - A boolean value indicating whether
constraint information is to be printed with the declaration.
If the value of this parameter is TRUE, #print_decl()# prints
the value of the variable's #send_p()# flag after the
declaration.
constrained - If this boolean value is TRUE, the variable's
declaration is only printed if is the #send_p()# flag is TRUE.
If a constraint expression is in place, and this variable is not
requested, the #send_p()# flag is FALSE.
DDS::CE
virtual void print_val(ostream &os, string space = "", bool print_decl_p = true)
space - This value is passed to the #print_decl()#
function, and controls the leading spaces of the output.
print_decl_p - A boolean value controlling whether the
variable declaration is printed as well as the value. virtual bool check_semantics(string &msg, bool all = false)
all - For complex constructor types (Grid,
Sequence, Structure), this flag indicates whether to check the
sematics of the member variables, too.
virtual bool ops(BaseType *b, int op, const string &dataset)
op - An integer index indicating which relational operator
is implied. Choose one from the following: #EQUAL#, #NOT_EQUAL#,
#GREATER#, #GREATER_EQL#, #LESS#, #LESS_EQL#, and #REGEXP#.
dataset - The name of the dataset from which the instance's
data has come (or is to come).
alphabetic index hierarchy of classes
generated by doc++