32 #include <ConstraintEvaluator.h>
33 #include <XMLWriter.h>
34 #include <DODSFilter.h>
36 #include <InternalErr.h>
38 #include <mime_util.h>
39 #include <XMLWriter.h>
56 BESDEBUG(
"xd",
"BESXDTransmit::send_base_ascii" << endl);
59 ConstraintEvaluator & ce = bdds->
get_ce();
66 BESDEBUG(
"xd",
"BESXDTransmit::send_base_ascii - " "parsing constraint: " << constraint << endl);
67 ce.parse_constraint(constraint, *dds);
69 catch (InternalErr &e) {
70 string err =
"Failed to parse the constraint expression: " + e.get_error_message();
71 throw BESDapError(err,
true, e.get_error_code(), __FILE__, __LINE__);
74 string err =
"Failed to parse the constraint expression: " + e.get_error_message();
75 throw BESDapError(err,
false, e.get_error_code(), __FILE__, __LINE__);
78 string err = (string)
"Failed to parse the constraint expression: " +
"Unknown exception caught";
82 BESDEBUG(
"xd",
"BESXDTransmit::send_base_ascii - " "tagging sequences" << endl);
83 dds->tag_nested_sequences();
85 BESDEBUG(
"xd",
"BESXDTransmit::send_base_ascii - " "accessing container" << endl);
88 BESDEBUG(
"xd",
"BESXDTransmit::send_base_ascii - dataset_name = " << dataset_name << endl);
90 bool functional_constraint =
false;
93 if (ce.functional_expression()) {
94 BESDEBUG(
"xd",
"processing a functional constraint." << endl);
98 BaseType *var = ce.eval_function(*dds, dataset_name);
100 throw Error(unknown_error,
"Error calling the CE function.");
104 dds =
new DataDDS(
NULL,
"virtual");
105 functional_constraint =
true;
111 for (DDS::Vars_iter i = dds->var_begin(); i != dds->var_end(); i++) {
112 BESDEBUG(
"xd",
"processing var: " << (*i)->name() << endl);
113 if ((*i)->send_p()) {
114 BESDEBUG(
"xd",
"reading some data for: " << (*i)->name() << endl);
115 (**i).intern_data(ce, *dds);
120 catch (InternalErr &e) {
121 if (functional_constraint)
123 string err =
"Failed to read data: " + e.get_error_message();
124 throw BESDapError(err,
true, e.get_error_code(), __FILE__, __LINE__);
127 if (functional_constraint)
129 string err =
"Failed to read data: " + e.get_error_message();
130 throw BESDapError(err,
false, e.get_error_code(), __FILE__, __LINE__);
133 if (functional_constraint)
135 string err =
"Failed to read data: Unknown exception caught";
142 BESDEBUG(
"xd",
"converting to xd datadds" << endl);
145 BESDEBUG(
"xd",
"getting xd values" << endl);
150 BESDEBUG(
"xd",
"got the ascii values" << endl);
154 BESDEBUG(
"xd",
"done transmitting ascii" << endl);
156 catch (InternalErr &e) {
157 if (functional_constraint)
159 string err =
"Failed to get values as ascii: " + e.get_error_message();
160 throw BESDapError(err,
true, e.get_error_code(), __FILE__, __LINE__);
163 if (functional_constraint)
165 string err =
"Failed to get values as ascii: " + e.get_error_message();
166 throw BESDapError(err,
false, e.get_error_code(), __FILE__, __LINE__);
169 if (functional_constraint)
171 string err =
"Failed to get values as ascii: Unknown exception caught";
175 if (functional_constraint)
exception thrown if an internal error is found and is fatal to the BES
ostream & get_output_stream()
virtual string access()=0
returns the true name of this container
static void send_basic_ascii(BESResponseObject *obj, BESDataHandlerInterface &dhi)
error object created from libdap error objects and can handle those errors
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
ConstraintEvaluator & get_ce()
Structure storing information used by the BES to handle the request.
map< string, string > data
the map of string data that will be required for the current request.
void first_container()
set the container pointer to the first container in the containers list
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
void get_data_values_as_xml(DataDDS *dds, XMLWriter *writer)
Using the XDOutput::print_ascii(), write the data values to an output file/stream as ASCII...
DataDDS * datadds_to_xd_datadds(DataDDS *dds)
Abstract base class representing a specific set of information in response to a request to the BES...
BESContainer * container
pointer to current container in this interface