Skip to content

datatypes::utils

Classes

Name
class datatypes::utils::STLHelper
Helper functions with features found in other languages but not found in the C++ standard template library. Many of these features are not used in this library (uchronia) as such, but are here as a place of convenience for dependent modelling libraries.
class datatypes::utils::IfThenElse
Yield second or third argument depending on first argument. Could not find an easy to use if_then_else in the STL or Boost. IfThenElse will probably be replaced. Primary template: yield second or third argument depending on first argument.
class datatypes::utils::IfThenElse< true, Ta, Tb >
partial specialization: true yields second argument
class datatypes::utils::IfThenElse< false, Ta, Tb >
partial specialization: true yields third argument
class datatypes::utils::ValueTypeVectorDispose
class datatypes::utils::PointerTypeVectorDispose
struct datatypes::utils::DisposeVectorTypeFactory
Template program; Type type is a class suitable to dispose of object T, whether it is a vector of value types, or a vector where items are pointers requiring the delete operator. Used to dispose of items in a templated time series, with items of either value or pointer types.
class datatypes::utils::bad_lexical_cast
A bad_lexical_cast that inherits from std::exception, unlike Boost's. Needed for graceful C API interop.
class datatypes::utils::StringProcessing
Helper class with string processing related functions. These emulate methods found in other languages such as C#, R, etc.

Functions

Name
void datatypes_delete_ansi_string_array(char ** values, int arrayLength)
template <typename T =double>
vector< T >
SeqVec(T from, T by, size_t num)
template <typename T >
void
DisposeVector(vector< T > & v)
template <typename Target >
Target
Parse(const string & strId)
Wraps boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.
template <typename Source >
string
ToString(const Source & value)
Wraps boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.
template <class TTo >
TTo *
ConvertToArray(const vector< string > & src)
Converts string items to an array, casting strings. Wraps calls to boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.
template <class TFrom ,class TTo >
TTo *
ConvertToArray(const vector< TFrom > & src)
Converts string items to an array, casting strings (C casts for each item). rethrows an exception that inherits from std::exception and a more useful error message for the end user (better C API support).
template <class TFrom ,class TTo >
vector< TTo >
Convert(const vector< TFrom > & src)
Converts each vector items from one type to another. rethrows an exception that inherits from std::exception and a more useful error message for the end user (better C API support).
template <class TTo >
vector< TTo >
Convert(const vector< string > & src)
Converts string items to an array, casting strings. Wraps calls to boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.
template <typename T =boost::posix_time::ptime>
T
CreateTime(int year, int month, int day, int hour =0, int minute =0, int second =0)

Functions Documentation

function datatypes_delete_ansi_string_array

void datatypes_delete_ansi_string_array(
    char ** values,
    int arrayLength
)

function SeqVec

template <typename T  =double>
vector< T > SeqVec(
    T from,
    T by,
    size_t num
)

function DisposeVector

template <typename T >
void DisposeVector(
    vector< T > & v
)

function Parse

template <typename Target >
static Target Parse(
    const string & strId
)

Wraps boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.

function ToString

template <typename Source >
static string ToString(
    const Source & value
)

Wraps boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.

function ConvertToArray

template <class TTo >
static TTo * ConvertToArray(
    const vector< string > & src
)

Converts string items to an array, casting strings. Wraps calls to boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.

function ConvertToArray

template <class TFrom ,
class TTo >
static TTo * ConvertToArray(
    const vector< TFrom > & src
)

Converts string items to an array, casting strings (C casts for each item). rethrows an exception that inherits from std::exception and a more useful error message for the end user (better C API support).

function Convert

template <class TFrom ,
class TTo >
static vector< TTo > Convert(
    const vector< TFrom > & src
)

Converts each vector items from one type to another. rethrows an exception that inherits from std::exception and a more useful error message for the end user (better C API support).

function Convert

template <class TTo >
vector< TTo > Convert(
    const vector< string > & src
)

Converts string items to an array, casting strings. Wraps calls to boost::lexical_cast with a try/catch; rethrows an exception that inherits from std::exception and a more useful error message.

function CreateTime

template <typename T  =boost::posix_time::ptime>
T CreateTime(
    int year,
    int month,
    int day,
    int hour =0,
    int minute =0,
    int second =0
)

Updated on 2022-08-21 at 18:10:33 +1000