OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
ncml_module::NCMLUtil Class Reference

Static class of utility functions. More...

#include <NCMLUtil.h>

Collaboration diagram for ncml_module::NCMLUtil:
Collaboration graph

Public Member Functions

 ~NCMLUtil ()
 

Static Public Member Functions

static void copyVariablesAndAttributesInto (libdap::DDS *dds_out, const libdap::DDS &dds_in)
 Make a deep copy of the global attributes and variables within dds_in into *dds_out. More...
 
static libdap::DDS * getDDSFromEitherResponse (BESDapResponse *response)
 Return the DDS* for the given response object. More...
 
static void hackGlobalAttributesForDAP2 (libdap::AttrTable &global_attributes, const std::string &global_container_name)
 
static bool isAllWhitespace (const std::string &str)
 Is all the string whitespace as defined by chars in WHITESPACE ? More...
 
static bool isAscii (const std::string &str)
 Does the string contain only ASCII 7-bit characters according to isascii()? More...
 
static void populateDASFromDDS (libdap::DAS *das, const libdap::DDS &dds_const)
 Given we have a valid attribute tree inside of the DDS, recreate it in the DAS. More...
 
static void setVariableNameProperly (libdap::BaseType *pVar, const std::string &name)
 Currently BaseType::set_name only sets in BaseType. More...
 
static int tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" \t")
 Split str into tokens using the characters in delimiters as split boundaries. More...
 
static int tokenizeChars (const std::string &str, std::vector< std::string > &tokens)
 Split str into a vector with one char in str per token slot. More...
 
static bool toUnsignedInt (const std::string &stringVal, unsigned int &oVal)
 Convert the string to an unsigned int into oVal. More...
 
static void trim (std::string &str, const std::string &trimChars=WHITESPACE)
 Trim from both left and right. More...
 
static void trimAll (std::vector< std::string > &tokens, const std::string &trimChars=WHITESPACE)
 Call trim on each string in tokens. More...
 
static void trimLeft (std::string &str, const std::string &trimChars=WHITESPACE)
 Trim off any number of any character in trimChars from the left side of str in place. More...
 
static void trimRight (std::string &str, const std::string &trimChars=WHITESPACE)
 Trim off any number of any character in trimChars from the right side of str in place. More...
 

Static Public Attributes

static const std::string WHITESPACE = " \t\n"
 Delimiter set for tokenizing whitespace separated data. More...
 

Detailed Description

Static class of utility functions.

Definition at line 72 of file NCMLUtil.h.

Constructor & Destructor Documentation

ncml_module::NCMLUtil::~NCMLUtil ( )
inline

Definition at line 76 of file NCMLUtil.h.

Member Function Documentation

void ncml_module::NCMLUtil::copyVariablesAndAttributesInto ( libdap::DDS *  dds_out,
const libdap::DDS &  dds_in 
)
static

Make a deep copy of the global attributes and variables within dds_in into *dds_out.

Doesn't affect any other top-level data.

Parameters
dds_outplace to copy global attribute table and variables into
dds_insource DDS

Definition at line 256 of file NCMLUtil.cc.

References VALID_PTR.

Referenced by ncml_module::NCMLRequestHandler::ncml_build_dds().

libdap::DDS * ncml_module::NCMLUtil::getDDSFromEitherResponse ( BESDapResponse response)
static

Return the DDS* for the given response object.

It is assumed to be either a BESDDSResponse or BESDataDDSResponse.

Parameters
reponseeither a BESDDSResponse or BESDataDDSResponse to extract DDS from.
Returns
the DDS* contained in the response object, or NULL if incorrect response type.

Definition at line 282 of file NCMLUtil.cc.

References BESDEBUG, BESDDSResponse::get_dds(), and BESDataDDSResponse::get_dds().

Referenced by ncml_module::NetcdfElement::getDDS(), agg_util::DDSLoader::loadInto(), ncml_module::NCMLRequestHandler::ncml_build_das(), ncml_module::NCMLRequestHandler::ncml_build_data(), ncml_module::NCMLRequestHandler::ncml_build_dds(), and ncml_module::NCMLRequestHandler::ncml_build_dmr().

Here is the call graph for this function:

