GeoTessCPP 2.6.1 Software to facilitate storage and retrieval of 3D information about the Earth.

Loading...
Searching...
No Matches
geotess::CPPUtils Class Reference

Basic static utility functions and variables. More...

`#include <CPPUtils.h>`

## Public Member Functions
| CPPUtils ()
virtual | ~CPPUtils ()
virtual int | class_size () const

## Static Public Member Functions
static string | class_name ()
static const string | getOpSys ()
static string | stringReplaceAll (const string &sf, const string &sr, const string &s)
static void | removeEOL (string &s)
static void | addPathSeparator (string &path)
static string | insertPathSeparator (const string &dir, const string &name)
static void | removePathSeparator (string &path)
static string | itos (int i, const string &frmt="%d")
static string | ltos (LONG_INT l, const string &frmt="%llu")
static string | ftos (float f, const string &frmt="%.6f")
static string | dtos (double d, const string &frmt="%.14f")
static string | btos (bool b)
static int | stoi (const string &i, const string &frmt="%d")
static LONG_INT | stol (const string &i64, const string &frmt="%llu")
static float | stof (const string &f, const string &frmt="%f")
static double | stod (const string &d, const string &frmt="%lf")
static bool | stob (const string &b)
static string | trim (const string &str, const string &delim=" \t")
static string | trimLeft (const string &str, const string &delim=" \t")
static string | trimRight (const string &str, const string &delim=" \t")
static void | getProperties (const string &str, map< string, string > &props)
static bool | getProperty (const map< string, string > &props, const string &tag, string &value)
static void | tokenizeString (const string &str, const string &delim, vector< string > &tokens)
static string | lowercase_string (const string &str)
static string | uppercase_string (const string &str)
template<typename T>
static void | minmax (const vector< T > &v, T &mn, T &mx)
static double | toDegrees (double a)
static double | toRadians (double a)
template<typename T>
static T ** | new2DArrayOfArrays (int ni, int nj)
template<typename T>
static T ** | new2DArray (int ni, int nj)
template<typename T>
static T *** | new3DArray (int ni, int nj, int nk)
template<typename T>
static void | delete2DArray (T **&a)
template<typename T>
static void | delete2DArrayOfArrays (T **&a, int ni)
template<typename T>
static void | delete3DArray (T ***&a)
template<typename T>
static void | resetArray (int n, T *array, T val)
template<typename T>
static T * | copyArray (T *a, int n)
static bool | isBigEndian ()
static bool | isint (const string &i)
static bool | fileExists (const string &fileName)

## Static Public Attributes
static const int | SBOL
static const int | SBYT
static const int | SSHT
static const int | SINT
static const int | SLNG
static const int | SFLT
static const int | SDBL
static char const | FILE_SEP
static string const | NEWLINE

## Detailed Description

Basic static utility functions and variables.

The CPPUtils class provides basic system level static utility functions for GeoTess.

Definition at line 69 of file CPPUtils.h.

## Constructor & Destructor Documentation

## ◆ CPPUtils()

geotess::CPPUtils::CPPUtils | ( |  | ) |
| inline

Default constructor.

Definition at line 88 of file CPPUtils.h.

## ◆ ~CPPUtils()

virtual geotess::CPPUtils::~CPPUtils | ( |  | ) |
| inline virtual

Protected destructor ... made virtual as is usual practice.

Definition at line 93 of file CPPUtils.h.

## Member Function Documentation

## ◆ addPathSeparator()

void geotess::CPPUtils::addPathSeparator | ( | string & | path | ) |
| inline static

If the supplied path does not already end with a path separator, append it to the end. On windows, use '\', otherwise '/'.

Definition at line 450 of file CPPUtils.h.

## ◆ btos()

string geotess::CPPUtils::btos | ( | bool | b | ) |
| static

## ◆ class_name()

string geotess::CPPUtils::class_name | ( |  | ) |
| inline static

Returns the class name.

Returns
  class name

Definition at line 99 of file CPPUtils.h.

## ◆ class_size()

virtual int geotess::CPPUtils::class_size | ( |  | ) | const
| inline virtual

Returns the class size.

Definition at line 104 of file CPPUtils.h.

## ◆ copyArray()

template<typename T>

T * geotess::CPPUtils::copyArray | ( | T * | a,
|  | int | n )
| inline static

Return a deep copy of the specified array.

Definition at line 331 of file CPPUtils.h.

## ◆ delete2DArray()

template<typename T>

void geotess::CPPUtils::delete2DArray | ( | T **& | a | ) |
| inline static

Deletes the input 2D array reference and sets it to null.

Delete and set to NULL a 2D array that was created with new2DArray()

Definition at line 411 of file CPPUtils.h.

## ◆ delete2DArrayOfArrays()

template<typename T>

