bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
ncml_module::NCMLUtil Class Reference

#include <NCMLUtil.h>

Collaboration diagram for ncml_module::NCMLUtil:
Collaboration graph

Static Public Member Functions

static void copyVariablesAndAttributesInto (libdap::DDS *dds_out, const libdap::DDS &dds_in)
 
static libdap::DDS * getDDSFromEitherResponse (BESDapResponse *response)
 
static void hackGlobalAttributesForDAP2 (libdap::AttrTable &global_attributes, const std::string &global_container_name)
 
static bool isAllWhitespace (const std::string &str)
 
static bool isAscii (const std::string &str)
 
static void populateDASFromDDS (libdap::DAS *das, const libdap::DDS &dds_const)
 
static void setVariableNameProperly (libdap::BaseType *pVar, const std::string &name)
 
static int tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" \t")
 
static int tokenizeChars (const std::string &str, std::vector< std::string > &tokens)
 
static bool toUnsignedInt (const std::string &stringVal, unsigned int &oVal)
 
static void trim (std::string &str, const std::string &trimChars=WHITESPACE)
 
static void trimAll (std::vector< std::string > &tokens, const std::string &trimChars=WHITESPACE)
 
static void trimLeft (std::string &str, const std::string &trimChars=WHITESPACE)
 
static void trimRight (std::string &str, const std::string &trimChars=WHITESPACE)
 

Static Public Attributes

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

Detailed Description

Static class of utility functions

Definition at line 70 of file NCMLUtil.h.

Constructor & Destructor Documentation

◆ ~NCMLUtil()

ncml_module::NCMLUtil::~NCMLUtil ( )
inline

Definition at line 75 of file NCMLUtil.h.

Member Function Documentation

◆ copyVariablesAndAttributesInto()

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 332 of file NCMLUtil.cc.

◆ getDDSFromEitherResponse()

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 356 of file NCMLUtil.cc.

◆ hackGlobalAttributesForDAP2()

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

Definition at line 386 of file NCMLUtil.cc.

◆ isAllWhitespace()

bool ncml_module::NCMLUtil::isAllWhitespace ( const std::string & str)
static

Is all the string whitespace as defined by chars in WHITESPACE ?

Definition at line 105 of file NCMLUtil.cc.

◆ isAscii()

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 94 of file NCMLUtil.cc.

◆ populateDASFromDDS()

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 276 of file NCMLUtil.cc.

◆ setVariableNameProperly()

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 462 of file NCMLUtil.cc.

◆ tokenize()

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 58 of file NCMLUtil.cc.

◆ tokenizeChars()

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.

◆ toUnsignedInt()

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 135 of file NCMLUtil.cc.

◆ trim()

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

Trim from both left and right.

Definition at line 110 of file NCMLUtil.h.

◆ trimAll()

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 127 of file NCMLUtil.cc.

◆ trimLeft()

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 110 of file NCMLUtil.cc.

◆ trimRight()

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 119 of file NCMLUtil.cc.

Member Data Documentation

◆ WHITESPACE

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

Delimiter set for tokenizing whitespace separated data. Currently " \t"

Definition at line 80 of file NCMLUtil.h.


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