void ncml_module::NCMLUtil::hackGlobalAttributesForDAP2 ( libdap::AttrTable &  global_attributes,
const std::string &  global_container_name 
)
static
bool ncml_module::NCMLUtil::isAscii ( const std::string &  str)
static

Does the string contain only ASCII 7-bit characters according to isascii()?

Definition at line 96 of file NCMLUtil.cc.

Referenced by ncml_module::NCMLParser::checkDataIsValidForCanonicalTypeOrThrow().

void ncml_module::NCMLUtil::populateDASFromDDS ( libdap::DAS *  das,
const libdap::DDS &  dds_const 
)
static

Given we have a valid attribute tree inside of the DDS, recreate it in the DAS.

Parameters
dasthe das to clear and populate
dds_constthe source dds

Definition at line 200 of file NCMLUtil.cc.

References BESDEBUG, and VALID_PTR.

Referenced by ncml_module::NCMLRequestHandler::ncml_build_das().

void ncml_module::NCMLUtil::setVariableNameProperly ( libdap::BaseType *  pVar,
const std::string &  name 
)
static

Currently BaseType::set_name only sets in BaseType.

Unfortunately, the DDS transmission for Vector subclasses uses the name of the template BaseType* describing the variable, which is not set by set_name. This is a workaround until Vector overrides BaseType::set_name to also set the name of the template _var if there is one.

Definition at line 398 of file NCMLUtil.cc.

References VALID_PTR.

int ncml_module::NCMLUtil::tokenize ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " \t" 
)
static

Split str into tokens using the characters in delimiters as split boundaries.

Return the number of tokens appended to tokens.

Definition at line 54 of file NCMLUtil.cc.

References BESDEBUG.

Referenced by ncml_module::ValuesElement::handleContent(), and ncml_module::ValuesElement::handleEnd().

int ncml_module::NCMLUtil::tokenizeChars ( const std::string &  str,
std::vector< std::string > &  tokens 
)
static

Split str into a vector with one char in str per token slot.

Definition at line 82 of file NCMLUtil.cc.

Referenced by ncml_module::ValuesElement::handleContent(), and ncml_module::ValuesElement::handleEnd().

bool ncml_module::NCMLUtil::toUnsignedInt ( const std::string &  stringVal,
unsigned int &  oVal 
)
static

Convert the string to an unsigned int into oVal.

Return success, else oVal is invalid on return.

Parameters
stringValval to parse
oVallocation to place parsed result
Returns
success at parse

Definition at line 146 of file NCMLUtil.cc.

Referenced by ncml_module::NetcdfElement::getNcoordsAsUnsignedInt().

static void ncml_module::NCMLUtil::trim ( std::string &  str,
const std::string &  trimChars = WHITESPACE 
)
inlinestatic

Trim from both left and right.

Definition at line 117 of file NCMLUtil.h.

References trimLeft(), and trimRight().

Here is the call graph for this function:

void ncml_module::NCMLUtil::trimAll ( std::vector< std::string > &  tokens,
const std::string &  trimChars = WHITESPACE 
)
static

Call trim on each string in tokens.

tokens is mutated to contain the trimmed strings.

Definition at line 136 of file NCMLUtil.cc.

void ncml_module::NCMLUtil::trimLeft ( std::string &  str,
const std::string &  trimChars = WHITESPACE 
)
static

Trim off any number of any character in trimChars from the left side of str in place.

Definition at line 116 of file NCMLUtil.cc.

Referenced by trim().

void ncml_module::NCMLUtil::trimRight ( std::string &  input,
const std::string &  trimChars = WHITESPACE 
)
static

Trim off any number of any character in trimChars from the right side of str in place.

Trim off any number of any character in trimChars from the right side of input.

Returns
the substring after removing all trailing characters in trimChars.

Definition at line 126 of file NCMLUtil.cc.

Referenced by trim().

Member Data Documentation

const std::string ncml_module::NCMLUtil::WHITESPACE = " \t\n"
static

Delimiter set for tokenizing whitespace separated data.

Currently " \t"

Definition at line 79 of file NCMLUtil.h.

Referenced by ncml_module::ValuesElement::handleContent(), ncml_module::ValuesElement::handleEnd(), ncml_module::ValuesElement::toString(), and ncml_module::AttributeElement::toString().


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