bes Updated for version 3.20.13
|
Classes | |
struct | url |
Static Public Member Functions | |
static long | get_current_memory_usage () noexcept |
Get the Resident Set Size in KB. | |
static void | trim_if_surrounding_quotes (std::string &value) |
Remove double quotes around a string This function will remove a leading and/or trailing double quote surrounding a string. | |
static void | trim_if_trailing_slash (std::string &value) |
If the string ends in a slash, remove it This function works for empty strings (doing nothing). If the string ends in a '/' it will be removed. | |
MIME utility functions | |
These functions are used to create the MIME headers for a message from a server to a client. NB: These functions actually write both the response status line and the header.
| |
static void | set_mime_text (std::ostream &strm) |
Generate an HTTP 1.0 response header for a text document. | |
static void | set_mime_html (std::ostream &strm) |
Generate an HTTP 1.0 response header for a html document. | |
static std::string | www2id (const std::string &in, const std::string &escape="%", const std::string &except="") |
static std::string | unhexstring (const std::string &s) |
static std::string | lowercase (const std::string &s) |
static std::string | unescape (const std::string &s) |
static void | check_path (const std::string &path, const std::string &root, bool follow_sym_links) |
Is the combination of root + path a pathname the BES can/should access? | |
static char * | fastpidconverter (char *buf, int base) |
static char * | fastpidconverter (long val, char *buf, int base) |
static void | removeLeadingAndTrailingBlanks (std::string &key) |
static std::string | id2xml (std::string in, const std::string ¬_allowed="><&'\"") |
static std::string | xml2id (std::string in) |
static void | explode (char delim, const std::string &str, std::list< std::string > &values) |
static std::string | implode (const std::list< std::string > &values, char delim) |
static void | url_explode (const std::string &url_str, BESUtil::url &url_parts) |
Given a url, break the url into its different parts. | |
static std::string | url_create (BESUtil::url &url_parts) |
static std::string | assemblePath (const std::string &firstPart, const std::string &secondPart, bool leadingSlash=false, bool trailingSlash=false) |
Assemble path fragments making sure that they are separated by a single '/' character. | |
static std::string | pathConcat (const std::string &firstPart, const std::string &secondPart, char separator='/') |
Concatenate path fragments making sure that they are separated by a single '/' character. | |
static bool | endsWith (std::string const &fullString, std::string const &ending) |
static void | conditional_timeout_cancel () |
Checks if the timeout alarm should be canceled based on the value of the BES key BES.CancelTimeoutOnSend. | |
static void | exit_on_request_timeout () |
Checks if the timeout alarm should be canceled based on the value of the BES key BES.CancelTimeoutOnSend. | |
static unsigned int | replace_all (std::string &s, std::string find_this, std::string replace_with_this) |
Operates on the string 's' to replaces every occurrence of the value of the string 'find_this' with the value of the string 'replace_with_this'. | |
static std::string | normalize_path (const std::string &path, bool leading_separator, bool trailing_separator, std::string separator="/") |
Removes duplicate separators and provides leading and trailing separators as directed. | |
static void | tokenize (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters="/") |
static std::string | get_time (bool use_local_time=false) |
static std::string | get_time (time_t the_time, bool use_local_time=false) |
Returns the time represented by 'the_time' as an ISO8601 string. | |
static std::vector< std::string > | split (const std::string &s, char delim='/', bool skip_empty=true) |
Splits the string s into the return vector of tokens using the delimiter delim and skipping empty values as instructed by skip_empty. | |
static BESCatalog * | separateCatalogFromPath (std::string &path) |
static void | file_to_stream (const std::string &file_name, std::ostream &o_strm) |
Copies the contents of the file identified by file_name to the stream o_strm. | |
static uint64_t | file_to_stream_helper (const std::string &file_name, std::ostream &o_strm, uint64_t byteCount) |
static uint64_t | file_to_stream_task (const std::string &file_name, std::atomic< bool > &file_write_done, std::ostream &o_strm) |
|
static |
Assemble path fragments making sure that they are separated by a single '/' character.
If the parameter ensureLeadingSlash is true then the returned string will begin with a single '/' character followed by the string firstPart, a single '/' character, and the string secondPart.
firstPart | The first string to concatenate. |
secondPart | The second string to concatenate. |
leadingSlash | If this bool value is true then the returned string will have a leading slash. If the value of leadingSlash is false then the first character of the returned string will be the first character of the passed firstPart, which may be a slash. Default False. |
trailingSlash | If this bool is true then the returned string will end it a slash. If trailingSlash is false, then the returned string will not end with a slash. If trailing slash(es) need to be removed to accomplish this, then they will be removed. Default False. |
Definition at line 801 of file BESUtil.cc.
|
static |
Is the combination of root + path a pathname the BES can/should access?
Check if the specified path is valid
path | The path relative to the BES catalog root directory |
root | The BES catalog root directory |
follow_sym_links | True if the bes conf allows symbolic links, false by default |
Definition at line 382 of file BESUtil.cc.
|
static |
Checks if the timeout alarm should be canceled based on the value of the BES key BES.CancelTimeoutOnSend.
If the value of the BES Key BES.CancelTimeoutOnSend is false || no, then do not cancel the timeout alarm. The intent of this is to stop the timeout counter once the BES starts sending data back since, the network link used by a remote client may be low-bandwidth and data providers might want to ensure those users get their data (and don't submit second, third, ..., requests when/if the first one fails). The timeout is initiated in the BES framework when it first processes the request.
Default: If the BES key BES.CancelTimeoutOnSend is not set, or if it is set to true || yes then the timeout alarm will be canceled.
Definition at line 895 of file BESUtil.cc.
|
static |
Returns true if (the value of) 'fullString' ends with (the value of) 'ending', false otherwise.
Definition at line 834 of file BESUtil.cc.
|
static |
Checks if the timeout alarm should be canceled based on the value of the BES key BES.CancelTimeoutOnSend.
If the value of the BES Key BES.CancelTimeoutOnSend is false || no, then do not cancel the timeout alarm. The intent of this is to stop the timeout counter once the BES starts sending data back since, the network link used by a remote client may be low-bandwidth and data providers might want to ensure those users get their data (and don't submit second, third, ..., requests when/if the first one fails). The timeout is initiated in the BES framework when it first processes the request.
Default: If the BES key BES.CancelTimeoutOnSend is not set, or if it is set to true || yes then the timeout alrm will be canceled.
Definition at line 865 of file BESUtil.cc.
|
static |
explode a string into an array given a delimiter
Given a string of values separated by a delimiter, break out the values and store in the list.
Quoted values must be escaped.
If values contain the delimiter then the value must be wrapped in quotes.
delim | delimiter separating the values |
str | the original string |
values | list of the delimited values returned to caller |
BESInternalError | if missing ending quote or delimiter does not follow end quote |
Definition at line 540 of file BESUtil.cc.
|
static |
convert pid and place in provided buffer
Definition at line 415 of file BESUtil.cc.
|
static |
Definition at line 421 of file BESUtil.cc.
|
static |
Copies the contents of the file identified by file_name to the stream o_strm.
Thanks to O'Reilly: https://www.oreilly.com/library/view/c-cookbook/0596007612/ch10s08.html
file_name | |
o_strm |
Definition at line 1132 of file BESUtil.cc.
|
static |
Definition at line 1209 of file BESUtil.cc.
|
static |
*brief child thread/task to stream a netCDF file as it is built
file_name | |
o_strm |
Definition at line 1303 of file BESUtil.cc.
|
staticnoexcept |
Get the Resident Set Size in KB.
Definition at line 86 of file BESUtil.cc.
|
static |
Returns the current time as an ISO8601 string.
use_local_time | True to use the local time, false (default) to use GMT |
Definition at line 1014 of file BESUtil.cc.
|
static |
Returns the time represented by 'the_time' as an ISO8601 string.
the_time | A time_t value |
use_local_time | True to use the local time, false (default) to use GMT |
Definition at line 1026 of file BESUtil.cc.
|
static |
convert characters not allowed in xml to escaped characters
Replace characters that are not allowed in XML
in | The string in which to replace characters. |
not_allowed | The set of characters that are not allowed in XML. default: ><&'(single quote)"(double quote) |
Definition at line 484 of file BESUtil.cc.
|
static |
implode a list of values into a single string delimited by delim
Given a list of string values create a single string of values delimited by delim
If the delimiter exists in a value in the list then that value must be enclosed in quotes
values | list of string values to implode |
delim | the delimiter to use in creating the resulting string |
Definition at line 617 of file BESUtil.cc.
|
static |
Convert a string to all lower case
Definition at line 254 of file BESUtil.cc.
|
static |
Removes duplicate separators and provides leading and trailing separators as directed.
raw_path | The string to normalize |
leading_separator | if true then the result will begin with a single separator character. If false the result will not begin with a separator character. |
trailing_separator | If true the result will end with a single separator character. If false the result will not end with a separator character. |
separator | A string, of length one, containing the separator character for the path. This parameter is optional and its value defaults to the slash '/' character. |
Definition at line 946 of file BESUtil.cc.
|
static |
Concatenate path fragments making sure that they are separated by a single '/' character.
Returns a new string made from appending secondPart to firstPart while ensuring that a single separator appears between the two parts.
firstPart | The first string to concatenate. |
secondPart | The second string to concatenate. |
separator | The separator character to use between the two concatenated strings. Default: '/' |
Definition at line 751 of file BESUtil.cc.
|
static |
remove leading and trailing blanks from a string
Definition at line 445 of file BESUtil.cc.
|
static |
Operates on the string 's' to replaces every occurrence of the value of the string 'find_this' with the value of the string 'replace_with_this'.
Convert a string to all lower case
Definition at line 921 of file BESUtil.cc.
|
static |
Definition at line 1082 of file BESUtil.cc.
|
static |
Generate an HTTP 1.0 response header for a html document.
strm | Write the MIME header to this ostream. |
Definition at line 155 of file BESUtil.cc.
|
static |
Generate an HTTP 1.0 response header for a text document.
strm | Write the MIME header to this ostream. |
Definition at line 136 of file BESUtil.cc.
|
static |
Splits the string s into the return vector of tokens using the delimiter delim and skipping empty values as instructed by skip_empty.
s | The string to tokenize. |
delim | The character delimiter to utilize during tokenization. default: '/' |
skip_empty | A boolean flag which controls if empty tokens are returned. |
Definition at line 1065 of file BESUtil.cc.
|
static |
A call out thanks to: http://www.oopweb.com/CPP/Documents/CPPHOWTO/Volume/C++Programming-HOWTO-7.html for the tokenizer.
Definition at line 992 of file BESUtil.cc.
|
static |
Remove double quotes around a string This function will remove a leading and/or trailing double quote surrounding a string.
value | The string, modified |
Definition at line 123 of file BESUtil.cc.
|
static |
If the string ends in a slash, remove it This function works for empty strings (doing nothing). If the string ends in a '/' it will be removed.
value | The string, modified in place |
Definition at line 110 of file BESUtil.cc.
|
static |
Unescape characters with backslash before them
Definition at line 264 of file BESUtil.cc.
|
static |
Definition at line 226 of file BESUtil.cc.
|
static |
Definition at line 725 of file BESUtil.cc.
|
static |
Given a url, break the url into its different parts.
The different parts are the protocol, the domain name, a username if specified, a password if specified, a port if specified, and a path if specified.
struct url { string protocol ; string domain ; string uname ; string psswd ; string port ; string path ; } ;
url | string representation of the URL |
Definition at line 657 of file BESUtil.cc.
|
static |
This functions are used to unescape hex characters from strings
Definition at line 239 of file BESUtil.cc.
|
static |
unescape xml escaped characters
Given a string that contains XML escape sequences (i.e., entities), translate those back into ASCII characters. Return the modified string.
in | The string to modify. |
Definition at line 501 of file BESUtil.cc.