libdap++
Updated for version 3.8.2
|
#include <DataDDS.h>
Public Types | |
typedef std::vector< BaseType * > ::const_iterator | Vars_citer |
typedef std::vector< BaseType * > ::iterator | Vars_iter |
typedef std::vector< BaseType * > ::reverse_iterator | Vars_riter |
Public Member Functions | |
void | add_var (BaseType *bt) |
Adds a copy of the variable to the DDS. Using the ptr_duplicate() method, perform a deep copy on the variable bt and adds the result to this DDS. | |
bool | check_semantics (bool all=false) |
Check the semantics of each of the variables represented in the DDS. | |
DataDDS (BaseTypeFactory *factory, const string &n="", const string &v="", const string &p="") | |
Make an instance of DataDDS A DataDDS instance is a DDS with aditional information about the version of the server from which the data came. | |
void | del_var (const string &n) |
Removes a variable from the DDS. | |
void | del_var (Vars_iter i) |
Removes a variable from the DDS. | |
void | del_var (Vars_iter i1, Vars_iter i2) |
Removes a range of variables from the DDS. | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
virtual AttrTable & | get_attr_table () |
int | get_dap_major () const |
Get the DAP major version as sent by the client. | |
int | get_dap_minor () const |
Get the DAP minor version as sent by the client. | |
string | get_dap_version () const |
BaseTypeFactory * | get_factory () const |
Keywords & | get_keywords () |
string | get_protocol () const |
int | get_protocol_major () const |
int | get_protocol_minor () const |
string | get_request_xml_base () const |
Get the URL that will return this DDS/DDX/DataThing. | |
int | get_timeout () |
BaseType * | get_var_index (int i) |
Get a variable. | |
Vars_iter | get_vars_iter (int i) |
Get an iterator. | |
string | get_version () const |
Get the server version string, unparsed. | |
int | get_version_major () const |
Returns the major version number. | |
int | get_version_minor () const |
Returns the minor version number. | |
bool | mark (const string &name, bool state) |
Mark the send_p flag of the named variable to state. | |
void | mark_all (bool state) |
int | num_var () |
Returns the number of variables in the DDS. | |
void | parse (string fname) |
Parse a DDS from a file with the given name. | |
void | parse (int fd) |
Parse a DDS from a file indicated by the input file descriptor. | |
void | parse (FILE *in=stdin) |
Parse a DDS from a file indicated by the input file descriptor. Read the persistent representation of a DDS from the FILE *in, parse it and create a matching binary object. | |
void | print (FILE *out) |
Print the entire DDS to the specified file. | |
void | print (ostream &out) |
Print the entire DDS to the specified ostream. | |
void | print_constrained (FILE *out) |
Print a constrained DDS to the specified file. | |
void | print_constrained (ostream &out) |
Print a constrained DDS to the specified ostream. | |
void | print_xml (FILE *out, bool constrained, const string &blob="") |
void | print_xml (ostream &out, bool constrained, const string &blob="") |
void | set_dap_major (int p) |
Set the DAP major version (typically using info from the client) | |
void | set_dap_minor (int p) |
Set the DAP minor version (typically using info from the client) | |
void | set_dap_version (const string &version_string) |
void | set_dap_version (double d) |
BaseTypeFactory * | set_factory (BaseTypeFactory *factory) |
void | set_protocol (const string &p) |
void | set_request_xml_base (const string &xb) |
void | set_timeout (int t) |
void | set_version (const string &v) |
void | tag_nested_sequences () |
Traverse DDS, set Sequence leaf nodes. | |
void | timeout_off () |
void | timeout_on () |
virtual void | transfer_attributes (DAS *das) |
BaseType * | var (const string &n, BaseType::btp_stack &s) |
BaseType * | var (const string &n, BaseType::btp_stack *s=0) |
Find the variable with the given name. | |
Vars_iter | var_begin () |
Return an iterator to the first variable. | |
Vars_iter | var_end () |
Return an iterator. | |
Vars_riter | var_rbegin () |
Return a reverse iterator. | |
Vars_riter | var_rend () |
Return a reverse iterator. | |
virtual | ~DataDDS () |
Dataset Name Accessors | |
Get and set the dataset's name. This is the name of the dataset itself, and is not to be confused with the name of the file or disk on which it is stored. | |
string | get_dataset_name () const |
void | set_dataset_name (const string &n) |
File Name Accessor | |
Get and set the dataset's filename. This is the physical location on a disk where the dataset exists. The dataset name is simply a title. @see Dataset Name Accessors | |
string | filename () |
void | filename (const string &fn) |
Container Name Accessor | |
Get and set the current container. If there are multiple files being used to build this DDS, using a container will set a virtual structure for the current container. @see Dataset Name Accessors | |
string | container_name () |
void | container_name (const string &cn) |
Structure * | container () |
Protected Member Functions | |
void | duplicate (const DDS &dds) |
BaseType * | exact_match (const string &name, BaseType::btp_stack *s=0) |
BaseType * | leaf_match (const string &name, BaseType::btp_stack *s=0) |
This class adds some useful state information to the DDS structure. It is for use on the client side of the connection.
typedef std::vector<BaseType *>::const_iterator libdap::DDS::Vars_citer [inherited] |
typedef std::vector<BaseType *>::iterator libdap::DDS::Vars_iter [inherited] |
typedef std::vector<BaseType *>::reverse_iterator libdap::DDS::Vars_riter [inherited] |
libdap::DataDDS::DataDDS | ( | BaseTypeFactory * | factory, |
const string & | n = "" , |
||
const string & | v = "" , |
||
const string & | p = "" |
||
) |
factory | Use this BaseTypeFactory to instantiate the variables. Caller must free; can also be set using the set_factory() method. Never delete until just before deleting the DDS istelf unless you intend to replace the factory with a new instance. |
n | The name of the dataset. Can also be set using the set_dataset_name() method. |
v | The server version. |
p | The protocol version. |
Definition at line 163 of file DataDDS.cc.
virtual libdap::DataDDS::~DataDDS | ( | ) | [inline, virtual] |
void libdap::DDS::add_var | ( | BaseType * | bt | ) | [inherited] |
bt | Source variable. |
Definition at line 436 of file DDS.cc.
References libdap::Structure::add_var(), DBG2, and libdap::BaseType::ptr_duplicate().
Referenced by libdap::DDS::container_name(), libdap::DDXParser::ddx_end_document(), and libdap::ConstraintEvaluator::eval_function_clauses().
bool libdap::DDS::check_semantics | ( | bool | all = false | ) | [inherited] |
Check the semantics of the DDS describing a complete dataset. If ALL is true, check not only the semantics of THIS->TABLE, but also recursively all ctor types in the THIS->TABLE. By default, ALL is false since parsing a DDS input file runs semantic checks on all variables (but not the dataset itself.
all | If true, recursively check the individual members of compound variables. |
Definition at line 1072 of file DDS.cc.
References libdap::unique_names().
Structure * libdap::DDS::container | ( | ) | [inherited] |
string libdap::DDS::container_name | ( | ) | [inherited] |
void libdap::DDS::container_name | ( | const string & | cn | ) | [inherited] |
Set the current container name and get or create a structure for that name.
Definition at line 395 of file DDS.cc.
References libdap::DDS::add_var(), and libdap::DDS::var().
void libdap::DDS::del_var | ( | const string & | n | ) | [inherited] |
Remove the named variable from the DDS. This method is not smart about looking up names. The variable must exist at the top level of the DDS and must match exactly the name given.
n | The name of the variable to remove. |
Definition at line 467 of file DDS.cc.
References libdap::Structure::del_var().
void libdap::DDS::del_var | ( | Vars_iter | i | ) | [inherited] |
void libdap::DDS::del_var | ( | Vars_iter | i1, |
Vars_iter | i2 | ||
) | [inherited] |
void libdap::DataDDS::dump | ( | ostream & | strm | ) | const [virtual] |
Displays the pointer value of this instance and then calls parent dump
strm | C++ i/o stream to dump the information to |
Reimplemented from libdap::DDS.
Definition at line 128 of file DataDDS.cc.
void libdap::DDS::duplicate | ( | const DDS & | dds | ) | [protected, inherited] |
Definition at line 111 of file DDS.cc.
References DBG, libdap::DDS::var_begin(), and libdap::DDS::var_end().
Referenced by libdap::DDS::DDS(), and libdap::DDS::operator=().
BaseType * libdap::DDS::exact_match | ( | const string & | name, |
BaseType::btp_stack * | s = 0 |
||
) | [protected, inherited] |
Definition at line 597 of file DDS.cc.
References DBG2, libdap::BaseType::name(), libdap::DDS::var(), and libdap::BaseType::var().
Referenced by libdap::DDS::var().
string libdap::DDS::filename | ( | ) | [inherited] |
void libdap::DDS::filename | ( | const string & | fn | ) | [inherited] |
AttrTable & libdap::DDS::get_attr_table | ( | ) | [virtual, inherited] |
Get the attribute table for the global attributes.
Definition at line 266 of file DDS.cc.
Referenced by libdap::DDXParser::ddx_start_document().
int libdap::DDS::get_dap_major | ( | ) | const [inline, inherited] |
Definition at line 257 of file DDS.h.
Referenced by libdap::DDS::print_xml().
int libdap::DDS::get_dap_minor | ( | ) | const [inline, inherited] |
Definition at line 259 of file DDS.h.
Referenced by libdap::DDS::print_xml().
string libdap::DDS::get_dap_version | ( | ) | const [inline, inherited] |
Definition at line 269 of file DDS.h.
Referenced by libdap::ResponseBuilder::send_data(), libdap::ResponseBuilder::send_dds(), and libdap::ResponseBuilder::send_ddx().
string libdap::DDS::get_dataset_name | ( | ) | const [inherited] |
Returns the dataset's name.
Definition at line 250 of file DDS.cc.
Referenced by libdap::ConstraintEvaluator::eval_function_clauses().
BaseTypeFactory* libdap::DDS::get_factory | ( | ) | const [inline, inherited] |
Return the factory which makes instances of the Byte, ..., Grid type classes. Specialize BaseTypeFactory so that a DDS will be populated with your client or server's specialized types.
Definition at line 233 of file DDS.h.
Referenced by libdap::ConstraintEvaluator::eval_function_clauses(), libdap::Connect::request_ddx(), and libdap::Connect::request_ddx_url().
Keywords& libdap::DDS::get_keywords | ( | ) | [inline, inherited] |
string libdap::DataDDS::get_protocol | ( | ) | const [inline] |
Definition at line 129 of file DataDDS.h.
Referenced by libdap::Sequence::deserialize(), libdap::ConstraintEvaluator::eval_function_clauses(), and libdap::Connect::read_data_no_mime().
int libdap::DataDDS::get_protocol_major | ( | ) | const [inline] |
Definition at line 133 of file DataDDS.h.
Referenced by libdap::Sequence::deserialize().
int libdap::DataDDS::get_protocol_minor | ( | ) | const [inline] |
Definition at line 137 of file DataDDS.h.
Referenced by libdap::Sequence::deserialize().
string libdap::DDS::get_request_xml_base | ( | ) | const [inline, inherited] |
Definition at line 274 of file DDS.h.
Referenced by libdap::DDS::print_xml().
int libdap::DDS::get_timeout | ( | ) | [inherited] |
BaseType * libdap::DDS::get_var_index | ( | int | i | ) | [inherited] |
DDS::Vars_iter libdap::DDS::get_vars_iter | ( | int | i | ) | [inherited] |
string libdap::DataDDS::get_version | ( | ) | const [inline] |
Definition at line 109 of file DataDDS.h.
Referenced by libdap::ConstraintEvaluator::eval_function_clauses().
int libdap::DataDDS::get_version_major | ( | ) | const [inline] |
int libdap::DataDDS::get_version_minor | ( | ) | const [inline] |
BaseType * libdap::DDS::leaf_match | ( | const string & | name, |
BaseType::btp_stack * | s = 0 |
||
) | [protected, inherited] |
Definition at line 561 of file DDS.cc.
References DBG, libdap::BaseType::is_constructor_type(), libdap::BaseType::is_vector_type(), libdap::BaseType::name(), and libdap::BaseType::var().
Referenced by libdap::DDS::var().
bool libdap::DDS::mark | ( | const string & | n, |
bool | state | ||
) | [inherited] |
Mark the named variable by setting its SEND_P flag to STATE (true indicates that it is to be sent). Names must be fully qualified. @note For aggregate types this sets each part to STATE when STATE is True. Thus, if State is True and N is `exp1.test', then both `exp1' and `test' have their SEND_P flag set to True. If STATE is False, then the SEND_P flag of the `test' is set to False, but `exp1' is left unchanged. This means that a single variable can be removed from the current projection without removing all the other children of its parent. See the mfunc set_send_p(). @return True if the named variable was found, false otherwise.
Definition at line 1118 of file DDS.cc.
References DBG2, libdap::BaseType::name(), libdap::BaseType::set_send_p(), libdap::BaseType::type_name(), and libdap::DDS::var().
void libdap::DDS::mark_all | ( | bool | state | ) | [inherited] |
int libdap::DDS::num_var | ( | ) | [inherited] |
void libdap::DDS::parse | ( | string | fname | ) | [inherited] |
Definition at line 722 of file DDS.cc.
References cannot_read_file.
Referenced by libdap::DDS::parse(), libdap::Ancillary::read_ancillary_dds(), libdap::Connect::request_dds(), and libdap::Connect::request_dds_url().
void libdap::DDS::parse | ( | int | fd | ) | [inherited] |
Definition at line 743 of file DDS.cc.
References libdap::DDS::parse().
void libdap::DDS::parse | ( | FILE * | in = stdin | ) | [inherited] |
in | Read the persistent DDS from this FILE*. |
InternalErr | Thrown if in is null |
Error | Thrown if the parse fails. |
Definition at line 772 of file DDS.cc.
References DBG2, dds_buffer(), dds_delete_buffer(), dds_switch_to_buffer(), and ddsparse().
void libdap::DDS::print | ( | FILE * | out | ) | [inherited] |
Definition at line 800 of file DDS.cc.
References libdap::id2www().
Referenced by main(), libdap::ResponseBuilder::send_dds(), and libdap::DODSFilter::send_dds().
void libdap::DDS::print | ( | ostream & | out | ) | [inherited] |
Definition at line 823 of file DDS.cc.
References libdap::id2www().
void libdap::DDS::print_constrained | ( | FILE * | out | ) | [inherited] |
Print those parts (variables) of the DDS structure to OS that are marked to be sent after evaluating the constraint expression.
Definition at line 848 of file DDS.cc.
References libdap::id2www().
Referenced by libdap::ResponseBuilder::dataset_constraint(), libdap::DODSFilter::dataset_constraint(), libdap::ResponseBuilder::send_dds(), and libdap::DODSFilter::send_dds().
void libdap::DDS::print_constrained | ( | ostream & | out | ) | [inherited] |
Print those parts (variables) of the DDS structure to OS that are marked to be sent after evaluating the constraint expression.
Definition at line 876 of file DDS.cc.
References libdap::id2www().
void libdap::DDS::print_xml | ( | FILE * | out, |
bool | constrained, | ||
const string & | blob = "" |
||
) | [inherited] |
Print an XML representation of this DDS. This method is used to generate the part of the DDX response. The Dataset
tag is not written by this code. The caller of this method must handle writing that and including the dataBLOB
tag.
out | Destination. |
constrained | True if the output should be limited to just those variables that are in the projection of the current constraint expression. |
blob | The dataBLOB href. |
Definition at line 918 of file DDS.cc.
References c_dap20_namespace, c_dap32_namespace, c_default_dap20_schema_location, c_default_dap32_schema_location, libdap::DDS::get_dap_major(), libdap::DDS::get_dap_minor(), libdap::id2xml(), libdap::AttrTable::print_xml(), libdap::DDS::var_begin(), and libdap::DDS::var_end().
Referenced by libdap::ResponseBuilder::dataset_constraint_ddx(), libdap::DODSFilter::dataset_constraint_ddx(), main(), libdap::ResponseBuilder::send_ddx(), and libdap::DODSFilter::send_ddx().
void libdap::DDS::print_xml | ( | ostream & | out, |
bool | constrained, | ||
const string & | blob = "" |
||
) | [inherited] |
Print an XML representation of this DDS. This method is used to generate the part of the DDX response. The Dataset
tag is not written by this code. The caller of this method must handle writing that and including the dataBLOB
tag.
out | Destination ostream. |
constrained | True if the output should be limited to just those variables that are in the projection of the current constraint expression. |
blob | The dataBLOB href. |
Definition at line 994 of file DDS.cc.
References c_dap20_namespace, c_dap32_namespace, c_default_dap20_schema_location, c_default_dap32_schema_location, c_xml_namespace, libdap::DDS::get_dap_major(), libdap::DDS::get_dap_minor(), libdap::DDS::get_request_xml_base(), grddl_transformation_dap32, libdap::id2xml(), libdap::AttrTable::print_xml(), libdap::DDS::var_begin(), and libdap::DDS::var_end().
void libdap::DDS::set_dap_major | ( | int | p | ) | [inherited] |
Definition at line 295 of file DDS.cc.
Referenced by libdap::DDS::set_dap_version().
void libdap::DDS::set_dap_minor | ( | int | p | ) | [inherited] |
Definition at line 311 of file DDS.cc.
Referenced by libdap::DDS::set_dap_version().
void libdap::DDS::set_dap_version | ( | const string & | version_string | ) | [inherited] |
Given the dap protocol version either from a MIME header or from within the DDX Dataset element, parse that string and set the DDS fields.
version_string | The version string from the MIME (request) or XML document. |
Definition at line 329 of file DDS.cc.
References DBG, libdap::DDS::set_dap_major(), and libdap::DDS::set_dap_minor().
Referenced by libdap::DDXParser::ddx_sax2_start_element().
void libdap::DDS::set_dap_version | ( | double | d | ) | [inherited] |
Given the dap protocol version, parse that string and set the DDS fields. This version of th method takes a double - a value that would be passed to a server-side function. This provides a way to set the protocol using stuff in the URL.
d | The protocol version requested by the client, as a double. |
Definition at line 362 of file DDS.cc.
References DBG, libdap::DDS::set_dap_major(), and libdap::DDS::set_dap_minor().
void libdap::DDS::set_dataset_name | ( | const string & | n | ) | [inherited] |
Sets the dataset name.
Definition at line 257 of file DDS.cc.
Referenced by libdap::DDXParser::ddx_sax2_start_element().
BaseTypeFactory* libdap::DDS::set_factory | ( | BaseTypeFactory * | factory | ) | [inline, inherited] |
void libdap::DataDDS::set_protocol | ( | const string & | p | ) | [inline] |
void libdap::DDS::set_request_xml_base | ( | const string & | xb | ) | [inline, inherited] |
void libdap::DDS::set_timeout | ( | int | t | ) | [inherited] |
Definition at line 695 of file DDS.cc.
Referenced by libdap::ResponseBuilder::send_data(), libdap::DODSFilter::send_data(), libdap::ResponseBuilder::send_data_ddx(), and libdap::DODSFilter::send_data_ddx().
void libdap::DataDDS::set_version | ( | const string & | v | ) | [inline] |
void libdap::DDS::tag_nested_sequences | ( | ) | [inherited] |
Definition at line 710 of file DDS.cc.
References libdap::dods_sequence_c, and libdap::dods_structure_c.
Referenced by libdap::ResponseBuilder::send_data(), libdap::DODSFilter::send_data(), libdap::ResponseBuilder::send_data_ddx(), and libdap::DODSFilter::send_data_ddx().
void libdap::DDS::timeout_off | ( | ) | [inherited] |
Definition at line 687 of file DDS.cc.
Referenced by libdap::Grid::intern_data(), libdap::BaseType::intern_data(), libdap::Sequence::read_row(), libdap::Str::serialize(), libdap::Int16::serialize(), libdap::UInt16::serialize(), libdap::Float32::serialize(), libdap::UInt32::serialize(), libdap::Int32::serialize(), libdap::Float64::serialize(), libdap::Byte::serialize(), libdap::Vector::serialize(), libdap::Structure::serialize(), and libdap::Grid::serialize().
void libdap::DDS::timeout_on | ( | ) | [inherited] |
Definition at line 679 of file DDS.cc.
Referenced by libdap::Grid::intern_data(), libdap::BaseType::intern_data(), libdap::Sequence::read_row(), libdap::Str::serialize(), libdap::Int16::serialize(), libdap::UInt16::serialize(), libdap::Float32::serialize(), libdap::UInt32::serialize(), libdap::Int32::serialize(), libdap::Float64::serialize(), libdap::Byte::serialize(), libdap::Vector::serialize(), libdap::Structure::serialize(), and libdap::Grid::serialize().
void libdap::DDS::transfer_attributes | ( | DAS * | das | ) | [virtual, inherited] |
This is the main method used to transfer attributes from a DAS object into a DDS. This uses the BaseType::transfer_attributes() method and the various implementations found here (in the constructors classes) and in handlers.
This method uses a deep copy to transfer the attributes, so it is safe to delete the source DAS object passed to this method once it is done.
das | Transfer (copy) attributes from this DAS object. |
Definition at line 199 of file DDS.cc.
References libdap::AttrTable::append_container(), libdap::AttrTable::attr_begin(), libdap::Attr_container, libdap::AttrTable::attr_end(), libdap::DAS::container_name(), DBG, libdap::AttrTable::get_name(), libdap::DAS::get_top_level_attributes(), libdap::DDS::var(), libdap::DDS::var_begin(), and libdap::DDS::var_end().
Referenced by main().
BaseType * libdap::DDS::var | ( | const string & | n, |
BaseType::btp_stack & | s | ||
) | [inherited] |
Search for for variable n as above but record all compound type variables which ultimately contain n on s. This stack can then be used to mark the contained compound-type variables as part of the current projection.
Definition at line 523 of file DDS.cc.
Referenced by libdap::DDS::container_name(), libdap::DDS::exact_match(), libdap::DDS::mark(), and libdap::DDS::transfer_attributes().
BaseType * libdap::DDS::var | ( | const string & | n, |
BaseType::btp_stack * | s = 0 |
||
) | [inherited] |
Returns a pointer to the named variable. If the name contains one or more field separators then the function looks for a variable whose name matches exactly. If the name contains no field separators then the function looks first in the top level and then in all subsequent levels and returns the first occurrence found. In general, this function searches constructor types in the order in which they appear in the DDS, but there is no requirement that it do so.
n | The name of the variable to find. |
s | If given, this value-result parameter holds the path to the returned BaseType. Thus, this method can return the FQN for the variable n. |
Definition at line 547 of file DDS.cc.
References libdap::DDS::exact_match(), libdap::DDS::leaf_match(), libdap::Structure::var(), and libdap::www2id().
DDS::Vars_iter libdap::DDS::var_begin | ( | ) | [inherited] |
Returns the first variable in the DDS.
Definition at line 630 of file DDS.cc.
Referenced by libdap::ResponseBuilder::dataset_constraint(), libdap::DODSFilter::dataset_constraint(), libdap::ResponseBuilder::dataset_constraint_ddx(), libdap::DODSFilter::dataset_constraint_ddx(), libdap::DDS::duplicate(), libdap::DDS::print_xml(), and libdap::DDS::transfer_attributes().
DDS::Vars_iter libdap::DDS::var_end | ( | ) | [inherited] |
Definition at line 642 of file DDS.cc.
Referenced by libdap::ResponseBuilder::dataset_constraint(), libdap::DODSFilter::dataset_constraint(), libdap::ResponseBuilder::dataset_constraint_ddx(), libdap::DODSFilter::dataset_constraint_ddx(), libdap::DDS::duplicate(), libdap::DDS::print_xml(), and libdap::DDS::transfer_attributes().
DDS::Vars_riter libdap::DDS::var_rbegin | ( | ) | [inherited] |
DDS::Vars_riter libdap::DDS::var_rend | ( | ) | [inherited] |