void geotess::CPPUtils::delete2DArrayOfArrays | ( | T **& | a,
|  | int | ni )
| inline static

Deletes the input 2D array of arrays reference and sets it to null.

Definition at line 302 of file CPPUtils.h.

## ◆ delete3DArray()

template<typename T>

void geotess::CPPUtils::delete3DArray | ( | T ***& | a | ) |
| inline static

Deletes the input 3D array reference and sets it to null.

Delete and set to NULL a 3D array that was created with new2DArray()

Definition at line 425 of file CPPUtils.h.

## ◆ dtos()

string geotess::CPPUtils::dtos | ( | double | d,
|  | const string & | frmt = "%.14f" )
| static

## ◆ fileExists()

bool geotess::CPPUtils::fileExists | ( | const string & | fileName | ) |
| inline static

Definition at line 370 of file CPPUtils.h.

## ◆ ftos()

string geotess::CPPUtils::ftos | ( | float | f,
|  | const string & | frmt = "%.6f" )
| static

## ◆ getOpSys()

const string geotess::CPPUtils::getOpSys | ( |  | ) |
| static

Returns the operating system type.

## ◆ getProperties()

void geotess::CPPUtils::getProperties | ( | const string & | str,
|  | map< string, string > & | props )
| static

Retrieves all properties defined in the input string str and saves them into the property map props.

The properties must be of the form "name = value; name = value; ..." where the name value associations are set into the property map. All "names" are lower-cased into the property map. "values" are simply assigned without case change. All name and value pairs are stripped of leading and trailing blanks before placement into the property map. All properties must be separated by a semi-colon.

Parameters

  str | Input semicolon separated string of properties.
  props | Input map that will be filled with the properties name --> value associations.

## ◆ getProperty()

bool geotess::CPPUtils::getProperty | ( | const map< string, string > & | props,
|  | const string & | tag,
|  | string & | value )
| static

Retrieves the "value" associated with "tag" from the property map "props". If the "tag" is found in props then true is returned and "value" is set. Otherwise, false is returned.

Parameters

  props | The input properties map (name = value).
  tag | The input key for which an associated value will be sought.
  value | The returned value associated with the input tag ... if one was found.

Returns
  True if the value was set.

## ◆ insertPathSeparator()

string geotess::CPPUtils::insertPathSeparator | ( | const string & | dir,
|  | const string & | name )
| inline static

combine the two path components together, inserting a path separator only if necessary.

Definition at line 456 of file CPPUtils.h.

## ◆ isBigEndian()

bool geotess::CPPUtils::isBigEndian | ( |  | ) |
| static

Return true if file read / write system is big endian.

## ◆ isint()

bool geotess::CPPUtils::isint | ( | const string & | i | ) |
| static

Returns True if string i can be represented as an integer.

## ◆ itos()

string geotess::CPPUtils::itos | ( | int | i,
|  | const string & | frmt = "%d" )
| static

Static functions that returns the input integer, float, double, or boolean, as a string.

## ◆ lowercase_string()

string geotess::CPPUtils::lowercase_string | ( | const string & | str | ) |
| static

These functions convert the input string to all lower/upper case characters.

## ◆ ltos()

string geotess::CPPUtils::ltos | ( | LONG_INT | l,
|  | const string & | frmt = "%llu" )
| static

## ◆ minmax()

template<typename T>

void geotess::CPPUtils::minmax | ( | const vector< T > & | v,
|  | T & | mn,
|  | T & | mx )
| static

Returns the minimum (mn) and maximum (mx) of the input vector v.

Returns the minimum (mn) and maximum (mx) of the input v.

Definition at line 478 of file CPPUtils.h.

## ◆ new2DArray()

template<typename T>

T ** geotess::CPPUtils::new2DArray | ( | int | ni,
|  | int | nj )
| inline static

Returns a new intrinsic 2D array of size [ni][nj].

Parameters

  ni | First array dimension size.
  nj | Second array dimension size.

Returns
  The new 2D array.

Definition at line 260 of file CPPUtils.h.

## ◆ new2DArrayOfArrays()

template<typename T>

T ** geotess::CPPUtils::new2DArrayOfArrays | ( | int | ni,
|  | int | nj )
| inline static

Create a 2D array of arrays (Java style).

Definition at line 244 of file CPPUtils.h.

## ◆ new3DArray()

template<typename T>

T *** geotess::CPPUtils::new3DArray | ( | int | ni,
|  | int | nj,
|  | int | nk )
| inline static

Returns a new intrinsic 3D array of size [ni][nj].

Parameters

  ni | First array dimension size.
  nj | Second array dimension size.
  nk | Third array dimension size.

Returns
  The new 2D array.

Definition at line 277 of file CPPUtils.h.

## ◆ removeEOL()

void geotess::CPPUtils::removeEOL | ( | string & | s | ) |
| inline static

