![]() |
GenericContainer
GenericContaine a tool for C++ programming
|
The GenericContainer
class provides a flexible container for storing heterogeneous data types.
More...
#include <GenericContainer.hh>
Public Types | |
using | pointer_type = GC_namespace::pointer_type |
Alias for pointer type. | |
using | bool_type = GC_namespace::bool_type |
Alias for boolean type. | |
using | int_type = GC_namespace::int_type |
Alias for integer type. | |
using | uint_type = GC_namespace::uint_type |
Alias for unsigned integer type. | |
using | long_type = GC_namespace::long_type |
Alias for long integer type. | |
using | ulong_type = GC_namespace::ulong_type |
Alias for unsigned long integer type. | |
using | real_type = GC_namespace::real_type |
Alias for real (floating point) type. | |
using | complex_type = GC_namespace::complex_type |
Alias for complex number type. | |
using | string_type = GC_namespace::string_type |
Alias for string type. | |
using | vec_pointer_type = GC_namespace::vec_pointer_type |
Alias for vector of pointers type. | |
using | vec_bool_type = GC_namespace::vec_bool_type |
Alias for vector of booleans type. | |
using | vec_int_type = GC_namespace::vec_int_type |
Alias for vector of integers type. | |
using | vec_uint_type = GC_namespace::vec_uint_type |
Alias for vector of unsigned integers type. | |
using | vec_long_type = GC_namespace::vec_long_type |
Alias for vector of long integers type. | |
using | vec_ulong_type = GC_namespace::vec_ulong_type |
Alias for vector of unsigned long integers type. | |
using | vec_real_type = GC_namespace::vec_real_type |
Alias for vector of real numbers type. | |
using | vec_complex_type = GC_namespace::vec_complex_type |
Alias for vector of complex numbers type. | |
using | vec_string_type = GC_namespace::vec_string_type |
Alias for vector of strings type. | |
using | vector_type = GC_namespace::vector_type |
Alias for vector of GenericContainer type. | |
using | map_type = GC_namespace::map_type |
Alias for map of GenericContainer type. | |
using | mat_int_type = GC_namespace::mat_int_type |
Alias for matrix of integers type. | |
using | mat_long_type = GC_namespace::mat_long_type |
Alias for matrix of long integers type. | |
using | mat_real_type = GC_namespace::mat_real_type |
Alias for matrix of real numbers type. | |
using | mat_complex_type = GC_namespace::mat_complex_type |
Alias for matrix of complex numbers type. | |
Public Member Functions | |
GenericContainer () | |
Constructs a GenericContainer with an initial empty state. | |
~GenericContainer () | |
Destroys the GenericContainer and releases any allocated resources. | |
void | clear () |
Clears the content of the GenericContainer , resetting it to an empty state. | |
void | erase (char const name[]) |
Removes an item from the map stored in the GenericContainer by its key. | |
Methods for Initializing Simple Data Types | |
This group of methods allows setting simple data types (e.g., pointer, boolean, integer, etc.) within a | |
pointer_type & | set_pointer (pointer_type value) |
Set the data type to pointer_type and assign a value. | |
GenericContainer & | free_pointer () |
Free the pointer and reset the container to an empty state. | |
void | get_keys (vec_string_type &keys) const |
Extracts the keys of the map stored in the GenericContainer into a vector of strings. | |
string | get_keys () const |
Extracts the keys of the map stored in the GenericContainer as a comma-separated string. | |
bool_type & | set_bool (bool_type value) |
Set the data type to bool_type and assign a boolean value. | |
int_type & | set_int (int_type value) |
Set the data type to int_type and assign an integer value. | |
long_type & | set_long (long_type value) |
Set the data type to long_type and assign a long integer value. | |
real_type & | set_real (real_type value) |
Set the data type to real_type and assign a floating-point value. | |
complex_type & | set_complex (complex_type const &value) |
Set the data type to complex_type and assign a complex value. | |
complex_type & | set_complex (real_type r, real_type i) |
Set the data type to complex_type and assign a complex value from real and imaginary parts. | |
string_type & | set_string (string_type const &value) |
Set the data type to string_type , allocate memory, and assign a string value. | |
Methods for Initializing Vector and Matrix Data | |
This section includes methods for setting, allocating, and initializing vector and matrix data types within a | |
vec_pointer_type & | set_vec_pointer (unsigned sz=0) |
Set the data to vec_pointer_type , allocate and initialize. | |
vec_pointer_type & | set_vec_pointer (vec_pointer_type const &v) |
Set the data to vec_pointer_type by copying from another vector. | |
vec_bool_type & | set_vec_bool (unsigned sz=0) |
Set the data to vec_bool_type , allocate and initialize. | |
vec_bool_type & | set_vec_bool (vec_bool_type const &v) |
Set the data to vec_bool_type by copying from another vector. | |
vec_int_type & | set_vec_int (unsigned sz=0) |
Set the data to vec_int_type , allocate and initialize. | |
vec_int_type & | set_vec_int (vec_int_type const &v) |
Set the data to vec_int_type by copying from another vector. | |
vec_long_type & | set_vec_long (unsigned sz=0) |
Set the data to vec_long_type , allocate and initialize. | |
vec_long_type & | set_vec_long (vec_long_type const &v) |
Set the data to vec_long_type by copying from another vector. | |
vec_real_type & | set_vec_real (unsigned sz=0) |
Set the data to vec_real_type , allocate and initialize. | |
vec_real_type & | set_vec_real (vec_real_type const &v) |
Set the data to vec_real_type by copying from another vector. | |
vec_complex_type & | set_vec_complex (unsigned sz=0) |
Set the data to vec_complex_type , allocate and initialize. | |
vec_complex_type & | set_vec_complex (vec_complex_type const &v) |
Set the data to vec_complex_type by copying from another vector. | |
vec_string_type & | set_vec_string (unsigned sz=0) |
Set the data to vec_string_type , allocate and initialize. | |
vec_string_type & | set_vec_string (vec_string_type const &v) |
Set the data to vec_string_type by copying from another vector. | |
mat_int_type & | set_mat_int (unsigned nr=0, unsigned nc=0) |
Set the data to mat_int_type , allocate and initialize. | |
mat_int_type & | set_mat_int (mat_int_type const &m) |
Set the data to mat_int_type by copying from another matrix. | |
mat_long_type & | set_mat_long (unsigned nr=0, unsigned nc=0) |
Set the data to mat_long_type , allocate and initialize. | |
mat_long_type & | set_mat_long (mat_long_type const &m) |
Set the data to mat_long_type by copying from another matrix. | |
mat_real_type & | set_mat_real (unsigned nr=0, unsigned nc=0) |
Set the data to mat_real_type , allocate and initialize. | |
mat_real_type & | set_mat_real (mat_real_type const &m) |
Set the data to mat_real_type by copying from another matrix. | |
mat_complex_type & | set_mat_complex (unsigned nr=0, unsigned nc=0) |
Set the data to mat_complex_type , allocate and initialize. | |
mat_complex_type & | set_mat_complex (mat_complex_type const &m) |
Set the data to mat_complex_type by copying from another matrix. | |
void | push_bool (bool b) |
Push a boolean value into the vector or matrix. | |
void | push_int (int_type i) |
Push an integer value into the vector or matrix. | |
void | push_long (long_type l) |
Push a long integer value into the vector or matrix. | |
void | push_real (real_type r) |
Push a real number into the vector or matrix. | |
void | push_complex (complex_type &c) |
Push a complex number into the vector or matrix using an existing complex object. | |
void | push_complex (real_type re, real_type im) |
Push a complex number into the vector or matrix using real and imaginary parts. | |
void | push_string (string_type const &s) |
Push a string value into the vector or matrix. | |
Initialize generic data. | |
vector_type & | set_vector (unsigned sz=0) |
Initializes a generic vector. | |
map_type & | set_map () |
Initializes a generic map. | |
Access to a single element. | |
TypeAllowed | get_type () const |
Return an integer representing the type of data stored. | |
char const * | get_type_name () const |
Return a string representing the type of data stored. | |
GenericContainer const & | info (ostream_type &stream) const |
Print information about the kind of data stored to a stream. | |
string_type | info () const |
Print information about the kind of data stored as a string. | |
unsigned | get_num_elements () const |
Return the number of elements in the first level of the generic container. | |
unsigned | num_rows () const |
Return the number of rows in the internally stored matrix. | |
unsigned | get_numRows () const |
unsigned | num_cols () const |
Return the number of columns in the internally stored matrix. | |
unsigned | get_numCols () const |
real_type | get_number (char const where[]="") const |
Get a stored numeric value if the data is boolean, integer, or real type. | |
complex_type | get_complex_number (char const where[]="") const |
Get a stored complex number if the data is boolean, integer, real, or complex type. | |
void | get_complex_number (real_type &re, real_type &im) const |
Get the real and imaginary parts of a stored complex number. | |
void * | get_pvoid (char const where[]="") const |
Return the stored data as a generic pointer. | |
void ** | get_ppvoid (char const where[]="") const |
Return the stored data as a double pointer. | |
int_type const * | get_int_pointer () const |
int_type * | get_int_pointer () |
Return the stored data as a pointer to const integer. | |
long_type const * | get_long_pointer () const |
Return the stored data as a pointer to const long. | |
long_type * | get_long_pointer () |
Return the stored data as a pointer to long. | |
real_type const * | get_real_pointer () const |
Return the stored data as a pointer to const real_type. | |
real_type * | get_real_pointer () |
Return the stored data as a pointer to real_type. | |
complex_type const * | get_complex_pointer () const |
Return the stored data as a pointer to const complex_type. | |
complex_type * | get_complex_pointer () |
Return the stored data as a pointer to complex_type. | |
template<typename T > | |
void | get_value (T &v, char const where[]="") const |
Get the stored value. | |
template<typename T > | |
T & | get_pointer () |
Get the stored value as a pointer. | |
template<typename T > | |
T | get_pointer () const |
Get the stored value as a pointer (const version). | |
bool_type | get_map_bool (char const key[], char const where[]="") const |
Get the stored value in the map as boolean. | |
bool_type | get_map_bool (vec_string_type const &keys, char const where[]="") const |
int_type | get_map_int (char const key[], char const where[]="") const |
Get the stored value in the map as an integer. | |
int_type | get_map_int (vec_string_type const &keys, char const where[]="") const |
Get the stored value in the map as an integer from a list of keys. | |
real_type | get_map_number (char const key[], char const where[]="") const |
Get the stored value in the map as a real number. | |
real_type | get_map_number (vec_string_type const &keys, char const where[]="") const |
Get the stored value in the map as a real number from a list of keys. | |
string_type const & | get_map_string (char const key[], char const where[]="") const |
Get the stored value in the map as a string. | |
string_type const & | get_map_string (vec_string_type const &keys, char const where[]="") const |
Get the stored value in the map as a string from a list of keys. | |
vec_real_type const & | get_map_vec_real (char const key[], char const where[]="") const |
Get the stored value in the map as a vector of real numbers. | |
vec_real_type const & | get_map_vec_real (vec_string_type const &keys, char const where[]="") const |
Get the stored value in the map as a vector of real numbers from a list of keys. | |
vec_complex_type const & | get_map_vec_complex (char const key[], char const where[]="") const |
Get the stored value in the map as a vector of complex numbers. | |
vec_complex_type const & | get_map_vec_complex (vec_string_type const &keys, char const where[]="") const |
Get the stored value in the map as a vector of complex numbers from a list of keys. | |
vec_string_type const & | get_map_vec_string (char const key[], char const where[]="") const |
Get the stored value in the map as a vector of strings. | |
vec_string_type const & | get_map_vec_string (vec_string_type const &keys, char const where[]="") const |
Get the stored value in the map as a vector of strings from a list of keys. | |
bool_type & | get_bool (char const where[]="") |
Get the stored value as a boolean. | |
bool_type const & | get_bool (char const where[]="") const |
Get the stored value as a const boolean. | |
int_type & | get_int (char const where[]="") |
Get the stored value as an integer. | |
int_type const & | get_int (char const where[]="") const |
Get the stored value as a const integer. | |
long_type & | get_long (char const where[]="") |
Get the stored value as a long integer. | |
long_type const & | get_long (char const where[]="") const |
Get the stored value as a const long integer. | |
int_type | get_as_int (char const where[]="") const |
Get the stored value as an integer. | |
uint_type | get_as_uint (char const where[]="") const |
Get the stored value as an unsigned integer. | |
long_type | get_as_long (char const where[]="") const |
Get the stored value as a long integer. | |
ulong_type | get_as_ulong (char const where[]="") const |
Get the stored value as an unsigned long integer. | |
real_type & | get_real (char const where[]="") |
Get the stored value as a real number. | |
real_type const & | get_real (char const where[]="") const |
Get the stored value as a const real number. | |
complex_type & | get_complex (char const where[]="") |
Get the stored value as a complex number. | |
complex_type const & | get_complex (char const where[]="") const |
Get the stored value as a const complex number. | |
string_type & | get_string (char const where[]="") |
Get the stored value as a string. | |
string_type const & | get_string (char const where[]="") const |
Get the stored value as a const string. | |
Access to vector type data. | |
vector_type & | get_vector (char const where[]="") |
vector_type const & | get_vector (char const where[]="") const |
vec_pointer_type & | get_vec_pointer (char const where[]="") |
vec_pointer_type const & | get_vec_pointer (char const where[]="") const |
vec_bool_type & | get_vec_bool (char const where[]="") |
vec_bool_type const & | get_vec_bool (char const where[]="") const |
vec_int_type & | get_vec_int (char const where[]="") |
vec_int_type const & | get_vec_int (char const where[]="") const |
vec_long_type & | get_vec_long (char const where[]="") |
vec_long_type const & | get_vec_long (char const where[]="") const |
vec_real_type & | get_vec_real (char const where[]="") |
vec_real_type const & | get_vec_real (char const where[]="") const |
vec_complex_type & | get_vec_complex (char const where[]="") |
vec_complex_type const & | get_vec_complex (char const where[]="") const |
mat_int_type & | get_mat_int (char const where[]="") |
mat_int_type const & | get_mat_int (char const where[]="") const |
mat_long_type & | get_mat_long (char const where[]="") |
mat_long_type const & | get_mat_long (char const where[]="") const |
mat_real_type & | get_mat_real (char const where[]="") |
mat_real_type const & | get_mat_real (char const where[]="") const |
mat_complex_type & | get_mat_complex (char const where[]="") |
mat_complex_type const & | get_mat_complex (char const where[]="") const |
vec_string_type & | get_vec_string (char const where[]="") |
vec_string_type const & | get_vec_string (char const where[]="") const |
Access to vector type data and convert. | |
void | copyto_vec_int (vec_int_type &v, char const where[]="") const |
void | copyto_vec_uint (vec_uint_type &v, char const where[]="") const |
void | copyto_vec_long (vec_long_type &v, char const where[]="") const |
void | copyto_vec_ulong (vec_ulong_type &v, char const where[]="") const |
void | copyto_vec_real (vec_real_type &v, char const where[]="") const |
void | copyto_vec_complex (vec_complex_type &v, char const where[]="") const |
void | copyto_vec_string (vec_string_type &v, char const where[]="") const |
Access to element of vector type data | |
real_type | get_number_at (unsigned i, char const where[]="") const |
complex_type | get_complex_number_at (unsigned i, char const where[]="") const |
void | get_complex_number_at (unsigned i, real_type &re, real_type &im, char const where[]="") const |
template<typename T > | |
T & | get_pointer_at (unsigned i) |
template<typename T > | |
T | get_pointer_at (unsigned i) const |
Return i -th generic pointer (if fails issue an error). | |
bool_type | get_bool_at (unsigned i) |
bool_type | get_bool_at (unsigned i, char const where[]) const |
int_type & | get_int_at (unsigned i) |
int_type const & | get_int_at (unsigned i, char const where[]) const |
long_type & | get_long_at (unsigned i) |
long_type const & | get_long_at (unsigned i, char const where[]) const |
real_type & | get_real_at (unsigned i) |
real_type const & | get_real_at (unsigned i, char const where[]) const |
complex_type & | get_complex_at (unsigned i) |
complex_type const & | get_complex_at (unsigned i, char const where[]) const |
int_type & | get_int_at (unsigned i, unsigned j) |
int_type const & | get_int_at (unsigned i, unsigned j, char const where[]) const |
long_type & | get_long_at (unsigned i, unsigned j) |
long_type const & | get_long_at (unsigned i, unsigned j, char const where[]) const |
real_type & | get_real_at (unsigned i, unsigned j) |
real_type const & | get_real_at (unsigned i, unsigned j, char const where[]) const |
complex_type & | get_complex_at (unsigned i, unsigned j) |
complex_type const & | get_complex_at (unsigned i, unsigned j, char const where[]) const |
string_type & | get_string_at (unsigned i) |
string_type const & | get_string_at (unsigned i, char const where[]) const |
GenericContainer & | get_gc_at (unsigned i) |
GenericContainer const & | get_gc_at (unsigned i, char const where[]) const |
Access to map type element. | |
map_type & | get_map (char const where[]="") |
map_type const & | get_map (char const where[]="") const |
Access using operators. | |
GenericContainer & | operator[] (unsigned i) |
GenericContainer const & | operator[] (unsigned i) const |
GenericContainer & | operator[] (string_type const &s) |
GenericContainer const & | operator[] (string_type const &s) const |
GenericContainer & | operator() (unsigned i, char const where[]="") |
GenericContainer const & | operator() (unsigned i, char const where[]="") const |
GenericContainer & | operator() (string_type const &s, char const where[]="") |
GenericContainer const & | operator() (string_type const &s, char const where[]="") const |
GenericContainer & | operator() (vec_string_type const &vs, char const where[]="") |
GenericContainer const & | operator() (vec_string_type const &vs, char const where[]="") const |
Initialize data using set command. | |
void | set (bool const &a) |
void | set (uint_type const &a) |
void | set (int_type const &a) |
void | set (ulong_type const &a) |
void | set (long_type const &a) |
void | set (float const &a) |
void | set (double const &a) |
void | set (complex< float > const &a) |
void | set (complex< double > const &a) |
void | set (char const *a) |
void | set (string_type const &a) |
void | set (pointer_type a) |
Initialize data using operators. | |
The | |
GenericContainer & | operator= (bool const &a) |
GenericContainer & | operator= (uint_type const &a) |
GenericContainer & | operator= (int_type const &a) |
GenericContainer & | operator= (ulong_type const &a) |
GenericContainer & | operator= (long_type const &a) |
GenericContainer & | operator= (float const &a) |
GenericContainer & | operator= (double const &a) |
GenericContainer & | operator= (complex< float > const &a) |
GenericContainer & | operator= (complex< double > const &a) |
GenericContainer & | operator= (vec_bool_type const &a) |
GenericContainer & | operator= (vec_int_type const &a) |
GenericContainer & | operator= (vec_long_type const &a) |
GenericContainer & | operator= (vec_real_type const &a) |
GenericContainer & | operator= (vec_complex_type const &a) |
GenericContainer & | operator= (vec_string_type const &a) |
GenericContainer & | operator= (mat_int_type const &a) |
GenericContainer & | operator= (mat_long_type const &a) |
GenericContainer & | operator= (mat_real_type const &a) |
GenericContainer & | operator= (mat_complex_type const &a) |
GenericContainer & | operator= (char const *a) |
GenericContainer & | operator= (string_type const &a) |
GenericContainer & | operator= (pointer_type a) |
GenericContainer const & | operator= (GenericContainer const &a) |
void | load (GenericContainer const &a) |
Promotion to a <tt>bigger</tt> data. | |
GenericContainer const & | promote_to_int () |
GenericContainer const & | promote_to_long () |
GenericContainer const & | promote_to_real () |
GenericContainer const & | promote_to_complex () |
GenericContainer const & | promote_to_vec_int () |
GenericContainer const & | promote_to_vec_long () |
GenericContainer const & | promote_to_vec_real () |
GenericContainer const & | promote_to_vec_complex () |
GenericContainer const & | promote_to_mat_int () |
GenericContainer const & | promote_to_mat_long () |
GenericContainer const & | promote_to_mat_real () |
GenericContainer const & | promote_to_mat_complex () |
GenericContainer const & | promote_to_vector () |
Initialize data by overloading constructor. | |
GenericContainer (bool const &a) | |
GenericContainer (uint_type const &a) | |
GenericContainer (int_type const &a) | |
GenericContainer (ulong_type const &a) | |
GenericContainer (long_type const &a) | |
GenericContainer (float const &a) | |
GenericContainer (double const &a) | |
GenericContainer (complex< float > const &a) | |
GenericContainer (complex< double > const &a) | |
GenericContainer (char const *a) | |
GenericContainer (string_type const &a) | |
GenericContainer (pointer_type a) | |
GenericContainer (GenericContainer const &gc) | |
Utilities methods. | |
bool | exists (string_type const &s) const |
bool | exists (vec_string_type const &vs) const |
string | must_exists (vec_string_type const &vs, char const where[]) const |
bool | get_if_exists (string_type const &field, bool &value) const |
bool | get_if_exists (vec_string_type const &fields, bool &value) const |
bool | get_if_exists (string_type const &field, int_type &value) const |
bool | get_if_exists (string_type const &field, uint_type &value) const |
bool | get_if_exists (string_type const &field, long_type &value) const |
bool | get_if_exists (string_type const &field, ulong_type &value) const |
bool | get_if_exists (string_type const &field, real_type &value) const |
bool | get_if_exists (string_type const &field, complex_type &value) const |
bool | get_if_exists (string_type const &field, string_type &value) const |
template<typename T > | |
bool | get_if_exists (vec_string_type const &fields, T &value) const |
template<typename T > | |
bool | get_if_exists (char const field[], T &value) const |
I/O for GenericContainer objects. | |
void | print_content_types (ostream_type &stream, string_type const &prefix="", string_type const &indent=" ") const |
void | dump (ostream_type &stream, string_type const &prefix="", string_type const &indent=" ") const |
void | print (ostream_type &stream, string_type const &prefix="", string_type const &indent=" ") const |
string_type | print (string_type const &prefix="", string_type const &indent=" ") const |
void | to_gc (GenericContainer &gc) const |
void | from_gc (GenericContainer const &gc) |
void | merge (GenericContainer const &gc, char const where[]) |
void | to_yaml (ostream_type &stream, string_type const &prefix="") const |
string | to_yaml (string_type const &prefix="") const |
void | to_json (ostream_type &stream, string_type const &prefix="") const |
string | to_json (string_type const &prefix="") const |
void | collapse () |
GenericContainer const & | writeFormattedData (ostream_type &stream, char const delimiter='\t') const |
GenericContainer & | readFormattedData (istream_type &stream, char const commentChars[]="#%", char const delimiters[]=" \t") |
GenericContainer & | readFormattedData (char const fname[], char const commentChars[]="#%", char const delimiters[]=" \t") |
GenericContainer & | readFormattedData2 (istream_type &stream, char const commentChars[]="#%", char const delimiters[]=" \t", GenericContainer ptr_pars[]=nullptr) |
GenericContainer & | readFormattedData2 (char const fname[], char const commentChars[]="#%", char const delimiters[]=" \t", GenericContainer ptr_pars[]=nullptr) |
Serialization. | |
int32_t | mem_size () const |
int32_t | serialize (int32_t buffer_dim, uint8_t *buffer) const |
int32_t | serialize (vector< uint8_t > &buffer) const |
int32_t | de_serialize (int32_t buffer_dim, uint8_t const *buffer) |
int32_t | de_serialize (vector< uint8_t > const &buffer) |
Static Public Member Functions | |
static void | exception (char const where[]) GC_NO_RETURN |
The GenericContainer
class provides a flexible container for storing heterogeneous data types.
This class allows storage of various data types, including primitive types (e.g., integer, floating-point), complex types, and containers like vectors and maps. It supports recursive structures where elements of the container can themselves be other GenericContainer
objects.
GenericContainer
(recursive container)GenericContainer
(key-value structure, recursive container)These capabilities make GenericContainer
a highly versatile container for managing mixed-type data in C++.
using GC_namespace::GenericContainer::bool_type = GC_namespace::bool_type |
Alias for boolean type.
using GC_namespace::GenericContainer::complex_type = GC_namespace::complex_type |
Alias for complex number type.
using GC_namespace::GenericContainer::int_type = GC_namespace::int_type |
Alias for integer type.
using GC_namespace::GenericContainer::long_type = GC_namespace::long_type |
Alias for long integer type.
using GC_namespace::GenericContainer::map_type = GC_namespace::map_type |
Alias for map of GenericContainer
type.
Alias for matrix of complex numbers type.
Alias for matrix of integers type.
Alias for matrix of long integers type.
Alias for matrix of real numbers type.
using GC_namespace::GenericContainer::pointer_type = GC_namespace::pointer_type |
Alias for pointer type.
using GC_namespace::GenericContainer::real_type = GC_namespace::real_type |
Alias for real (floating point) type.
using GC_namespace::GenericContainer::string_type = GC_namespace::string_type |
Alias for string type.
using GC_namespace::GenericContainer::uint_type = GC_namespace::uint_type |
Alias for unsigned integer type.
using GC_namespace::GenericContainer::ulong_type = GC_namespace::ulong_type |
Alias for unsigned long integer type.
using GC_namespace::GenericContainer::vec_bool_type = GC_namespace::vec_bool_type |
Alias for vector of booleans type.
using GC_namespace::GenericContainer::vec_complex_type = GC_namespace::vec_complex_type |
Alias for vector of complex numbers type.
using GC_namespace::GenericContainer::vec_int_type = GC_namespace::vec_int_type |
Alias for vector of integers type.
using GC_namespace::GenericContainer::vec_long_type = GC_namespace::vec_long_type |
Alias for vector of long integers type.
using GC_namespace::GenericContainer::vec_pointer_type = GC_namespace::vec_pointer_type |
Alias for vector of pointers type.
using GC_namespace::GenericContainer::vec_real_type = GC_namespace::vec_real_type |
Alias for vector of real numbers type.
using GC_namespace::GenericContainer::vec_string_type = GC_namespace::vec_string_type |
Alias for vector of strings type.
using GC_namespace::GenericContainer::vec_uint_type = GC_namespace::vec_uint_type |
Alias for vector of unsigned integers type.
using GC_namespace::GenericContainer::vec_ulong_type = GC_namespace::vec_ulong_type |
Alias for vector of unsigned long integers type.
using GC_namespace::GenericContainer::vector_type = GC_namespace::vector_type |
Alias for vector of GenericContainer
type.
|
inline |
Constructs a GenericContainer
with an initial empty state.
This constructor initializes a GenericContainer
object with no data. The internal data type is set to NOTYPE
, indicating that no data is currently stored in the container.
|
inline |
Destroys the GenericContainer
and releases any allocated resources.
This destructor ensures that any dynamically allocated memory or resources associated with the data stored in the GenericContainer
are properly freed. It automatically calls the clear()
method to ensure the object is fully cleaned up before destruction.
|
inline |
Construct a generic container storing a boolean
[in] | a | initializer data |
|
inline |
Construct a generic container storing an integer
[in] | a | initializer data |
|
inline |
Construct a generic container storing an integer
[in] | a | initializer data |
|
inline |
Construct a generic container storing an integer
[in] | a | initializer data |
|
inline |
Construct a generic container storing an integer
[in] | a | initializer data |
|
inline |
Construct a generic container storing a floating point number
[in] | a | initializer data |
|
inline |
Construct a generic container storing a floating point number
[in] | a | initializer data |
|
inline |
Construct a generic container storing a complex floating point number
[in] | a | initializer data |
|
inline |
Construct a generic container storing a complex floating point number
[in] | a | initializer data |
|
inline |
Construct a generic container storing a string
[in] | a | initializer data |
|
inline |
Construct a generic container storing a string
[in] | a | initializer data |
|
inline |
Construct a generic container storing a pointer
[in] | a | initializer data |
|
inline |
Construct a generic container copying container gc
[in] | gc | initializer data |
void GC_namespace::GenericContainer::clear | ( | ) |
Clears the content of the GenericContainer
, resetting it to an empty state.
This method frees any memory or resources associated with the data currently stored in the container. After calling clear()
, the container's data type is set back to NOTYPE
.
This function is particularly useful when the container is no longer needed or when you want to reuse the same GenericContainer
object for different data.
void GC_namespace::GenericContainer::collapse | ( | ) |
Collapse heterogeneous vectors into a unified type. Attempts to collapse nested vectors into a matrix when possible.
void GC_namespace::GenericContainer::copyto_vec_complex | ( | vec_complex_type & | v, |
char const | where[] = "" ) const |
Copy internal data to a vector of complex_type
[out] | v | Vector to store the data |
[in] | where | Position added to the error message |
void GC_namespace::GenericContainer::copyto_vec_int | ( | vec_int_type & | v, |
char const | where[] = "" ) const |
Copy internal data to a vector of integers
[out] | v | Vector to store the data |
[in] | where | Position added to the error message |
void GC_namespace::GenericContainer::copyto_vec_long | ( | vec_long_type & | v, |
char const | where[] = "" ) const |
Copy internal data to a vector of long integers
[out] | v | Vector to store the data |
[in] | where | Position added to the error message |
void GC_namespace::GenericContainer::copyto_vec_real | ( | vec_real_type & | v, |
char const | where[] = "" ) const |
Copy internal data to a vector of real_type
[out] | v | Vector to store the data |
[in] | where | Position added to the error message |
void GC_namespace::GenericContainer::copyto_vec_string | ( | vec_string_type & | v, |
char const | where[] = "" ) const |
Copy internal data to a vector of strings
[out] | v | Vector to store the data |
[in] | where | Position added to the error message |
void GC_namespace::GenericContainer::copyto_vec_uint | ( | vec_uint_type & | v, |
char const | where[] = "" ) const |
Copy internal data to a vector of unsigned integers
[out] | v | Vector to store the data |
[in] | where | Position added to the error message |
void GC_namespace::GenericContainer::copyto_vec_ulong | ( | vec_ulong_type & | v, |
char const | where[] = "" ) const |
Copy internal data to a vector of unsigned long integers
[out] | v | Vector to store the data |
[in] | where | Position added to the error message |
int32_t GC_namespace::GenericContainer::de_serialize | ( | int32_t | buffer_dim, |
uint8_t const * | buffer ) |
Build the generic container from the serialized version of the GenericContainer conrined in buffer.
int32_t GC_namespace::GenericContainer::de_serialize | ( | vector< uint8_t > const & | buffer | ) |
Build the generic container from the serialized version of the GenericContainer conrined in buffer.
void GC_namespace::GenericContainer::dump | ( | ostream_type & | stream, |
string_type const & | prefix = "", | ||
string_type const & | indent = " " ) const |
Dump the contents of the object in a human readable way
[in] | stream | output stream |
[in] | prefix | strig to be prepended to any field of the GenericContainer |
[in] | indent | indentation |
void GC_namespace::GenericContainer::erase | ( | char const | name[] | ) |
Removes an item from the map stored in the GenericContainer
by its key.
This method deletes an entry in the map contained within the GenericContainer
, identified by the provided key name
. The GenericContainer
must currently store a map (MAP
data type), otherwise, an error is thrown.
name | The key of the element to be removed from the map. |
runtime_error | If the current data type is not MAP . |
|
static |
Do an exception
[in] | where | position added to the error message |
bool GC_namespace::GenericContainer::exists | ( | string_type const & | s | ) | const |
Check if string s
is a key of the stored map (if fails issue an error).
[in] | s | key to be checked |
bool GC_namespace::GenericContainer::exists | ( | vec_string_type const & | vs | ) | const |
Check if any string in vs
is a key of the stored map (if fails issue an error).
[in] | vs | vector of string with the keys to be checked |
GenericContainer & GC_namespace::GenericContainer::free_pointer | ( | ) |
Free the pointer and reset the container to an empty state.
This method deallocates any memory or resources associated with the current pointer, resets the container's type to NOTYPE
, and returns a reference to the GenericContainer
instance itself.
GenericContainer
after the pointer has been freed.void GC_namespace::GenericContainer::from_gc | ( | GenericContainer const & | gc | ) |
Copy the contents of the object into another object
[in] | gc | input GenericContainer |
int_type GC_namespace::GenericContainer::get_as_int | ( | char const | where[] = "" | ) | const |
Get the stored value as an integer.
This function retrieves the data stored in the container as an integer.
[in] | where | Optional context for error messages, indicating the position of the call. |
long_type GC_namespace::GenericContainer::get_as_long | ( | char const | where[] = "" | ) | const |
Get the stored value as a long integer.
This function retrieves the data stored in the container as a long integer.
[in] | where | Optional context for error messages, indicating the position of the call. |
uint_type GC_namespace::GenericContainer::get_as_uint | ( | char const | where[] = "" | ) | const |
Get the stored value as an unsigned integer.
This function retrieves the data stored in the container as an unsigned integer.
[in] | where | Optional context for error messages, indicating the position of the call. |
ulong_type GC_namespace::GenericContainer::get_as_ulong | ( | char const | where[] = "" | ) | const |
Get the stored value as an unsigned long integer.
This function retrieves the data stored in the container as an unsigned long integer.
[in] | where | Optional context for error messages, indicating the position of the call. |
bool_type & GC_namespace::GenericContainer::get_bool | ( | char const | where[] = "" | ) |
Get the stored value as a boolean.
This function retrieves a boolean value from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
bool_type const & GC_namespace::GenericContainer::get_bool | ( | char const | where[] = "" | ) | const |
Get the stored value as a const boolean.
This function retrieves a const boolean value from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
bool_type GC_namespace::GenericContainer::get_bool_at | ( | unsigned | i | ) |
Get the i
-th boolean of the stored data.
[in] | i | The position of the element in the vector |
bool_type GC_namespace::GenericContainer::get_bool_at | ( | unsigned | i, |
char const | where[] ) const |
Get the i
-th boolean of the stored data.
[in] | i | The position of the element in the vector |
[in] | where | Position added to the error message |
complex_type & GC_namespace::GenericContainer::get_complex | ( | char const | where[] = "" | ) |
Get the stored value as a complex number.
This function retrieves a complex number from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
complex_type const & GC_namespace::GenericContainer::get_complex | ( | char const | where[] = "" | ) | const |
Get the stored value as a const complex number.
This function retrieves a const complex number from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
complex_type & GC_namespace::GenericContainer::get_complex_at | ( | unsigned | i | ) |
Get the i
-th complex_type
of the stored data.
[in] | i | The position of the element in the vector |
complex_type const & GC_namespace::GenericContainer::get_complex_at | ( | unsigned | i, |
char const | where[] ) const |
Get the i
-th const complex_type
of the stored data.
[in] | i | The position of the element in the vector |
[in] | where | Position added to the error message |
complex_type & GC_namespace::GenericContainer::get_complex_at | ( | unsigned | i, |
unsigned | j ) |
Get the i
-th complex_type
of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
complex_type const & GC_namespace::GenericContainer::get_complex_at | ( | unsigned | i, |
unsigned | j, | ||
char const | where[] ) const |
Get the i
-th const complex_type
of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
[in] | where | Position added to the error message |
complex_type GC_namespace::GenericContainer::get_complex_number | ( | char const | where[] = "" | ) | const |
Get a stored complex number if the data is boolean, integer, real, or complex type.
[in] | where | Optional parameter to provide context for error messages. |
0
if the data is of an unsupported type. Get the real and imaginary parts of a stored complex number.
This function extracts the real and imaginary parts of the complex number and stores them in the provided references.
[out] | re | Reference to store the real part of the complex number. |
[out] | im | Reference to store the imaginary part of the complex number. |
complex_type GC_namespace::GenericContainer::get_complex_number_at | ( | unsigned | i, |
char const | where[] = "" ) const |
If the i
-th element of the vector is convertible to complex, return the number; otherwise return 0
.
[in] | i | The position of the element in the vector |
[in] | where | Position added to the error message |
complex_type
void GC_namespace::GenericContainer::get_complex_number_at | ( | unsigned | i, |
real_type & | re, | ||
real_type & | im, | ||
char const | where[] = "" ) const |
If the i
-th element of the vector is convertible to complex, return the number; otherwise return 0
.
[in] | i | The position of the element in the vector |
[out] | re | Real part of the number |
[out] | im | Imaginary part of the number |
[in] | where | Position added to the error message |
complex_type * GC_namespace::GenericContainer::get_complex_pointer | ( | ) |
Return the stored data as a pointer to complex_type.
complex_type const * GC_namespace::GenericContainer::get_complex_pointer | ( | ) | const |
Return the stored data as a pointer to const complex_type.
GenericContainer & GC_namespace::GenericContainer::get_gc_at | ( | unsigned | i | ) |
Get the i
-th const GenericContainer
of the stored data.
[in] | i | Position of the element in the vector |
GenericContainer const & GC_namespace::GenericContainer::get_gc_at | ( | unsigned | i, |
char const | where[] ) const |
Get the i
-th const GenericContainer
of the stored data.
[in] | i | Position of the element in the vector |
[in] | where | Position added to the error message |
|
inline |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
bool & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
complex_type & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
int_type & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
long_type & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
real_type & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
string_type & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
uint_type & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | string_type const & | field, |
ulong_type & | value ) const |
Check if string field
is a key of the stored map and extract value if exists
[in] | field | key to be checked |
[in] | value | value to be extracted |
bool GC_namespace::GenericContainer::get_if_exists | ( | vec_string_type const & | fields, |
bool & | value ) const |
Check if vector of strings fields
is a key of the stored map and extract value if exists
[in] | fields | keys to be checked |
[in] | value | value to be extracted |
|
inline |
Check if vector of strings fields
is a key of the stored map and extract value if exists
[in] | fields | keys to be checked |
[in] | value | value to be extracted |
int_type & GC_namespace::GenericContainer::get_int | ( | char const | where[] = "" | ) |
Get the stored value as an integer.
This function retrieves an integer value from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
int_type const & GC_namespace::GenericContainer::get_int | ( | char const | where[] = "" | ) | const |
Get the stored value as a const integer.
This function retrieves a const integer value from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
int_type & GC_namespace::GenericContainer::get_int_at | ( | unsigned | i | ) |
Get the i
-th integer of the stored data.
[in] | i | The position of the element in the vector |
int_type const & GC_namespace::GenericContainer::get_int_at | ( | unsigned | i, |
char const | where[] ) const |
Get the i
-th const integer of the stored data.
[in] | i | The position of the element in the vector |
[in] | where | Position added to the error message |
int_type & GC_namespace::GenericContainer::get_int_at | ( | unsigned | i, |
unsigned | j ) |
Get the i
-th integer of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
int_type const & GC_namespace::GenericContainer::get_int_at | ( | unsigned | i, |
unsigned | j, | ||
char const | where[] ) const |
Get the i
-th const integer of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
[in] | where | Position added to the error message |
int_type * GC_namespace::GenericContainer::get_int_pointer | ( | ) |
Return the stored data as a pointer to const integer.
int_type const * GC_namespace::GenericContainer::get_int_pointer | ( | ) | const |
Return the stored data as a pointer to const integer
string GC_namespace::GenericContainer::get_keys | ( | ) | const |
Extracts the keys of the map stored in the GenericContainer
as a comma-separated string.
If the container holds a map (MAP
type), this method returns the map's keys as a single string, where each key is separated by a comma. If the container is not a map, an exception is thrown.
runtime_error | if the container does not hold a map. |
void GC_namespace::GenericContainer::get_keys | ( | vec_string_type & | keys | ) | const |
Extracts the keys of the map stored in the GenericContainer
into a vector of strings.
If the container holds a map (MAP
type), this method populates the provided keys
vector with the keys from the map. If the container is not a map, the method throws an exception.
[out] | keys | A vector of strings that will be filled with the map's keys. |
runtime_error | if the container does not hold a map. |
long_type & GC_namespace::GenericContainer::get_long | ( | char const | where[] = "" | ) |
Get the stored value as a long integer.
This function retrieves a long integer value from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
long_type const & GC_namespace::GenericContainer::get_long | ( | char const | where[] = "" | ) | const |
Get the stored value as a const long integer.
This function retrieves a const long integer value from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
long_type & GC_namespace::GenericContainer::get_long_at | ( | unsigned | i | ) |
Get the i
-th long integer of the stored data.
[in] | i | The position of the element in the vector |
long_type const & GC_namespace::GenericContainer::get_long_at | ( | unsigned | i, |
char const | where[] ) const |
Get the i
-th const long integer of the stored data.
[in] | i | The position of the element in the vector |
[in] | where | Position added to the error message |
long_type & GC_namespace::GenericContainer::get_long_at | ( | unsigned | i, |
unsigned | j ) |
Get the i
-th long integer of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
long_type const & GC_namespace::GenericContainer::get_long_at | ( | unsigned | i, |
unsigned | j, | ||
char const | where[] ) const |
Get the i
-th const long integer of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
[in] | where | Position added to the error message |
long_type * GC_namespace::GenericContainer::get_long_pointer | ( | ) |
Return the stored data as a pointer to long.
long_type const * GC_namespace::GenericContainer::get_long_pointer | ( | ) | const |
Return the stored data as a pointer to const long.
map_type & GC_namespace::GenericContainer::get_map | ( | char const | where[] = "" | ) |
Get the stored data as a map of GenericContainer
.
[in] | where | Position added to the error message |
map_type const & GC_namespace::GenericContainer::get_map | ( | char const | where[] = "" | ) | const |
Get the stored data as a const map of GenericContainer
.
[in] | where | Position added to the error message |
bool_type GC_namespace::GenericContainer::get_map_bool | ( | char const | key[], |
char const | where[] = "" ) const |
Get the stored value in the map as boolean.
This function retrieves a boolean value from the map using the specified key.
[in] | key | The key of the map to be selected. |
[in] | where | Optional parameter to provide context for error messages. |
bool_type GC_namespace::GenericContainer::get_map_bool | ( | vec_string_type const & | keys, |
char const | where[] = "" ) const |
Get the stored value in the map as boolean. The key is searched between the strings in keys
the first one found return the boolena value.
[in] | keys | keys of the map to be selected |
[in] | where | position added to the error message |
int_type GC_namespace::GenericContainer::get_map_int | ( | char const | key[], |
char const | where[] = "" ) const |
Get the stored value in the map as an integer.
This function retrieves an integer value from the map using the specified key.
[in] | key | The key of the map to be selected. |
[in] | where | Optional context for error messages, indicating the position of the call. |
int_type GC_namespace::GenericContainer::get_map_int | ( | vec_string_type const & | keys, |
char const | where[] = "" ) const |
Get the stored value in the map as an integer from a list of keys.
This function searches for the first matching key among the provided strings in keys
and returns the corresponding integer value.
[in] | keys | The list of keys to search in the map. |
[in] | where | Optional context for error messages, indicating the position of the call. |
real_type GC_namespace::GenericContainer::get_map_number | ( | char const | key[], |
char const | where[] = "" ) const |
Get the stored value in the map as a real number.
This function retrieves a real number from the map using the specified key.
[in] | key | The key of the map to be selected. |
[in] | where | Optional context for error messages, indicating the position of the call. |
real_type GC_namespace::GenericContainer::get_map_number | ( | vec_string_type const & | keys, |
char const | where[] = "" ) const |
Get the stored value in the map as a real number from a list of keys.
This function searches for the first matching key among the provided strings in keys
and returns the corresponding real number value.
[in] | keys | The list of keys to search in the map. |
[in] | where | Optional context for error messages, indicating the position of the call. |
string_type const & GC_namespace::GenericContainer::get_map_string | ( | char const | key[], |
char const | where[] = "" ) const |
Get the stored value in the map as a string.
This function retrieves a string from the map using the specified key.
[in] | key | The key of the map to be selected. |
[in] | where | Optional context for error messages, indicating the position of the call. |
string_type const & GC_namespace::GenericContainer::get_map_string | ( | vec_string_type const & | keys, |
char const | where[] = "" ) const |
Get the stored value in the map as a string from a list of keys.
This function searches for the first matching key among the provided strings in keys
and returns the corresponding string value.
[in] | keys | The list of keys to search in the map. |
[in] | where | Optional context for error messages, indicating the position of the call. |
vec_complex_type const & GC_namespace::GenericContainer::get_map_vec_complex | ( | char const | key[], |
char const | where[] = "" ) const |
Get the stored value in the map as a vector of complex numbers.
This function retrieves a vector of complex numbers from the map using the specified key.
[in] | key | The key of the map to be selected. |
[in] | where | Optional context for error messages, indicating the position of the call. |
vec_complex_type const & GC_namespace::GenericContainer::get_map_vec_complex | ( | vec_string_type const & | keys, |
char const | where[] = "" ) const |
Get the stored value in the map as a vector of complex numbers from a list of keys.
This function searches for the first matching key among the provided strings in keys
and returns the corresponding vector of complex numbers.
[in] | keys | The list of keys to search in the map. |
[in] | where | Optional context for error messages, indicating the position of the call. |
vec_real_type const & GC_namespace::GenericContainer::get_map_vec_real | ( | char const | key[], |
char const | where[] = "" ) const |
Get the stored value in the map as a vector of real numbers.
This function retrieves a vector of real numbers from the map using the specified key.
[in] | key | The key of the map to be selected. |
[in] | where | Optional context for error messages, indicating the position of the call. |
vec_real_type const & GC_namespace::GenericContainer::get_map_vec_real | ( | vec_string_type const & | keys, |
char const | where[] = "" ) const |
Get the stored value in the map as a vector of real numbers from a list of keys.
This function searches for the first matching key among the provided strings in keys
and returns the corresponding vector of real numbers.
[in] | keys | The list of keys to search in the map. |
[in] | where | Optional context for error messages, indicating the position of the call. |
vec_string_type const & GC_namespace::GenericContainer::get_map_vec_string | ( | char const | key[], |
char const | where[] = "" ) const |
Get the stored value in the map as a vector of strings.
This function retrieves a vector of strings from the map using the specified key.
[in] | key | The key of the map to be selected. |
[in] | where | Optional context for error messages, indicating the position of the call. |
vec_string_type const & GC_namespace::GenericContainer::get_map_vec_string | ( | vec_string_type const & | keys, |
char const | where[] = "" ) const |
Get the stored value in the map as a vector of strings from a list of keys.
This function searches for the first matching key among the provided strings in keys
and returns the corresponding vector of strings.
[in] | keys | The list of keys to search in the map. |
[in] | where | Optional context for error messages, indicating the position of the call. |
mat_complex_type & GC_namespace::GenericContainer::get_mat_complex | ( | char const | where[] = "" | ) |
Get the stored value as a matrix of complex_type
[in] | where | Position added to the error message |
complex_type
mat_complex_type const & GC_namespace::GenericContainer::get_mat_complex | ( | char const | where[] = "" | ) | const |
Get the stored value as a const matrix of complex_type
[in] | where | Position added to the error message |
complex_type
mat_int_type & GC_namespace::GenericContainer::get_mat_int | ( | char const | where[] = "" | ) |
Get the stored value as a matrix of integers
[in] | where | Position added to the error message |
mat_int_type const & GC_namespace::GenericContainer::get_mat_int | ( | char const | where[] = "" | ) | const |
Get the stored value as a const matrix of integers
[in] | where | Position added to the error message |
mat_long_type & GC_namespace::GenericContainer::get_mat_long | ( | char const | where[] = "" | ) |
Get the stored value as a matrix of long integers
[in] | where | Position added to the error message |
mat_long_type const & GC_namespace::GenericContainer::get_mat_long | ( | char const | where[] = "" | ) | const |
Get the stored value as a const matrix of long integers
[in] | where | Position added to the error message |
mat_real_type & GC_namespace::GenericContainer::get_mat_real | ( | char const | where[] = "" | ) |
Get the stored value as a matrix of real_type
[in] | where | Position added to the error message |
real_type
mat_real_type const & GC_namespace::GenericContainer::get_mat_real | ( | char const | where[] = "" | ) | const |
Get the stored value as a const matrix of real_type
[in] | where | Position added to the error message |
real_type
unsigned GC_namespace::GenericContainer::get_num_elements | ( | ) | const |
Return the number of elements in the first level of the generic container.
real_type GC_namespace::GenericContainer::get_number | ( | char const | where[] = "" | ) | const |
Get a stored numeric value if the data is boolean, integer, or real type.
[in] | where | Optional parameter to provide context for error messages. |
0
if the data is of an unsupported type. real_type GC_namespace::GenericContainer::get_number_at | ( | unsigned | i, |
char const | where[] = "" ) const |
If the i
-th element of the vector is boolean, integer, or floating point then return the number, otherwise return 0
.
[in] | i | The position of the element in the vector |
[in] | where | Position added to the error message |
real_type
|
inline |
|
inline |
|
inline |
Get the stored value as a pointer.
This function retrieves the stored pointer value.
|
inline |
Get the stored value as a pointer (const version).
This function retrieves the stored pointer value as a const.
|
inline |
Get the i
-th pointer of the vector of pointers.
[in] | i | The position of the element in the vector |
|
inline |
Return i
-th generic pointer (if fails issue an error).
Get the i
-th pointer of the vector of pointers.
[in] | i | The position of the element in the vector |
void ** GC_namespace::GenericContainer::get_ppvoid | ( | char const | where[] = "" | ) | const |
Return the stored data as a double pointer.
[in] | where | Optional parameter to provide context for error messages. |
void * GC_namespace::GenericContainer::get_pvoid | ( | char const | where[] = "" | ) | const |
Return the stored data as a generic pointer.
[in] | where | Optional parameter to provide context for error messages. |
real_type & GC_namespace::GenericContainer::get_real | ( | char const | where[] = "" | ) |
Get the stored value as a real number.
This function retrieves a real number from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
real_type const & GC_namespace::GenericContainer::get_real | ( | char const | where[] = "" | ) | const |
Get the stored value as a const real number.
This function retrieves a const real number from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
real_type & GC_namespace::GenericContainer::get_real_at | ( | unsigned | i | ) |
Get the i
-th real_type
of the stored data.
[in] | i | The position of the element in the vector |
real_type const & GC_namespace::GenericContainer::get_real_at | ( | unsigned | i, |
char const | where[] ) const |
Get the i
-th const real_type
of the stored data.
[in] | i | The position of the element in the vector |
[in] | where | Position added to the error message |
real_type & GC_namespace::GenericContainer::get_real_at | ( | unsigned | i, |
unsigned | j ) |
Get the i
-th real_type
of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
real_type const & GC_namespace::GenericContainer::get_real_at | ( | unsigned | i, |
unsigned | j, | ||
char const | where[] ) const |
Get the i
-th const real_type
of the stored data in a matrix.
[in] | i | Row position of the element in the matrix |
[in] | j | Column position of the element in the matrix |
[in] | where | Position added to the error message |
real_type * GC_namespace::GenericContainer::get_real_pointer | ( | ) |
Return the stored data as a pointer to real_type.
real_type const * GC_namespace::GenericContainer::get_real_pointer | ( | ) | const |
Return the stored data as a pointer to const real_type.
string_type & GC_namespace::GenericContainer::get_string | ( | char const | where[] = "" | ) |
Get the stored value as a string.
This function retrieves a string from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
string_type const & GC_namespace::GenericContainer::get_string | ( | char const | where[] = "" | ) | const |
Get the stored value as a const string.
This function retrieves a const string from the container.
[in] | where | Optional context for error messages, indicating the position of the call. |
string_type & GC_namespace::GenericContainer::get_string_at | ( | unsigned | i | ) |
Get the i
-th string of the stored data.
[in] | i | Position of the element in the vector |
string_type const & GC_namespace::GenericContainer::get_string_at | ( | unsigned | i, |
char const | where[] ) const |
Get the i
-th const string of the stored data.
[in] | i | Position of the element in the vector |
[in] | where | Position added to the error message |
|
inline |
Return an integer representing the type of data stored.
This function returns an integer corresponding to the type of data that is currently stored in the container. The integer is mapped to specific data types as follows:
|
inline |
Return a string representing the type of data stored.
This function returns a pointer to a string that describes the type of data currently held by the container. This is helpful for debugging and logging purposes.
void GC_namespace::GenericContainer::get_value | ( | T & | v, |
char const | where[] = "" ) const |
Get the stored value.
This template function retrieves the stored value and assigns it to the provided reference variable.
[out] | v | The reference to store the copied value. |
[in] | where | Optional parameter to provide context for error messages. |
vec_bool_type & GC_namespace::GenericContainer::get_vec_bool | ( | char const | where[] = "" | ) |
Get the stored value as a vector of booleans
[in] | where | Position added to the error message |
vec_bool_type const & GC_namespace::GenericContainer::get_vec_bool | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of booleans
[in] | where | Position added to the error message |
vec_complex_type & GC_namespace::GenericContainer::get_vec_complex | ( | char const | where[] = "" | ) |
Get the stored value as a vector of complex_type
[in] | where | Position added to the error message |
complex_type
vec_complex_type const & GC_namespace::GenericContainer::get_vec_complex | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of complex_type
[in] | where | Position added to the error message |
complex_type
vec_int_type & GC_namespace::GenericContainer::get_vec_int | ( | char const | where[] = "" | ) |
Get the stored value as a vector of integers
[in] | where | Position added to the error message |
vec_int_type const & GC_namespace::GenericContainer::get_vec_int | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of integers
[in] | where | Position added to the error message |
vec_long_type & GC_namespace::GenericContainer::get_vec_long | ( | char const | where[] = "" | ) |
Get the stored value as a vector of long integers
[in] | where | Position added to the error message |
vec_long_type const & GC_namespace::GenericContainer::get_vec_long | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of long integers
[in] | where | Position added to the error message |
vec_pointer_type & GC_namespace::GenericContainer::get_vec_pointer | ( | char const | where[] = "" | ) |
Get the stored value as a vector of pointers
[in] | where | Position added to the error message |
vec_pointer_type const & GC_namespace::GenericContainer::get_vec_pointer | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of pointers
[in] | where | Position added to the error message |
vec_real_type & GC_namespace::GenericContainer::get_vec_real | ( | char const | where[] = "" | ) |
Get the stored value as a vector of real_type
[in] | where | Position added to the error message |
real_type
vec_real_type const & GC_namespace::GenericContainer::get_vec_real | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of real_type
[in] | where | Position added to the error message |
real_type
vec_string_type & GC_namespace::GenericContainer::get_vec_string | ( | char const | where[] = "" | ) |
Get the stored value as a vector of strings
[in] | where | Position added to the error message |
vec_string_type const & GC_namespace::GenericContainer::get_vec_string | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of strings
[in] | where | Position added to the error message |
vector_type & GC_namespace::GenericContainer::get_vector | ( | char const | where[] = "" | ) |
Get the stored value as a vector of GenericoContainer
[in] | where | Position added to the error message |
GenericoContainer
vector_type const & GC_namespace::GenericContainer::get_vector | ( | char const | where[] = "" | ) | const |
Get the stored value as a const vector of GenericoContainer
[in] | where | Position added to the error message |
GenericoContainer
|
inline |
Print information about the kind of data stored as a string.
This method returns a string containing information about the data type and its properties.
GenericContainer const & GC_namespace::GenericContainer::info | ( | ostream_type & | stream | ) | const |
Print information about the kind of data stored to a stream.
This method outputs information about the data type and its properties to the provided output stream.
[out] | stream | The output stream to write the information to. |
|
inline |
Load a GenericContainer
to the generic container (deep copy).
[in] | a | GenericContainer to be stored |
int32_t GC_namespace::GenericContainer::mem_size | ( | ) | const |
Dimension in byte of the serialized generic container.
void GC_namespace::GenericContainer::merge | ( | GenericContainer const & | gc, |
char const | where[] ) |
Merge two generic container
[in] | gc | input GenericContainer |
[in] | where | position added to the error message |
string GC_namespace::GenericContainer::must_exists | ( | vec_string_type const & | vs, |
char const | where[] ) const |
The data stored musty be a map
. Search the
[in] | `vs` | vector of string with the keys to be searched |
[in] | where | position added to the error message |
unsigned GC_namespace::GenericContainer::num_cols | ( | ) | const |
Return the number of columns in the internally stored matrix.
unsigned GC_namespace::GenericContainer::num_rows | ( | ) | const |
Return the number of rows in the internally stored matrix.
GenericContainer & GC_namespace::GenericContainer::operator() | ( | string_type const & | s, |
char const | where[] = "" ) |
Get a GenericContainer
in the stored data using a string key with error message.
[in] | s | Key string of the element in the map |
[in] | where | Position added to the error message |
GenericContainer const & GC_namespace::GenericContainer::operator() | ( | string_type const & | s, |
char const | where[] = "" ) const |
Get a const GenericContainer
in the stored data using a string key with error message.
[in] | s | Key string of the element in the map |
[in] | where | Position added to the error message |
GenericContainer & GC_namespace::GenericContainer::operator() | ( | unsigned | i, |
char const | where[] = "" ) |
Get the i
-th GenericContainer
of the stored data with error message.
[in] | i | Position of the element in the vector |
[in] | where | Position added to the error message |
GenericContainer const & GC_namespace::GenericContainer::operator() | ( | unsigned | i, |
char const | where[] = "" ) const |
Get the i
-th const GenericContainer
of the stored data with error message.
[in] | i | Position of the element in the vector |
[in] | where | Position added to the error message |
GenericContainer & GC_namespace::GenericContainer::operator() | ( | vec_string_type const & | vs, |
char const | where[] = "" ) |
Get a GenericContainer
in the stored data by searching for a matching key from a vector of keys.
[in] | vs | Vector of keys strings |
[in] | where | Position added to the error message |
GenericContainer const & GC_namespace::GenericContainer::operator() | ( | vec_string_type const & | vs, |
char const | where[] = "" ) const |
Get a const GenericContainer
in the stored data by searching for a matching key from a vector of keys.
[in] | vs | Vector of keys string |
[in] | where | Position added to the error message |
|
inline |
Assign a boolean to the generic container.
[in] | a | boolean to be stored |
|
inline |
Assign a string to the generic container.
[in] | a | string to be stored |
|
inline |
Assign a complex of double to the generic container.
[in] | a | complex of double to be stored |
|
inline |
Assign a complex of float to the generic container.
[in] | a | complex of float to be stored |
|
inline |
Assign a double to the generic container.
[in] | a | double to be stored |
|
inline |
Assign a float to the generic container.
[in] | a | float to be stored |
|
inline |
Assign a GenericContainer
to the generic container (deep copy).
[in] | a | GenericContainer to be stored |
|
inline |
Assign an integer to the generic container.
[in] | a | integer to be stored |
|
inline |
Assign a long integer to the generic container.
[in] | a | long integer to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | mat_complex_type const & | a | ) |
Assign a matrix of complex_type
to the generic container.
[in] | a | matrix of complex_type to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | mat_int_type const & | a | ) |
Assign a matrix of integer to the generic container.
[in] | a | matrix of integer to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | mat_long_type const & | a | ) |
Assign a matrix of long integer to the generic container.
[in] | a | matrix of long integer to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | mat_real_type const & | a | ) |
Assign a matrix of real_type
to the generic container.
[in] | a | matrix of real_type to be stored |
|
inline |
Assign a pointer to the generic container.
[in] | a | pointer to be stored |
|
inline |
Assign a string to the generic container.
[in] | a | string to be stored |
|
inline |
Assign an integer to the generic container.
[in] | a | integer to be stored |
|
inline |
Assign an unsigned long to the generic container.
[in] | a | unsigned long to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | vec_bool_type const & | a | ) |
Assign a vector of bool to the generic container.
[in] | a | vector of bool to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | vec_complex_type const & | a | ) |
Assign a vector of complex_type
to the generic container.
[in] | a | vector of complex_type to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | vec_int_type const & | a | ) |
Assign a vector of integer to the generic container.
[in] | a | vector of integer to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | vec_long_type const & | a | ) |
Assign a vector of long integer to the generic container.
[in] | a | vector of long integer to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | vec_real_type const & | a | ) |
Assign a vector of real_type
to the generic container.
[in] | a | vector of real_type to be stored |
GenericContainer & GC_namespace::GenericContainer::operator= | ( | vec_string_type const & | a | ) |
Assign a vector of string to the generic container.
[in] | a | vector of string to be stored |
GenericContainer & GC_namespace::GenericContainer::operator[] | ( | string_type const & | s | ) |
Get the i
-th GenericContainer
of the stored data using a string key.
[in] | s | Key string of the element in the map |
GenericContainer const & GC_namespace::GenericContainer::operator[] | ( | string_type const & | s | ) | const |
Get the i
-th const GenericContainer
of the stored data using a string key.
[in] | s | Key string of the element in the map |
GenericContainer & GC_namespace::GenericContainer::operator[] | ( | unsigned | i | ) |
Get the i
-th GenericContainer
of the stored data.
[in] | i | Position of the element in the vector |
GenericContainer const & GC_namespace::GenericContainer::operator[] | ( | unsigned | i | ) | const |
Get the i
-th const GenericContainer
of the stored data.
[in] | i | Position of the element in the vector |
|
inline |
Dump the contents of the object in a human readable way (aliad of dump)
[in] | stream | output stream |
[in] | prefix | strig to be prepended to any field of the GenericContainer |
[in] | indent | indentation |
|
inline |
Dump the contents of the object in a human readable way (aliad of dump)
[in] | prefix | strig to be prepended to any field of the GenericContainer |
[in] | indent | indentation |
void GC_namespace::GenericContainer::print_content_types | ( | ostream_type & | stream, |
string_type const & | prefix = "", | ||
string_type const & | indent = " " ) const |
Print the contents of the object in a human readable way (without data)
[in] | stream | output stream |
[in] | prefix | strig to be prepended to any field of the GenericContainer |
[in] | indent | indentation |
GenericContainer const & GC_namespace::GenericContainer::promote_to_complex | ( | ) |
If data contains a boolean or an integer or floating point it is promoted to a complex floating point.
GenericContainer const & GC_namespace::GenericContainer::promote_to_int | ( | ) |
If data contains a boolean it is promoted to an integer.
GenericContainer const & GC_namespace::GenericContainer::promote_to_long | ( | ) |
If data contains a boolean it is promoted to an integer.
GenericContainer const & GC_namespace::GenericContainer::promote_to_mat_complex | ( | ) |
If data contains vector of booleans, integer or real or complex or matrix of real it is promoted to a matrix of complex.
GenericContainer const & GC_namespace::GenericContainer::promote_to_mat_int | ( | ) |
If data contains vector of booleans, integer or real it is promoted to a matrix of integer.
GenericContainer const & GC_namespace::GenericContainer::promote_to_mat_long | ( | ) |
If data contains vector of booleans, integer or real it is promoted to a matrix of long integer.
GenericContainer const & GC_namespace::GenericContainer::promote_to_mat_real | ( | ) |
If data contains vector of booleans, integer or real it is promoted to a matrix of real.
GenericContainer const & GC_namespace::GenericContainer::promote_to_real | ( | ) |
If data contains a boolean or an integer it is promoted to a real.
GenericContainer const & GC_namespace::GenericContainer::promote_to_vec_complex | ( | ) |
If data contains vector of booleans or integer or real it is promoted to a vector of complex.
GenericContainer const & GC_namespace::GenericContainer::promote_to_vec_int | ( | ) |
If data contains vector of booleans it is promoted to a vector of integer.
GenericContainer const & GC_namespace::GenericContainer::promote_to_vec_long | ( | ) |
If data contains vector of booleans it is promoted to a vector of integer.
GenericContainer const & GC_namespace::GenericContainer::promote_to_vec_real | ( | ) |
If data contains vector of booleans or integer it is promoted to a vector of real.
GenericContainer const & GC_namespace::GenericContainer::promote_to_vector | ( | ) |
If data contains vector of someting it is promoted to a vector of GenericContainer
.
void GC_namespace::GenericContainer::push_bool | ( | bool | b | ) |
Push a boolean value into the vector or matrix.
This method adds a boolean value to vec_bool_type
or a general vector_type
.
[in] | b | value The boolean value to push. |
void GC_namespace::GenericContainer::push_complex | ( | complex_type & | c | ) |
Push a complex number into the vector or matrix using an existing complex object.
This method adds a complex number to vec_complex_type
or a general vector_type
.
[in] | c | value The complex number to push. |
Push a complex number into the vector or matrix using real and imaginary parts.
This method adds a complex number to vec_complex_type
or a general vector_type
.
[in] | re | The real part of the complex number. |
[in] | im | The imaginary part of the complex number. |
void GC_namespace::GenericContainer::push_int | ( | int_type | i | ) |
Push an integer value into the vector or matrix.
This method adds an integer value to vec_int_type
or a general vector_type
.
[in] | i | value The integer value to push. |
void GC_namespace::GenericContainer::push_long | ( | long_type | l | ) |
Push a long integer value into the vector or matrix.
This method adds a long integer value to vec_long_type
or a general vector_type
.
[in] | l | value The long integer value to push. |
void GC_namespace::GenericContainer::push_real | ( | real_type | r | ) |
Push a real number into the vector or matrix.
This method adds a real number to vec_real_type
or a general vector_type
.
[in] | r | value The real number to push. |
void GC_namespace::GenericContainer::push_string | ( | string_type const & | s | ) |
Push a string value into the vector or matrix.
This method adds a string to vec_string_type
or a general vector_type
.
[in] | s | value The string value to push. |
GenericContainer & GC_namespace::GenericContainer::readFormattedData | ( | char const | fname[], |
char const | commentChars[] = "#%", | ||
char const | delimiters[] = " \t" ) |
Read regular formatted data from file fname
to GenericContainer
.
After successful read GenericContainer
will be a map which contains the fields:
vec_string_type
which contains the strings of the headers of the columns of the datavector_type
which contains the vectors which are the columns of the data red of type vec_real_type
.fname | file name to be read |
commentChars | lines beginning with one of this chars are treated as comments. Default are # and % |
delimiters | characters used as delimiter for headers |
GenericContainer & GC_namespace::GenericContainer::readFormattedData | ( | istream_type & | stream, |
char const | commentChars[] = "#%", | ||
char const | delimiters[] = " \t" ) |
Read regular formatted data from stream
to GenericContainer
.
After successful read GenericContainer
will be a map which contains the fields:
vec_string_type
which contains the strings of the headers of the columns of the datavector_type
which contains the vectors which are the columns of the data red of type vec_real_type
.stream | stream to write the output |
commentChars | lines beginning with one of this chars are treated as comments. Default are # and % |
delimiters | characters used as delimiter for headers |
GenericContainer & GC_namespace::GenericContainer::readFormattedData2 | ( | char const | fname[], |
char const | commentChars[] = "#%", | ||
char const | delimiters[] = " \t", | ||
GenericContainer | ptr_pars[] = nullptr ) |
Read regular formatted data from file fname
to GenericContainer
.
After successful read GenericContainer
will be a map which contains the fields:
vec_string_type
which contains the strings of the headers of the columns of the datamap_type
which contains the vectors which are the columns of the data red of type vec_real_type
.fname | file name to be read |
commentChars | lines beginning with one of this chars are treated as comments. Default are # and % |
delimiters | characters used as delimiter for headers |
ptr_pars | pointer to a GenericContainer which store poarameter parsed in the comment part of the file |
GenericContainer & GC_namespace::GenericContainer::readFormattedData2 | ( | istream_type & | stream, |
char const | commentChars[] = "#%", | ||
char const | delimiters[] = " \t", | ||
GenericContainer | ptr_pars[] = nullptr ) |
Read regular formatted data from stream
to GenericContainer
.
After successful read GenericContainer
will be a map which contains the fields:
vec_string_type
which contains the strings of the headers of the columns of the datamap_type
which contains the vectors which are the columns of the data red of type vec_real_type
.stream | stream to write the output |
commentChars | lines beginning with one of this chars are treated as comments. Default are # and % |
delimiters | characters used as delimiter for headers |
ptr_pars | pointer to a GenericContainer which store poarameter parsed in the comment part of the file |
int32_t GC_namespace::GenericContainer::serialize | ( | int32_t | buffer_dim, |
uint8_t * | buffer ) const |
Fill the buffer with the serialized version of the GenericContainer.
int32_t GC_namespace::GenericContainer::serialize | ( | vector< uint8_t > & | buffer | ) | const |
Fill the buffer with the serialized version of the GenericContainer.
|
inline |
Assign a boolean to the generic container.
[in] | a | Boolean to be stored |
|
inline |
Assign a string to the generic container.
[in] | a | String to be stored |
|
inline |
Assign a complex double to the generic container.
[in] | a | Complex double to be stored |
|
inline |
Assign a complex float to the generic container.
[in] | a | Complex float to be stored |
|
inline |
Assign a double to the generic container.
[in] | a | Double to be stored |
|
inline |
Assign a float to the generic container.
[in] | a | Float to be stored |
|
inline |
Assign an integer to the generic container.
[in] | a | Integer to be stored |
|
inline |
Assign a long integer to the generic container.
[in] | a | Long integer to be stored |
|
inline |
Assign a pointer to the generic container.
[in] | a | Pointer to be stored |
|
inline |
Assign a string to the generic container.
[in] | a | String to be stored |
|
inline |
Assign an integer to the generic container.
[in] | a | Integer to be stored |
|
inline |
Assign an unsigned integer to the generic container.
[in] | a | Unsigned integer to be stored |
Set the data type to bool_type
and assign a boolean value.
This method initializes the GenericContainer
to hold a boolean value, stores the provided value, and returns a reference to the stored boolean.
value | The boolean value to store. |
complex_type & GC_namespace::GenericContainer::set_complex | ( | complex_type const & | value | ) |
Set the data type to complex_type
and assign a complex value.
This method initializes the GenericContainer
to hold a complex number, stores the provided value, and returns a reference to the stored complex value.
value | The complex number to store. |
complex_type & GC_namespace::GenericContainer::set_complex | ( | real_type | r, |
real_type | i ) |
Set the data type to complex_type
and assign a complex value from real and imaginary parts.
This method initializes the GenericContainer
to hold a complex number. It takes two real numbers (representing the real and imaginary components), stores the complex number, and returns a reference to the stored complex value.
r | The real part of the complex number. |
i | The imaginary part of the complex number. |
Set the data type to int_type
and assign an integer value.
This method initializes the GenericContainer
to hold an integer value, stores the provided value, and returns a reference to the stored integer.
value | The integer value to store. |
Set the data type to long_type
and assign a long integer value.
This method initializes the GenericContainer
to hold a long integer value, stores the provided value, and returns a reference to the stored long integer.
value | The long integer value to store. |
map_type & GC_namespace::GenericContainer::set_map | ( | ) |
Initializes a generic map.
This function sets the data type to map_type
, allocates an empty map, and returns a reference to it.
mat_complex_type & GC_namespace::GenericContainer::set_mat_complex | ( | mat_complex_type const & | m | ) |
Set the data to mat_complex_type
by copying from another matrix.
This method initializes the matrix of complex numbers by copying data from the provided matrix m
.
[in] | m | The matrix of complex numbers used for initialization. |
mat_complex_type & GC_namespace::GenericContainer::set_mat_complex | ( | unsigned | nr = 0, |
unsigned | nc = 0 ) |
Set the data to mat_complex_type
, allocate and initialize.
Allocates memory for a matrix of complex_type
numbers. If the specified number of rows nr
and columns nc
are greater than zero, the matrix will be allocated with size nr
x nc
.
[in] | nr | The number of rows in the matrix (default is 0). |
[in] | nc | The number of columns in the matrix (default is 0). |
mat_int_type & GC_namespace::GenericContainer::set_mat_int | ( | mat_int_type const & | m | ) |
Set the data to mat_int_type
by copying from another matrix.
This method initializes the matrix of integers by copying data from the provided matrix m
.
[in] | m | The matrix of integers used for initialization. |
mat_int_type & GC_namespace::GenericContainer::set_mat_int | ( | unsigned | nr = 0, |
unsigned | nc = 0 ) |
Set the data to mat_int_type
, allocate and initialize.
Allocates memory for a matrix of integers. If the specified number of rows nr
and columns nc
are greater than zero, the matrix will be allocated with size nr
x nc
.
[in] | nr | The number of rows in the matrix (default is 0). |
[in] | nc | The number of columns in the matrix (default is 0). |
mat_long_type & GC_namespace::GenericContainer::set_mat_long | ( | mat_long_type const & | m | ) |
Set the data to mat_long_type
by copying from another matrix.
This method initializes the matrix of long integers by copying data from the provided matrix m
.
[in] | m | The matrix of long integers used for initialization. |
mat_long_type & GC_namespace::GenericContainer::set_mat_long | ( | unsigned | nr = 0, |
unsigned | nc = 0 ) |
Set the data to mat_long_type
, allocate and initialize.
Allocates memory for a matrix of long integers. If the specified number of rows nr
and columns nc
are greater than zero, the matrix will be allocated with size nr
x nc
.
[in] | nr | The number of rows in the matrix (default is 0). |
[in] | nc | The number of columns in the matrix (default is 0). |
mat_real_type & GC_namespace::GenericContainer::set_mat_real | ( | mat_real_type const & | m | ) |
Set the data to mat_real_type
by copying from another matrix.
This method initializes the matrix of real_type
numbers by copying data from the provided matrix m
.
[in] | m | The matrix of real_type numbers used for initialization. |
real_type
numbers.mat_real_type & GC_namespace::GenericContainer::set_mat_real | ( | unsigned | nr = 0, |
unsigned | nc = 0 ) |
Set the data to mat_real_type
, allocate and initialize.
Allocates memory for a matrix of real_type
numbers. If the specified number of rows nr
and columns nc
are greater than zero, the matrix will be allocated with size nr
x nc
.
[in] | nr | The number of rows in the matrix (default is 0). |
[in] | nc | The number of columns in the matrix (default is 0). |
real_type
numbers.pointer_type & GC_namespace::GenericContainer::set_pointer | ( | pointer_type | value | ) |
Set the data type to pointer_type
and assign a value.
This method initializes the GenericContainer
to hold a pointer, stores the provided value
, and returns a reference to the internal pointer storage.
value | The pointer value to store in the container. |
Set the data type to real_type
and assign a floating-point value.
This method initializes the GenericContainer
to hold a floating-point value, stores the provided value, and returns a reference to the stored real value.
value | The floating-point value to store. |
string_type & GC_namespace::GenericContainer::set_string | ( | string_type const & | value | ) |
Set the data type to string_type
, allocate memory, and assign a string value.
This method initializes the GenericContainer
to hold a string, allocates the necessary memory, stores the provided string value, and returns a reference to the stored string.
value | The string to store. |
vec_bool_type & GC_namespace::GenericContainer::set_vec_bool | ( | unsigned | sz = 0 | ) |
Set the data to vec_bool_type
, allocate and initialize.
Allocates memory for a vector of boolean values. If the specified size sz
is greater than zero, the vector will be allocated with that size.
[in] | sz | The size of the vector of booleans to allocate (default is 0). |
vec_bool_type & GC_namespace::GenericContainer::set_vec_bool | ( | vec_bool_type const & | v | ) |
Set the data to vec_bool_type
by copying from another vector.
This method initializes the vector of booleans by copying data from the provided vector v
.
[in] | v | The vector of booleans used for initialization. |
vec_complex_type & GC_namespace::GenericContainer::set_vec_complex | ( | unsigned | sz = 0 | ) |
Set the data to vec_complex_type
, allocate and initialize.
Allocates memory for a vector of complex numbers. If the specified size sz
is greater than zero, the vector will be allocated with that size.
[in] | sz | The size of the vector of complex numbers to allocate (default is 0). |
vec_complex_type & GC_namespace::GenericContainer::set_vec_complex | ( | vec_complex_type const & | v | ) |
Set the data to vec_complex_type
by copying from another vector.
This method initializes the vector of complex numbers by copying data from the provided vector v
.
[in] | v | The vector of complex numbers used for initialization. |
vec_int_type & GC_namespace::GenericContainer::set_vec_int | ( | unsigned | sz = 0 | ) |
Set the data to vec_int_type
, allocate and initialize.
Allocates memory for a vector of integers. If the specified size sz
is greater than zero, the vector will be allocated with that size.
[in] | sz | The size of the vector of integers to allocate (default is 0). |
vec_int_type & GC_namespace::GenericContainer::set_vec_int | ( | vec_int_type const & | v | ) |
vec_long_type & GC_namespace::GenericContainer::set_vec_long | ( | unsigned | sz = 0 | ) |
Set the data to vec_long_type
, allocate and initialize.
Allocates memory for a vector of long integers. If the specified size sz
is greater than zero, the vector will be allocated with that size.
[in] | sz | The size of the vector of long integers to allocate (default is 0). |
vec_long_type & GC_namespace::GenericContainer::set_vec_long | ( | vec_long_type const & | v | ) |
Set the data to vec_long_type
by copying from another vector.
This method initializes the vector of long integers by copying data from the provided vector v
.
[in] | v | The vector of long integers used for initialization. |
vec_pointer_type & GC_namespace::GenericContainer::set_vec_pointer | ( | unsigned | sz = 0 | ) |
Set the data to vec_pointer_type
, allocate and initialize.
This method allocates memory for a vector of pointers. If the specified size sz
is greater than zero, the vector will be allocated with that size.
[in] | sz | The size of the vector of pointers to allocate (default is 0). |
vec_pointer_type & GC_namespace::GenericContainer::set_vec_pointer | ( | vec_pointer_type const & | v | ) |
Set the data to vec_pointer_type
by copying from another vector.
This method initializes the vector of pointers by copying data from the provided vector v
.
[in] | v | The vector of pointers used for initialization. |
vec_real_type & GC_namespace::GenericContainer::set_vec_real | ( | unsigned | sz = 0 | ) |
Set the data to vec_real_type
, allocate and initialize.
Allocates memory for a vector of real_type
numbers. If the specified size sz
is greater than zero, the vector will be allocated with that size.
[in] | sz | The size of the vector of real numbers to allocate (default is 0). |
vec_real_type & GC_namespace::GenericContainer::set_vec_real | ( | vec_real_type const & | v | ) |
Set the data to vec_real_type
by copying from another vector.
This method initializes the vector of real_type
numbers by copying data from the provided vector v
.
[in] | v | The vector of real_type numbers used for initialization. |
real_type
numbers.vec_string_type & GC_namespace::GenericContainer::set_vec_string | ( | unsigned | sz = 0 | ) |
Set the data to vec_string_type
, allocate and initialize.
Allocates memory for a vector of strings. If the specified size sz
is greater than zero, the vector will be allocated with that size.
[in] | sz | The size of the vector of strings to allocate (default is 0). |
vec_string_type & GC_namespace::GenericContainer::set_vec_string | ( | vec_string_type const & | v | ) |
Set the data to vec_string_type
by copying from another vector.
This method initializes the vector of strings by copying data from the provided vector v
.
[in] | v | The vector of strings used for initialization. |
vector_type & GC_namespace::GenericContainer::set_vector | ( | unsigned | sz = 0 | ) |
Initializes a generic vector.
This function sets the data type to vector_type
, allocates an empty vector, and returns a reference to it. If the specified size sz
is greater than 0, the vector is allocated with that size.
[in] | sz | The size of the allocated vector (default is 0). |
void GC_namespace::GenericContainer::to_gc | ( | GenericContainer & | gc | ) | const |
Copy the contents of the object into another object
[out] | gc | output GenericContainer |
void GC_namespace::GenericContainer::to_json | ( | ostream_type & | stream, |
string_type const & | prefix = "" ) const |
Print the contents of the object in JSON syntax
[in] | stream | output stream |
[in] | prefix | strig to be prepended to any field of the GenericContainer |
|
inline |
void GC_namespace::GenericContainer::to_yaml | ( | ostream_type & | stream, |
string_type const & | prefix = "" ) const |
Print the contents of the object in YAML syntax
[in] | stream | output stream |
[in] | prefix | strig to be prepended to any field of the GenericContainer |
|
inline |
GenericContainer const & GC_namespace::GenericContainer::writeFormattedData | ( | ostream_type & | stream, |
char const | delimiter = '\t' ) const |
Write GenericContainer
as regular formatted data to stream.
GenericContainer
must be a map which contains the fields:
vec_string_type
which contains the strings of the headers of the columns of the data"data" this element must be a vector_type
which contais the vectors which are the columns of the data to be saved. Each column can be of type
vec_bool_type
vec_int_type
vec_real_type
all the vector must have the same size.
stream | stream to write the output |
delimiter | desired delimiter (optional). Default is tab. |