SOIL C++
C++ Unified Device Interface
|
#include <Container.h>
Public Member Functions | |
Container () | |
Empty constructor. More... | |
Container (const std::vector< std::vector< T > > &value) | |
Data copy constructor. More... | |
Container (HTTP::Json json) | |
JSON Constructor. More... | |
std::vector< std::vector< T > > | operator* (void) const |
Deferencing operator. More... | |
bool | is_null (void) const |
Is Null? More... | |
void | set_null (bool _null=true) |
Set null. More... | |
HTTP::Json | wjson (void) |
WJSON representation. More... | |
bool | check_range (Range< T > range) const |
Check range. More... | |
T & | at (int i, int j) |
Data Accessor. More... | |
std::vector< unsigned char > | serialize_value (void) const |
Serialize value. More... | |
std::vector< unsigned char > | serialize_dimensions (void) const |
Serialize dimensions. More... | |
Container class to manage multidmensional data of (nearly) arbitrary type. The data can be scalar, 1D or 2D while the size of dimensions is a priori unknown. This class then provides an abstratcion layer to the other elements of SOIL to allow for consistent implementation. Therefor it makes heavy use of templates, which are specialized for certain cases where x
and/or y
are -1 and for special types.
T | Type of the data. |
x | First dimension of the data. -1 means unused, 0 means arbitray size. Cannot be -1 if y is not -1. |
y | Second dimension of the data. -1 means unused, 0 means arbitray size. Must be -1 for x to be -1. |
Definition at line 21 of file Container.h.
SOIL::Container< T >::Container |
Constructs an empty container. _null will be set to true as no data has been added.
std::runtime_error | An exception is thrown if an invalid combination of template parameters is used. |
Definition at line 196 of file Container.h.
SOIL::Container< T, x, y >::Container | ( | const std::vector< std::vector< T > > & | value | ) |
Constructor that initializes the data with the given value.
[in] | value | Data for initialization, wich must match in type and dimension |
Definition at line 210 of file Container.h.
SOIL::Container< T >::Container | ( | HTTP::Json | json | ) |
Constructor that takes dimension and value from an JSON representation adhering to the SOIL nomenclature.
[in] | json | JSON object to parse |
Definition at line 231 of file Container.h.
T & SOIL::Container< T >::at | ( | int | i, |
int | j | ||
) |
STL-style data accesor retrieving a a single element from multidimensional-data.
[in] | i | Index position along first dimension |
[in] | j | Index position along second dimension |
Definition at line 313 of file Container.h.
bool SOIL::Container< T >::check_range | ( | Range< T > | range | ) | const |
Check whether the data of the container lies within the specified range. In the case of multidimensional data, this check is carried out on all elememts and only returns true if it is applicable to all.
[in] | range | Range for which to check |
Definition at line 293 of file Container.h.
|
inline |
Function that returns true if the current data is set to null and false else.
Definition at line 79 of file Container.h.
T SOIL::Container< T >::operator* | ( | void | ) | const |
Return a copy of the raw data, similar to other uses of * in the standard library.
Definition at line 263 of file Container.h.
std::vector< unsigned char > SOIL::Container< T >::serialize_dimensions | ( | void | ) | const |
Serialize the dimensions to a bytestring for hashing purposes
Definition at line 350 of file Container.h.
std::vector< unsigned char > SOIL::Container< T >::serialize_value | ( | void | ) | const |
Serialize the value to a bytestring for hashing purposes
Definition at line 323 of file Container.h.
|
inline |
Function to set the null status of the data container
[in] | _null | Boolean state flag |
Definition at line 87 of file Container.h.
HTTP::Json SOIL::Container< T >::wjson | ( | void | ) |
Get a JSON object respresentation of the container's current data. The naming wjson()
is chosen as it is consistently used through the library when using wide-string JSON as introduced by cpprestsdk.
Definition at line 269 of file Container.h.