matio-cpp
v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
|
Vector is a particular type of Variable specialized for 1-D arrays of a generic type T. More...
#include <matioCpp/Vector.h>
Public Member Functions | |
Vector () | |
The output type of the conversion to string. More... | |
Vector (const std::string &name) | |
Constructor. More... | |
Vector (const std::string &name, index_type dimensions) | |
Constructor. More... | |
template<typename in = element_type, typename = typename std::enable_if<!std::is_same<element_type, const char>::value && !std::is_same<element_type, const char16_t>::value && !std::is_same<element_type, const char32_t>::value && !std::is_same<value_type, bool>::value>::type> | |
Vector (const std::string &name, Span< const element_type > inputVector) | |
Constructor. More... | |
Vector (const std::string &name, const string_input_type &inputString) | |
Constructor. More... | |
Vector (const std::string &name, const std::vector< bool > &inputVector) | |
Constructor. More... | |
Vector (const Vector< T > &other) | |
Copy constructor. More... | |
Vector (Vector< T > &&other) | |
Move constructor. More... | |
Vector (const MatvarHandler &handler) | |
Constructor to share the data ownership of another variable. More... | |
~Vector () | |
Destructor. More... | |
Vector< T > & | operator= (const Vector< T > &other) |
Assignement operator (copy) from another Vector. More... | |
Vector< T > & | operator= (Vector< T > &&other) |
Assignement operator (move) from another Vector. More... | |
Vector< element_type > & | operator= (const Span< element_type > &other) |
Assignement operator from another Vector. More... | |
Vector< T > & | operator= (const string_input_type &other) |
Assignement operator from another string. More... | |
Vector< T > & | operator= (const std::vector< bool > &other) |
Assignement operator from a vector of booleans. 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... | |
index_type | size () const |
Get the size of the vector. More... | |
void | resize (index_type newSize) |
Resize the vector. More... | |
void | clear () |
Clear the vector. More... | |
pointer | data () |
Direct access to the underlying array. More... | |
const_pointer | data () const |
Direct access to the underlying array. More... | |
reference | operator() (index_type el) |
Access specified element. More... | |
value_type | operator() (index_type el) const |
Access specified element. More... | |
string_output_type | operator() () const |
Get the Vector as a string. More... | |
reference | operator[] (index_type el) |
Access specified element. More... | |
value_type | operator[] (index_type el) const |
Access specified element. More... | |
iterator | begin () |
begin Iterator More... | |
iterator | end () |
end Iterator More... | |
const_iterator | begin () const |
begin Iterator More... | |
const_iterator | end () const |
end Iteratorspan More... | |
const_iterator | cbegin () const |
cbegin Iterator More... | |
const_iterator | cend () const |
cend Iterator More... | |
reverse_iterator | rbegin () |
rbegin Iterator to the first element of the reversed vector More... | |
reverse_iterator | rend () |
rend Iterator to the element following the last element of the reversed vector. More... | |
const_reverse_iterator | rbegin () const |
rbegin Iterator to the first element of the reversed vector More... | |
const_reverse_iterator | rend () const |
rend Iterator to the element following the last element of the reversed vector. More... | |
const_reverse_iterator | crbegin () const |
crbegin Iterator to the first element of the reversed vector More... | |
const_reverse_iterator | crend () const |
crend Iterator to the element following the last element of the reversed vector. More... | |
template<typename T > | |
Vector (const std::string &name, matioCpp::Vector< T >::index_type dimensions) | |
template<typename , typename > | |
Vector (const std::string &name, Span< const typename matioCpp::Vector< T >::element_type > inputVector) | |
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... | |
Vector is a particular type of Variable specialized for 1-D arrays of a generic type T.
using matioCpp::Vector< T >::allocator_type = std::allocator<element_type> |
using matioCpp::Vector< T >::const_iterator = vector_iterator<Vector<element_type>, true> |
using matioCpp::Vector< T >::const_pointer = typename std::allocator_traits<std::allocator<element_type> >::const_pointer |
using matioCpp::Vector< T >::const_reverse_iterator = std::reverse_iterator<const_iterator> |
using matioCpp::Vector< T >::element_type = typename get_type<T>::type |
using matioCpp::Vector< T >::index_type = size_t |
using matioCpp::Vector< T >::iterator = vector_iterator<Vector<element_type>, false> |
using matioCpp::Vector< T >::pointer = typename std::allocator_traits<std::allocator<element_type> >::pointer |
using matioCpp::Vector< T >::reference = element_type& |
using matioCpp::Vector< T >::reverse_iterator = std::reverse_iterator<iterator> |
using matioCpp::Vector< T >::string_input_type = typename std::conditional<matioCpp::is_string16_compatible<T>::value, std::u16string, typename std::conditional<matioCpp::is_string32_compatible<T>::value, std::u32string, std::string>::type>::type |
using matioCpp::Vector< T >::string_output_type = typename std::conditional<matioCpp::is_string_compatible<T>::value, std::string, typename std::conditional<matioCpp::is_string16_compatible<T>::value, std::u16string, typename std::conditional<matioCpp::is_string32_compatible<T>::value, std::u32string, void>::type>::type>::type |
using matioCpp::Vector< T >::type = T |
using matioCpp::Vector< T >::value_type = std::remove_cv_t<element_type> |
matioCpp::Vector< T >::Vector |
The output type of the conversion to string.
Default Constructor
Definition at line 52 of file Vector.tpp.
References std::vector< T >::data(), matioCpp::make_span(), and std::vector< T >::push_back().
matioCpp::Vector< T >::Vector | ( | const std::string & | name | ) |
Constructor.
name | The name of the Vector |
Definition at line 70 of file Vector.tpp.
References std::vector< T >::data(), matioCpp::make_span(), std::vector< T >::push_back(), and std::string::size().
matioCpp::Vector< T >::Vector | ( | const std::string & | name, |
index_type | dimensions | ||
) |
matioCpp::Vector< T >::Vector | ( | const std::string & | name, |
Span< const element_type > | inputVector | ||
) |
Constructor.
name | The name of the Vector |
inputVector | The input data. |
matioCpp::Vector< T >::Vector | ( | const std::string & | name, |
const string_input_type & | inputString | ||
) |
Constructor.
name | The name of the Vector |
inputString | The input string. |
Definition at line 117 of file Vector.tpp.
matioCpp::Vector< T >::Vector | ( | const std::string & | name, |
const std::vector< bool > & | inputVector | ||
) |
Constructor.
name | The name of the Vector |
inputVector | The input vector of boolean. |
Definition at line 128 of file Vector.tpp.
References matioCpp::make_span(), and std::vector< T >::size().
matioCpp::Vector< T >::Vector | ( | const Vector< T > & | other | ) |
Copy constructor.
Definition at line 137 of file Vector.tpp.
matioCpp::Vector< T >::Vector | ( | Vector< T > && | other | ) |
matioCpp::Vector< T >::Vector | ( | 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 149 of file Vector.tpp.
References matioCpp::MatvarHandler::get(), matioCpp::make_span(), matioCpp::MatvarHandler::valueType(), and matioCpp::MatvarHandler::variableType().
matioCpp::Vector< T >::~Vector |
Destructor.
Definition at line 161 of file Vector.tpp.
matioCpp::Vector< T >::Vector | ( | const std::string & | name, |
matioCpp::Vector< T >::index_type | dimensions | ||
) |
Definition at line 92 of file Vector.tpp.
References std::vector< T >::data(), matioCpp::make_span(), and std::vector< T >::push_back().
matioCpp::Vector< T >::Vector | ( | const std::string & | name, |
Span< const typename matioCpp::Vector< T >::element_type > | inputVector | ||
) |
Definition at line 111 of file Vector.tpp.
matioCpp::Vector< T >::iterator matioCpp::Vector< T >::begin |
begin Iterator
Definition at line 332 of file Vector.tpp.
matioCpp::Vector< T >::const_iterator matioCpp::Vector< T >::begin |
begin Iterator
Definition at line 344 of file Vector.tpp.
matioCpp::Vector< T >::const_iterator matioCpp::Vector< T >::cbegin |
cbegin Iterator
Definition at line 356 of file Vector.tpp.
matioCpp::Vector< T >::const_iterator matioCpp::Vector< T >::cend |
cend Iterator
Definition at line 362 of file Vector.tpp.
void matioCpp::Vector< T >::clear |
matioCpp::Vector< T >::const_reverse_iterator matioCpp::Vector< T >::crbegin |
crbegin Iterator to the first element of the reversed vector
Definition at line 392 of file Vector.tpp.
matioCpp::Vector< T >::const_reverse_iterator matioCpp::Vector< T >::crend |
crend Iterator to the element following the last element of the reversed vector.
Definition at line 398 of file Vector.tpp.
matioCpp::Vector< T >::pointer matioCpp::Vector< T >::data |
Direct access to the underlying array.
Definition at line 286 of file Vector.tpp.
matioCpp::Vector< T >::const_pointer matioCpp::Vector< T >::data |
Direct access to the underlying array.
Definition at line 292 of file Vector.tpp.
matioCpp::Vector< T >::iterator matioCpp::Vector< T >::end |
end Iterator
Definition at line 338 of file Vector.tpp.
matioCpp::Vector< T >::const_iterator matioCpp::Vector< T >::end |
end Iteratorspan
Definition at line 350 of file Vector.tpp.
matioCpp::Vector< T >::string_output_type matioCpp::Vector< T >::operator() |
Get the Vector as a string.
Definition at line 310 of file Vector.tpp.
reference matioCpp::Vector< T >::operator() | ( | index_type | el | ) |
Access specified element.
el | The element to be accessed. |
value_type matioCpp::Vector< T >::operator() | ( | index_type | el | ) | const |
Access specified element.
el | The element to be accessed. |
Vector<element_type>& matioCpp::Vector< T >::operator= | ( | const Span< element_type > & | other | ) |
matioCpp::Vector< T > & matioCpp::Vector< T >::operator= | ( | const std::vector< bool > & | other | ) |
Assignement operator from a vector of booleans.
other | The input vector. |
Definition at line 218 of file Vector.tpp.
References matioCpp::make_span(), and std::vector< T >::size().
matioCpp::Vector< T > & matioCpp::Vector< T >::operator= | ( | const string_input_type & | other | ) |
Assignement operator from another string.
other | The input string. |
Definition at line 197 of file Vector.tpp.
References matioCpp::Vector.
matioCpp::Vector< T > & matioCpp::Vector< T >::operator= | ( | const Vector< T > & | other | ) |
Assignement operator (copy) from another Vector.
other | The other Vector. |
Definition at line 167 of file Vector.tpp.
matioCpp::Vector< T > & matioCpp::Vector< T >::operator= | ( | matioCpp::Vector< T > && | other | ) |
Assignement operator (move) from another Vector.
other | The other Vector. |
Definition at line 174 of file Vector.tpp.
References std::forward().
reference matioCpp::Vector< T >::operator[] | ( | index_type | el | ) |
Access specified element.
el | The element to be accessed. |
value_type matioCpp::Vector< T >::operator[] | ( | index_type | el | ) | const |
Access specified element.
el | The element to be accessed. |
matioCpp::Vector< T >::reverse_iterator matioCpp::Vector< T >::rbegin |
rbegin Iterator to the first element of the reversed vector
Definition at line 368 of file Vector.tpp.
matioCpp::Vector< T >::const_reverse_iterator matioCpp::Vector< T >::rbegin |
rbegin Iterator to the first element of the reversed vector
Definition at line 380 of file Vector.tpp.
matioCpp::Vector< T >::reverse_iterator matioCpp::Vector< T >::rend |
rend Iterator to the element following the last element of the reversed vector.
Definition at line 374 of file Vector.tpp.
matioCpp::Vector< T >::const_reverse_iterator matioCpp::Vector< T >::rend |
rend Iterator to the element following the last element of the reversed vector.
Definition at line 386 of file Vector.tpp.
void matioCpp::Vector< T >::resize | ( | index_type | newSize | ) |
Resize the vector.
newSize | The new size. |
Definition at line 269 of file Vector.tpp.
References std::vector< T >::data(), and std::min().
bool matioCpp::Vector< T >::setName | ( | const std::string & | newName | ) |
Change the name of the Variable.
newName | The new name |
Definition at line 254 of file Vector.tpp.
matioCpp::Vector< T >::index_type matioCpp::Vector< T >::size |
Get the size of the vector.
Definition at line 260 of file Vector.tpp.
References std::max(), and std::min().
matioCpp::Span< typename matioCpp::Vector< T >::element_type > matioCpp::Vector< T >::toSpan |
Definition at line 242 of file Vector.tpp.
References matioCpp::make_span().
const matioCpp::Span< const typename matioCpp::Vector< T >::element_type > matioCpp::Vector< T >::toSpan |
Get this Vector as a Span (const version)
Definition at line 248 of file Vector.tpp.
References matioCpp::make_span().