matio-cpp
v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
|
Element allows having a 1x1 variable (like double, int,..) castable to a primitive type. More...
#include <matioCpp/Element.h>
Public Types | |
using | type = T |
using | element_type = typename get_type< T >::type |
Defines the type specified in the template. More... | |
using | value_type = std::remove_cv_t< element_type > |
Defines the type of the Element. More... | |
using | reference = element_type & |
Defines the type of the Element. More... | |
using | pointer = typename std::allocator_traits< std::allocator< element_type > >::pointer |
The reference type. More... | |
using | const_pointer = typename std::allocator_traits< std::allocator< element_type > >::const_pointer |
The pointer type. More... | |
Public Member Functions | |
Element () | |
The const pointer type. More... | |
Element (const std::string &name) | |
Constructor. More... | |
Element (const std::string &name, element_type inputValue) | |
Constructor. More... | |
Element (const Element< T > &other) | |
Copy constructor. More... | |
Element (Element< T > &&other) | |
Move constructor. More... | |
Element (const MatvarHandler &handler) | |
Constructor to share the data ownership of another variable. More... | |
~Element () | |
Destructor. More... | |
Element< T > & | operator= (const Element< T > &other) |
Assignement operator (copy) from another Element. More... | |
Element< T > & | operator= (Element< T > &&other) |
Assignement operator (move) from another Element. More... | |
Element< T > & | operator= (element_type value) |
Assignement operator (copy) from an element of type T. More... | |
matioCpp::Span< element_type > | toSpan () |
Get this Vector as a Span. More... | |
const matioCpp::Span< const element_type > | toSpan () const |
Get this Vector as a Span (const version) More... | |
bool | setName (const std::string &newName) |
Change the name of the Variable. More... | |
reference | operator() () |
Access the Element. More... | |
value_type | operator() () const |
Access the Element. More... | |
operator element_type () const | |
Casting operator to T. More... | |
Public Member Functions inherited from matioCpp::Variable | |
Variable () | |
Default constructor. More... | |
Variable (const matvar_t *inputVar) | |
Constructor from an existing matvar_t pointer. More... | |
Variable (const Variable &other) | |
Copy constructor. More... | |
Variable (Variable &&other) | |
Move constructor. More... | |
Variable (const MatvarHandler &handler) | |
Constructor to share the data ownership of another variable. More... | |
~Variable () | |
Destructor. More... | |
Variable & | operator= (const Variable &other) |
Copy assignement. More... | |
Variable & | operator= (Variable &&other) |
Move assignement. More... | |
bool | fromMatio (const matvar_t *inputVar) |
Set this variable from an existing matio variable. More... | |
bool | fromOther (const Variable &other) |
Set this variable from another variable. More... | |
bool | fromOther (Variable &&other) |
Set this variable from another variable. More... | |
const matvar_t * | toMatio () const |
Convert this Variable to a matio variable. More... | |
matvar_t * | toMatio () |
Convert this Variable to a matio variable. More... | |
std::string | name () const |
Get the name of the Variable. More... | |
matioCpp::VariableType | variableType () const |
Get the VariableType. More... | |
matioCpp::ValueType | valueType () const |
Get the ValueType. More... | |
bool | isComplex () const |
Get if the variable is complex. More... | |
matioCpp::Span< const size_t > | dimensions () const |
Get the dimensions of this object. More... | |
bool | isValid () const |
Check if the variable is valid. More... | |
template<typename T > | |
matioCpp::Element< T > | asElement () |
Cast the variable as a Element. More... | |
template<typename T > | |
const matioCpp::Element< T > | asElement () const |
Cast the variable as a const Element. More... | |
template<typename T > | |
matioCpp::Vector< T > | asVector () |
Cast the variable as a Vector. More... | |
template<typename T > | |
const matioCpp::Vector< T > | asVector () const |
Cast the variable as a const Vector. More... | |
matioCpp::String | asString () |
Cast the variable as a String. More... | |
const matioCpp::String | asString () const |
Cast the variable as a const String. More... | |
matioCpp::String16 | asString16 () |
Cast the variable as a String16. More... | |
const matioCpp::String16 | asString16 () const |
Cast the variable as a const String16. More... | |
matioCpp::String32 | asString32 () |
Cast the variable as a String32. More... | |
const matioCpp::String32 | asString32 () const |
Cast the variable as a const String32. More... | |
template<typename T > | |
matioCpp::MultiDimensionalArray< T > | asMultiDimensionalArray () |
Cast the variable as a MultiDimensionalArray. More... | |
template<typename T > | |
const matioCpp::MultiDimensionalArray< T > | asMultiDimensionalArray () const |
Cast the variable as a const MultiDimensionalArray. More... | |
matioCpp::CellArray | asCellArray () |
Cast the variable as a CellArray. More... | |
const matioCpp::CellArray | asCellArray () const |
Cast the variable as a const CellArray. More... | |
matioCpp::Struct | asStruct () |
Cast the variable as a Struct. More... | |
const matioCpp::Struct | asStruct () const |
Cast the variable as a const Struct. More... | |
matioCpp::StructArray | asStructArray () |
Cast the variable as a StructArray. More... | |
const matioCpp::StructArray | asStructArray () const |
Cast the variable as a const StructArray. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from matioCpp::Variable | |
bool | initializeVariable (const std::string &name, const VariableType &variableType, const ValueType &valueType, matioCpp::Span< const size_t > dimensions, void *data) |
Initialize the variable. More... | |
bool | initializeComplexVariable (const std::string &name, const VariableType &variableType, const ValueType &valueType, matioCpp::Span< const size_t > dimensions, void *realData, void *imaginaryData) |
Initialize a complex variable. More... | |
template<typename T > | |
bool | initializeComplexVector (const std::string &name, const Span< T > realInputVector, const Span< T > imaginaryInputVector) |
Initialize a complex vector. More... | |
bool | changeName (const std::string &newName) |
Change the name of the variable. More... | |
size_t | getArrayNumberOfElements () const |
Get the total number of elements in the array. More... | |
bool | setCellElement (size_t linearIndex, const Variable &newValue) |
Set a cell element at a specified linear position. More... | |
Variable | getCellElement (size_t linearIndex) |
Get a cell element at a specified linear position. More... | |
const Variable | getCellElement (size_t linearIndex) const |
Get a cell element at a specified linear position. More... | |
size_t | getStructNumberOfFields () const |
Get the total number of fields in the variable, considered as a struct. More... | |
char *const * | getStructFields () const |
Get the list of fields in the variable, considered as a struct. More... | |
size_t | getStructFieldIndex (const std::string &field) const |
Get the index of the specified field in the variable, considered as a struct. More... | |
bool | setStructField (size_t index, const Variable &newValue, size_t structPositionInArray=0) |
Set the field of the struct at the specified position. More... | |
bool | addStructField (const std::string &newField) |
Add a new field to the variable, considered as a struct. More... | |
bool | setStructField (const std::string &field, const Variable &newValue, size_t structPositionInArray=0) |
Set the field of the struct given the newValue name. More... | |
Variable | getStructField (size_t index, size_t structPositionInArray=0) |
Get the specified field in the variable, considered as a struct. More... | |
const Variable | getStructField (size_t index, size_t structPositionInArray=0) const |
Get the specified field in the variable, considered as a struct. More... | |
Struct | getStructArrayElement (size_t linearIndex) |
Get an element of the variable, considered as a StructArray. More... | |
const Struct | getStructArrayElement (size_t linearIndex) const |
Get an element of the variable, considered as a StructArray. More... | |
Element allows having a 1x1 variable (like double, int,..) castable to a primitive type.
using matioCpp::Element< T >::const_pointer = typename std::allocator_traits<std::allocator<element_type> >::const_pointer |
using matioCpp::Element< T >::element_type = typename get_type<T>::type |
using matioCpp::Element< T >::pointer = typename std::allocator_traits<std::allocator<element_type> >::pointer |
using matioCpp::Element< T >::reference = element_type& |
using matioCpp::Element< T >::type = T |
using matioCpp::Element< T >::value_type = std::remove_cv_t<element_type> |
matioCpp::Element< T >::Element |
The const pointer type.
Default Constructor
Definition at line 44 of file Element.tpp.
matioCpp::Element< T >::Element | ( | const std::string & | name | ) |
matioCpp::Element< T >::Element | ( | const std::string & | name, |
element_type | inputValue | ||
) |
Constructor.
name | The name of the Element |
inputValue | The value to be given to the element |
matioCpp::Element< T >::Element | ( | const Element< T > & | other | ) |
Copy constructor.
Definition at line 85 of file Element.tpp.
matioCpp::Element< T >::Element | ( | Element< T > && | other | ) |
matioCpp::Element< T >::Element | ( | const MatvarHandler & | handler | ) |
Constructor to share the data ownership of another variable.
handler | The MatvarHandler handler to the matvar_t which has to be shared. |
Definition at line 97 of file Element.tpp.
References matioCpp::Element, matioCpp::MatvarHandler::get(), matioCpp::Variable::initializeVariable(), matioCpp::MatvarHandler::valueType(), and matioCpp::MatvarHandler::variableType().
matioCpp::Element< T >::~Element |
Destructor.
Definition at line 113 of file Element.tpp.
matioCpp::Element< T >::operator element_type | ( | ) | const |
Casting operator to T.
matioCpp::Element< T >::reference matioCpp::Element< T >::operator() |
matioCpp::Element< T >::value_type matioCpp::Element< T >::operator() |
matioCpp::Element< T > & matioCpp::Element< T >::operator= | ( | const Element< T > & | other | ) |
Assignement operator (copy) from another Element.
other | The other Element. |
Definition at line 119 of file Element.tpp.
matioCpp::Element< T > & matioCpp::Element< T >::operator= | ( | Element< T > && | other | ) |
Assignement operator (move) from another Element.
other | The other Element. |
Definition at line 126 of file Element.tpp.
References std::forward().
Element<T>& matioCpp::Element< T >::operator= | ( | element_type | value | ) |
Assignement operator (copy) from an element of type T.
value | The element to copy. |
bool matioCpp::Element< T >::setName | ( | const std::string & | newName | ) |
Change the name of the Variable.
newName | The new name |
Definition at line 152 of file Element.tpp.
matioCpp::Span< typename matioCpp::Element< T >::element_type > matioCpp::Element< T >::toSpan |
Definition at line 140 of file Element.tpp.
References matioCpp::make_span().
const matioCpp::Span< const typename matioCpp::Element< T >::element_type > matioCpp::Element< T >::toSpan |
Get this Vector as a Span (const version)
Definition at line 146 of file Element.tpp.
References matioCpp::make_span().