neic-glass3  1.4.6
Classes | Enumerations | Functions | Variables
glass3::util Namespace Reference

The neic-glass3 project namespace containing utility classes and functions. More...

Classes

class  BaseClass
 glass3::util::BaseClass class - encapsulates the most basic setup and configuration logic. More...
 
class  Cache
 glass3::util::Cache class - a thread safe in-memory cache More...
 
class  Config
 neic-glass3 configuration class using JSON formatting More...
 
class  Date
 time translation class More...
 
class  Geo
 geographic coordinate conversion class More...
 
class  GlassID
 glassutil id generation class More...
 
class  GlassMath
 glassutil logging class More...
 
interface  iAssociator
 The associator messaging interface, used in sending configuration and input data to neic-glass3, specifically the glasscore libraries. More...
 
interface  iInput
 The input data retrieval interface, used to provide input data to other parts of neic-glass3. More...
 
interface  iOutput
 The output message interface, used in sending data to output classes in neic-glass3. More...
 
class  Logger
 glassutil logging class More...
 
class  Queue
 glass3::util::Queue class More...
 
class  Taper
 glassutil taper class More...
 
class  ThreadBaseClass
 glass3::util::ThreadBaseClass class More...
 
class  ThreadPool
 glass3::util::ThreadPool class More...
 

Enumerations

enum  ThreadState {
  Initialized = 0, Starting = 1, Started = 2, Stopping = -1,
  Stopped = -2
}
 glass3::util::ThreadState enumeration More...
 
enum  WorkState { Idle = 0, OK = 1, Error = -1 }
 glass3::util::WorkState enumeration More...
 

Functions

bool getFirstFileNameByExtension (const std::string &path, const std::string &extension, std::string &fileName)
 get the next file name in a directory More...
 
bool moveFileTo (std::string fileName, const std::string &dirName)
 move a file from one directory to another More...
 
bool copyFileTo (std::string from, std::string to)
 copy a file from one directory to another More...
 
bool deleteFileFrom (std::string fileName)
 delete a file More...
 
std::vector< std::string > split (const std::string &sInput, char cDelimiter)
 split a string into substrings More...
 
std::string & removeChars (std::string &sInput, const std::string &sRemoveChars)
 remove all instances of characters from a string More...
 
std::string to_string_with_precision (const double doubleVal, const int precisionVal=2)
 convert provided double to a string with desired precision More...
 

Variables

char envTZ [MAXENV]
 A character array used to store the environment variable TZ. It will be stored after the first call to ConvertISO8601ToEpochTime() More...
 

Detailed Description

The neic-glass3 project namespace containing utility classes and functions.

The neic-glass3 util namespace contains various base classes, class interfaces, and utility classes and functions used by other components of neic-glass3.

Enumeration Type Documentation

glass3::util::ThreadState enumeration

This enumeration defines the values used in tracking the state of a thread.

Enumerator
Initialized 

thread has been initialized

Starting 

thread is starting up

Started 

thread has been started

Stopping 

thread is shutting down

Stopped 

thread is shut down

glass3::util::WorkState enumeration

This enumeration defines the values used in tracking the state of a work() call in ThreadBaseClass.

Enumerator
Idle 

There was no work to perform

OK 

The work was completed successfully

Error 

There was an error performing the work

Function Documentation

bool glass3::util::copyFileTo ( std::string  from,
std::string  to 
)

copy a file from one directory to another

Copy a given file to a given directory

Parameters
from- A std::string containing the path and name of the file to copy
to- A std::string containing the path and name of the destination file
Returns
returns true if successful.
bool glass3::util::deleteFileFrom ( std::string  fileName)

delete a file

Delete a given file from the file system

Parameters
fileName- A std::string containing the path and name of the file to delete
Returns
returns true if successful.
bool glass3::util::getFirstFileNameByExtension ( const std::string &  path,
const std::string &  extension,
std::string &  fileName 
)

get the next file name in a directory

Gets the next file name that matches a given extension from a given directory

Parameters
path- A std::string containing the directory to search for a file name
extension- A std::string containing the extension to filter with.
fileName- A std::string containing the file name that was found
Returns
returns true if successful.
bool glass3::util::moveFileTo ( std::string  fileName,
const std::string &  dirName 
)

move a file from one directory to another

Move a given file to a given directory

Parameters
fileName- A std::string containing the path and name of the file to move
dirName- A std::string containing the directory to move the file to move
Returns
returns true if successful or expected error (ENOENT), or (EACCES - trying to overwrite an existing file in the move), in either case the fileName is expected to no longer exist after a return of true.
std::string & glass3::util::removeChars ( std::string &  sInput,
const std::string &  sRemoveChars 
)

remove all instances of characters from a string

Remove all instances of the set of characters stored in chars from the given string. This is NOT removing a substring from a string.

Parameters
sInput- A std::string containing the string to remove characters from
sRemoveChars- A std::string containing the individual characters to remove.
Returns
returns a std::string containing modified string.
std::vector< std::string > glass3::util::split ( const std::string &  sInput,
char  cDelimiter 
)

split a string into substrings

Split a string into substrings using the provided delimiter, creating a std::vector to hold the results

Parameters
sInput- A std::string containing the string to split
cDelimiter- A char containing the the delimiter to split with.
Returns
returns a std::vector containing the split std::string elements
std::string glass3::util::to_string_with_precision ( const double  doubleVal,
const int  precisionVal = 2 
)

convert provided double to a string with desired precision

Convert the provided double value into a string while truncateing it to the provided precision

Parameters
doubleVal- A double containing the value to convert
precisionVal- An int containing the desired precision to truncate to, default is 2.
Returns
returns a std::string containing converted string.

Variable Documentation

char glass3::util::envTZ[MAXENV]

A character array used to store the environment variable TZ. It will be stored after the first call to ConvertISO8601ToEpochTime()