![]() |
Trading System API
3.0
Library for Simulating and Deploying Trading and Investment Strategies
|
#include <TSAVariant.h>
Public Member Functions | |
auto_cast_variant (const date_time &val) | |
Constructor. Type member is initialized to type_t::datetime and value to val. | |
auto_cast_variant (const date &val) | |
Constructor. Type member is initialized to type_t::date and value to val. | |
auto_cast_variant (double val) | |
Constructor. Type member is initialized to type_t::float64 and value to val. | |
auto_cast_variant (int val) | |
Constructor. Type member is initialized to type_t::int32 and value to val. | |
auto_cast_variant (int64_t val) | |
Constructor. Type member is initialized to type_t::int64 and value to val. | |
auto_cast_variant (uint64_t val) | |
Constructor. Type member is initialized to type_t::int64 and value to val. (value will be signed) | |
auto_cast_variant (bool val) | |
Constructor. Type member is initialized to type_t::boolean and value to val. | |
auto_cast_variant (unsigned val) | |
Constructor. Type member is initialized to type_t::uint32 and value to val. | |
auto_cast_variant (float val) | |
Constructor. Type member is initialized to type_t::float32 and value to val. | |
auto_cast_variant (const tsa::string &val) | |
Constructor. Type member is initialized to string and value to val. | |
auto_cast_variant (const std::string &val) | |
Constructor. Type member is initialized to type_t::string and value to val. | |
auto_cast_variant (const char *val) | |
Constructor. Type member is initialized to type_t::string and value to val. | |
auto_cast_variant (char val) | |
Constructor. Type member is initialized to type_t::string and value to val. | |
operator bool (void) const | |
Identical to to_bool(). | |
operator date_time (void) const | |
Identical to to_bool(). | |
operator double (void) const | |
Identical to to_float(). | |
operator float (void) const | |
Identical to to_float(). | |
operator int (void) const | |
Identical to to_float(). | |
operator int64_t (void) const | |
Identical to to_float(). | |
operator std::string (void) const | |
Identical to to_bool(). | |
operator unsigned (void) const | |
Identical to to_float(). | |
![]() | |
void | clear (void) |
Returns self to an 'undefined' state where defined() returns 'false'. 'undefined' essentially means 'no data available' / 'N/A' or 'null' as used by some database systems. Note that an 'undefined' variant can still have a type. | |
bool | defined (void) const |
Returns true if a value has been assigned and the object is in a 'defined' date. In other words it is 'not-null'. More... | |
std::string & | get_string_ref (void) const |
bool | is_equal (const variant &other) const |
Returns true if self is identical to other. More... | |
bool | is_numeric (void) const |
Returns true if value type is numeric. Numeric types are: More... | |
bool | is_owner (void) const |
Returns true if the object is the owner of the pointer value. More... | |
std::string & | str (void) const |
template<typename T > | |
T | to (void) const |
Gets to. More... | |
bool | to_bool (void) const |
Returns this object's data as a bool, converting the data if required. Throws an exception if conversion fails. More... | |
date | to_date (void) const |
Returns this object's data as a date, converting the data if required. Throws an exception if conversion fails. More... | |
date_time | to_datetime (void) const |
Returns this object's data as a date_time, converting the data if required. Throws an exception if conversion fails. More... | |
double | to_double (void) const |
Returns this object's data as a double, converting the data if required. Throws an exception if conversion fails. More... | |
float | to_float (void) const |
Returns this object's data as a float, converting the data if required. Throws an exception if conversion fails. More... | |
int | to_int (void) const |
Returns this object's data as an int, converting the data if required. Throws an exception if conversion fails. More... | |
int64_t | to_int64 (void) const |
Returns this object's data as a int64_t, converting the data if required. Throws an exception if conversion fails. More... | |
std::string | to_string (void) const |
Returns this object's data as a std::string, converting the data if required. More... | |
unsigned | to_uint (void) const |
Returns this object's data as an unsigned it, converting the data if required. Throws an exception if conversion fails. More... | |
void * | to_void_ptr (void) const |
Returns this object's data as a void_ptr. Throws an exception if type is not type_t::void_ptr. More... | |
type_t | type (void) const |
Returns the type. | |
variant (void) | |
Constructor. Object state is 'undefined'. defined() returns false. | |
variant (type_t type) | |
Constructor. Self is initialized to given type. The object remains 'undefined' until a value is assigned. The defined() member returns false. More... | |
variant (const variant &other) | |
Copy constructor. | |
variant (const date_time &val) | |
Constructor. Type member is initialized to type_t::datetime and value to val. | |
variant (const date &val) | |
Constructor. Type member is initialized to type_t::date and value to val. | |
variant (double val) | |
Constructor. Type member is initialized to type_t::float64 and value to val. | |
variant (int val) | |
Constructor. Type member is initialized to type_t::int32 and value to val. | |
variant (int64_t val) | |
Constructor. Type member is initialized to type_t::int64 and value to val. | |
variant (uint64_t val) | |
Constructor. Type member is initialized to type_t::int64 and value to val. (value will be signed) | |
variant (bool val) | |
Constructor. Type member is initialized to type_t::boolean and value to val. | |
variant (unsigned val) | |
Constructor. Type member is initialized to type_t::uint32 and value to val. | |
variant (float val) | |
Constructor. Type member is initialized to type_t::float32 and value to val. | |
variant (const tsa::string &val) | |
Constructor. Type member is initialized to string and value to val. | |
variant (const std::string &val) | |
Constructor. Type member is initialized to type_t::string and value to val. | |
variant (const char *val) | |
Constructor. Type member is initialized to type_t::string and value to val. | |
variant (char val) | |
Constructor. Type member is initialized to type_t::string and value to val. | |
variant (const object *val) | |
variant (const void *val) | |
Constructor. Type member is initialized to type_t::void_ptr and data member to val. Does NOT assume ownership of the pointer. | |
~variant (void) | |
Destructor. | |
const variant & | operator= (const variant &other) |
Assignment operator. Self will be identical to other. | |
const variant & | operator= (unsigned val) |
Assignment operator. Type is set to type_t::uint32. | |
const variant & | operator= (const date_time &val) |
Assignment operator. Type is set to type_t::datetime. | |
const variant & | operator= (const date &val) |
Assignment operator. Type is set to type_t::date. | |
const variant & | operator= (int val) |
Assignment operator. Type is set to type_t::int32. | |
const variant & | operator= (int64_t val) |
Assignment operator. Type is set to type_t::int64. | |
const variant & | operator= (uint64_t val) |
Assignment operator. Type is set to type_t::int64. | |
const variant & | operator= (bool val) |
Assignment operator. Type is set to boolean. | |
const variant & | operator= (float val) |
Assignment operator. Type is set to type_t::float32. | |
const variant & | operator= (double val) |
Assignment operator. Type is set to type_t::float64. | |
const variant & | operator= (void *val) |
Assignment operator. Type is set to type_t::void_ptr. | |
const variant & | operator= (const char *val) |
Assignment operator. Type is set to type_t::string. | |
const variant & | operator= (const tsa::string &val) |
const variant & | operator= (const std::string &val) |
Assignment operator. Type is set to type_t::string. | |
void | assign__no_type_chg (object *val) |
void | assign__no_type_chg (float value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (double value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (unsigned value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (int value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (int64_t value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (unsigned long int value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (bool value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (const variant &other) |
Assigns other to self while retaining self's type and attempting to convert other's data. If other is 'undefined', self will also be set to 'undefined'. More... | |
void | assign__no_type_chg (void *value) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (const tsa::string &val) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (const std::string &val) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (const char *val) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (const date_time &val) |
Assigns value. Type stays unchanged. | |
void | assign__no_type_chg (const date &val) |
Assigns value. Type stays unchanged. | |
template<typename T > | |
T | get (void) const |
Returns the objects data. The object's type must match the template typename. If not, an exception is thrown. More... | |
operator float (void) const | |
Identical to to_float(). | |
operator unsigned (void) const | |
Identical to to_float(). | |
operator double (void) const | |
Identical to to_float(). | |
operator int (void) const | |
Identical to to_float(). | |
operator int64_t (void) const | |
Identical to to_float(). | |
operator uint64_t (void) const | |
operator bool (void) const | |
Identical to to_bool(). | |
operator void * (void) const | |
Identical to to_void_ptr(). | |
Additional Inherited Members | |
![]() | |
std::ostream & | operator<< (std::ostream &stream, const variant &var) |
Writes var to stream as text. More... | |