Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions D4ParserSax2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ void D4ParserSax2::dmr_start_element(void *p, const xmlChar *l, const xmlChar *p
if (parser->check_attribute("dmrVersion"))
parser->dmr()->set_dmr_version(parser->xml_attrs["dmrVersion"].value);

if (parser->check_attribute("dap:serialization"))
parser->dmr()->set_serialization(parser->xml_attrs["dap:serialization"].value);

if (parser->check_attribute("base"))
parser->dmr()->set_request_xml_base(parser->xml_attrs["base"].value);

Expand Down
6 changes: 5 additions & 1 deletion DDS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,11 @@ void DDS::print_dmr(ostream &out, bool constrained) {

if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dmrVersion",
(const xmlChar *)get_dmr_version().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dapVersion");
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dmrVersion");

if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dap:serialization",
(const xmlChar *)get_serialization().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dap:serialization");

if (!get_request_xml_base().empty()) {
if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"xml:base",
Expand Down
3 changes: 3 additions & 0 deletions DDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ class DDS : public DapObj {
/** @brief Returns the DAP4 DMR version corresponding to DDS exports. */
string get_dmr_version() const { return "1.0"; }

/** @brief Returns the DAP4 data serialization scheme. */
string get_serialization() const { return "4.0"; }

/// @deprecated
void set_dap_major(int p);
/// @deprecated
Expand Down
7 changes: 6 additions & 1 deletion DMR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void DMR::m_duplicate(const DMR &dmr) {
d_dap_version = dmr.d_dap_version; // String version of the protocol

d_dmr_version = dmr.d_dmr_version;
d_serialization = dmr.d_serialization;

d_request_xml_base = dmr.d_request_xml_base;

Expand Down Expand Up @@ -332,7 +333,11 @@ void DMR::print_dap4(XMLWriter &xml, bool constrained) {

if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dmrVersion",
(const xmlChar *)dmr_version().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dapVersion");
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dmrVersion");

if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"dap:serialization",
(const xmlChar *)serialization().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for dap:serialization");

if (xmlTextWriterWriteAttribute(xml.get_writer(), (const xmlChar *)"name", (const xmlChar *)name().c_str()) < 0)
throw InternalErr(__FILE__, __LINE__, "Could not write attribute for name");
Expand Down
20 changes: 18 additions & 2 deletions DMR.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,15 @@ class DMR : public DapObj {
/// The version of the DMR document
/// Version 1.0 is the original serialization scheme - Groups were serialized first,
/// then the top-level variables.
/// The 2.0 version indicates the DAP4 Serialization bug fix.
std::string d_dmr_version = "2.0";
std::string d_dmr_version = "1.0";

/// The version of the DMR document
/// Version 1.0 is the original serialization scheme - Groups were serialized first,
/// then the top-level variables.
/// When we fixed the DAP4 Serialization bug we added this along
/// with a Dataset xml attribute dap:serialization to express this state.
/// the original patch changed the d_dmr_version to 2.0 - ndp 4/14/26
std::string d_serialization = "4.0";

/// The URL for the request base
std::string d_request_xml_base;
Expand Down Expand Up @@ -179,6 +186,15 @@ class DMR : public DapObj {
*/
void set_dmr_version(const std::string &v) { d_dmr_version = v; }

/** @brief Returns the DAP4 serialization that the source service will deliver. */
std::string serialization() const { return d_serialization; }

/**
* @brief Sets the DMR document version string.
* @param v DMR version value.
*/
void set_serialization(const std::string &v) { d_serialization = v; }

/// Get the URL that will return this DMR
std::string request_xml_base() const { return d_request_xml_base; }

Expand Down
Loading