Removes '/r', '/n', or '/r/n' from the end of the input string if it exists.

Definition at line 439 of file CPPUtils.h.

## ◆ removePathSeparator()

void geotess::CPPUtils::removePathSeparator | ( | string & | path | ) |
| inline static

If the supplied path ends with a path separator, remove it. On windows, use '\', otherwise '/'.

Definition at line 445 of file CPPUtils.h.

## ◆ resetArray()

template<typename T>

void geotess::CPPUtils::resetArray | ( | int | n,
|  | T * | array,
|  | T | val )
| inline static

Resets all n entries in array to val.

Definition at line 322 of file CPPUtils.h.

## ◆ stob()

bool geotess::CPPUtils::stob | ( | const string & | b | ) |
| static

## ◆ stod()

double geotess::CPPUtils::stod | ( | const string & | d,
|  | const string & | frmt = "%lf" )
| static

## ◆ stof()

float geotess::CPPUtils::stof | ( | const string & | f,
|  | const string & | frmt = "%f" )
| static

## ◆ stoi()

int geotess::CPPUtils::stoi | ( | const string & | i,
|  | const string & | frmt = "%d" )
| static

Static functions that returns the input string as an integer, float, double, or boolean.

## ◆ stol()

LONG_INT geotess::CPPUtils::stol | ( | const string & | i64,
|  | const string & | frmt = "%llu" )
| static

## ◆ stringReplaceAll()

string geotess::CPPUtils::stringReplaceAll | ( | const string & | sf,
|  | const string & | sr,
|  | const string & | s )
| static

Replaces all occurrences of sf in string s with sr on output and returns the new string.

## ◆ toDegrees()

double geotess::CPPUtils::toDegrees | ( | double | a | ) |
| inline static

Returns input radian measure in degrees.

Returns input radian measure in degrees.

Returns
  Input radian measure in degrees.

Definition at line 392 of file CPPUtils.h.

## ◆ tokenizeString()

void geotess::CPPUtils::tokenizeString | ( | const string & | str,
|  | const string & | delim,
|  | vector< string > & | tokens )
| static

This function tokenizes the input string, str, into a set of tokens given a set of delimiters specified in delim. For example, the string "May 15, 2002 5:56:20 pm" tokenized with the set of delimiters " ,:" would yield the set of 7 tokens given as "May", "15", "2002", "5", "56", "20", and "pm".

## ◆ toRadians()

double geotess::CPPUtils::toRadians | ( | double | a | ) |
| inline static

Returns input degrees measure in radians.

Returns input degrees measure in radians.

Returns
  Input degrees measure in radians.

Definition at line 402 of file CPPUtils.h.

## ◆ trim()

string geotess::CPPUtils::trim | ( | const string & | str,
|  | const string & | delim = " \t" )
| static

These functions return the input string (str) without any leading (trimLeft) or trailing (trimRight) delimiters (delim ... defaults to a space and a tab).

## ◆ trimLeft()

string geotess::CPPUtils::trimLeft | ( | const string & | str,
|  | const string & | delim = " \t" )
| static

## ◆ trimRight()

string geotess::CPPUtils::trimRight | ( | const string & | str,
|  | const string & | delim = " \t" )
| static

## ◆ uppercase_string()

string geotess::CPPUtils::uppercase_string | ( | const string & | str | ) |
| static

## Member Data Documentation

## ◆ FILE_SEP

char const geotess::CPPUtils::FILE_SEP
| static

Path separator. '\' on Windows, '/' on unix-type systems.

Definition at line 363 of file CPPUtils.h.

## ◆ NEWLINE

string const geotess::CPPUtils::NEWLINE
| static

End-of-line string. "\r\n" on Windows, "\r" on MacOSX, "\n" on unix-type systems.

Definition at line 368 of file CPPUtils.h.

## ◆ SBOL

const int geotess::CPPUtils::SBOL
| static

Standard sizes of basic intrinsics.

Definition at line 352 of file CPPUtils.h.

## ◆ SBYT

const int geotess::CPPUtils::SBYT
| static

Definition at line 353 of file CPPUtils.h.

## ◆ SDBL

const int geotess::CPPUtils::SDBL
| static

Definition at line 358 of file CPPUtils.h.

## ◆ SFLT

const int geotess::CPPUtils::SFLT
| static

Definition at line 357 of file CPPUtils.h.

## ◆ SINT

const int geotess::CPPUtils::SINT
| static

Definition at line 355 of file CPPUtils.h.

## ◆ SLNG

const int geotess::CPPUtils::SLNG
| static

Definition at line 356 of file CPPUtils.h.

## ◆ SSHT

const int geotess::CPPUtils::SSHT
| static

Definition at line 354 of file CPPUtils.h.

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

- rstt_v3.2.1/GeoTessCPP/include/CPPUtils.h