|
matio-cpp v0.3.0
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>
Inheritance diagram for matioCpp::Vector< T >:Public Member Functions | |
| Vector () | |
| The output type of the conversion to string. | |
| Vector (const std::string &name) | |
| Constructor. | |
| Vector (const std::string &name, index_type dimensions) | |
| Constructor. | |
| 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. | |
| Vector (const std::string &name, const string_input_type &inputString) | |
| Constructor. | |
| Vector (const std::string &name, const std::vector< bool > &inputVector) | |
| Constructor. | |
| Vector (const Vector< T > &other) | |
| Copy constructor. | |
| Vector (Vector< T > &&other) | |
| Move constructor. | |
| Vector (const MatvarHandler &handler) | |
| Constructor to share the data ownership of another variable. | |
| ~Vector () | |
| Destructor. | |
| Vector< T > & | operator= (const Vector< T > &other) |
| Assignement operator (copy) from another Vector. | |
| Vector< T > & | operator= (Vector< T > &&other) |
| Assignement operator (move) from another Vector. | |
| Vector< element_type > & | operator= (const Span< element_type > &other) |
| Assignement operator from another Vector. | |
| Vector< T > & | operator= (const string_input_type &other) |
| Assignement operator from another string. | |
| Vector< T > & | operator= (const std::vector< bool > &other) |
| Assignement operator from a vector of booleans. | |
| matioCpp::Span< element_type > | toSpan () |
| Get this Vector as a Span. | |
| const matioCpp::Span< const element_type > | toSpan () const |
| Get this Vector as a Span (const version) | |
| bool | setName (const std::string &newName) |
| Change the name of the Variable. | |
| index_type | size () const |
| Get the size of the vector. | |
| void | resize (index_type newSize) |
| Resize the vector. | |
| void | clear () |
| Clear the vector. | |
| pointer | data () |
| Direct access to the underlying array. | |
| const_pointer | data () const |
| Direct access to the underlying array. | |
| reference | operator() (index_type el) |
| Access specified element. | |
| value_type | operator() (index_type el) const |
| Access specified element. | |
| string_output_type | operator() () const |
| Get the Vector as a string. | |
| reference | operator[] (index_type el) |
| Access specified element. | |
| value_type | operator[] (index_type el) const |
| Access specified element. | |
| iterator | begin () |
| begin Iterator | |
| iterator | end () |
| end Iterator | |
| const_iterator | begin () const |
| begin Iterator | |
| const_iterator | end () const |
| end Iteratorspan | |
| const_iterator | cbegin () const |
| cbegin Iterator | |
| const_iterator | cend () const |
| cend Iterator | |
| reverse_iterator | rbegin () |
| rbegin Iterator to the first element of the reversed vector | |
| reverse_iterator | rend () |
| rend Iterator to the element following the last element of the reversed vector. | |
| const_reverse_iterator | rbegin () const |
| rbegin Iterator to the first element of the reversed vector | |
| const_reverse_iterator | rend () const |
| rend Iterator to the element following the last element of the reversed vector. | |
| const_reverse_iterator | crbegin () const |
| crbegin Iterator to the first element of the reversed vector | |
| const_reverse_iterator | crend () const |
| crend Iterator to the element following the last element of the reversed vector. | |
| 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. | |
| Variable (const matvar_t *inputVar) | |
| Constructor from an existing matvar_t pointer. | |
| Variable (const Variable &other) | |
| Copy constructor. | |
| Variable (Variable &&other) | |
| Move constructor. | |
| Variable (const MatvarHandler &handler) | |
| Constructor to share the data ownership of another variable. | |
| ~Variable () | |
| Destructor. | |
| Variable & | operator= (const Variable &other) |
| Copy assignement. | |
| Variable & | operator= (Variable &&other) |
| Move assignement. | |
| bool | fromMatio (const matvar_t *inputVar) |
| Set this variable from an existing matio variable. | |
| bool | fromOther (const Variable &other) |
| Set this variable from another variable. | |
| bool | fromOther (Variable &&other) |
| Set this variable from another variable. | |
| const matvar_t * | toMatio () const |
| Convert this Variable to a matio variable. | |
| matvar_t * | toMatio () |
| Convert this Variable to a matio variable. | |
| std::string | name () const |
| Get the name of the Variable. | |
| matioCpp::VariableType | variableType () const |
| Get the VariableType. | |
| matioCpp::ValueType | valueType () const |
| Get the ValueType. | |
| bool | isComplex () const |
| Get if the variable is complex. | |
| matioCpp::Span< const size_t > | dimensions () const |
| Get the dimensions of this object. | |
| bool | isValid () const |
| Check if the variable is valid. | |
| matioCpp::Variable | operator[] (const std::string &el) |
| Access field with specific name. | |
| const matioCpp::Variable | operator[] (const std::string &el) const |
| Access field with specific name. | |
| template<typename T > | |
| matioCpp::Element< T > | asElement () |
| Cast the variable as a Element. | |
| template<typename T > | |
| const matioCpp::Element< T > | asElement () const |
| Cast the variable as a const Element. | |
| template<typename T > | |
| matioCpp::Vector< T > | asVector () |
| Cast the variable as a Vector. | |
| template<typename T > | |
| const matioCpp::Vector< T > | asVector () const |
| Cast the variable as a const Vector. | |
| matioCpp::String | asString () |
| Cast the variable as a String. | |
| const matioCpp::String | asString () const |
| Cast the variable as a const String. | |
| matioCpp::String16 | asString16 () |
| Cast the variable as a String16. | |
| const matioCpp::String16 | asString16 () const |
| Cast the variable as a const String16. | |
| matioCpp::String32 | asString32 () |
| Cast the variable as a String32. | |
| const matioCpp::String32 | asString32 () const |
| Cast the variable as a const String32. | |
| template<typename T > | |
| matioCpp::MultiDimensionalArray< T > | asMultiDimensionalArray () |
| Cast the variable as a MultiDimensionalArray. | |
| template<typename T > | |
| const matioCpp::MultiDimensionalArray< T > | asMultiDimensionalArray () const |
| Cast the variable as a const MultiDimensionalArray. | |
| matioCpp::CellArray | asCellArray () |
| Cast the variable as a CellArray. | |
| const matioCpp::CellArray | asCellArray () const |
| Cast the variable as a const CellArray. | |
| matioCpp::Struct | asStruct () |
| Cast the variable as a Struct. | |
| const matioCpp::Struct | asStruct () const |
| Cast the variable as a const Struct. | |
| matioCpp::StructArray | asStructArray () |
| Cast the variable as a StructArray. | |
| const matioCpp::StructArray | asStructArray () const |
| Cast the variable as a const StructArray. | |
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. | |
| 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. | |
| template<typename T > | |
| bool | initializeComplexVector (const std::string &name, const Span< T > realInputVector, const Span< T > imaginaryInputVector) |
| Initialize a complex vector. | |
| bool | changeName (const std::string &newName) |
| Change the name of the variable. | |
| size_t | getArrayNumberOfElements () const |
| Get the total number of elements in the array. | |
| bool | setCellElement (size_t linearIndex, const Variable &newValue) |
| Set a cell element at a specified linear position. | |
| Variable | getCellElement (size_t linearIndex) |
| Get a cell element at a specified linear position. | |
| const Variable | getCellElement (size_t linearIndex) const |
| Get a cell element at a specified linear position. | |
| size_t | getStructNumberOfFields () const |
| Get the total number of fields in the variable, considered as a struct. | |
| char *const * | getStructFields () const |
| Get the list of fields in the variable, considered as a struct. | |
| bool | getStructFieldIndex (const std::string &field, size_t &index) const |
| Get the index of the specified field in the variable, considered as a struct. | |
| bool | setStructField (size_t index, const Variable &newValue, size_t structPositionInArray=0) |
| Set the field of the struct at the specified position. | |
| bool | addStructField (const std::string &newField) |
| Add a new field to the variable, considered as a struct. | |
| bool | setStructField (const std::string &field, const Variable &newValue, size_t structPositionInArray=0) |
| Set the field of the struct given the newValue name. | |
| Variable | getStructField (size_t index, size_t structPositionInArray=0) |
| Get the specified field in the variable, considered as a struct. | |
| const Variable | getStructField (size_t index, size_t structPositionInArray=0) const |
| Get the specified field in the variable, considered as a struct. | |
| Struct | getStructArrayElement (size_t linearIndex) |
| Get an element of the variable, considered as a StructArray. | |
| const Struct | getStructArrayElement (size_t linearIndex) const |
| Get an element of the variable, considered as a StructArray. | |
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 >::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(), std::vector< T >::push_back(), and matioCpp::Vector.
| 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(), std::string::size(), and matioCpp::Vector.
| 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.
References matioCpp::Vector.
| 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().
| 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::make_span(), matioCpp::Variable::valueType(), and matioCpp::Variable::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(), std::vector< T >::push_back(), and matioCpp::Vector.
| 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 | ( | ) | const |
begin Iterator
Definition at line 344 of file Vector.tpp.
| matioCpp::Vector< T >::const_iterator matioCpp::Vector< T >::cbegin | ( | ) | const |
cbegin Iterator
Definition at line 356 of file Vector.tpp.
| matioCpp::Vector< T >::const_iterator matioCpp::Vector< T >::cend | ( | ) | const |
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 | ( | ) | const |
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 | ( | ) | const |
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 | ( | ) | const |
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 | ( | ) | const |
end Iteratorspan
Definition at line 350 of file Vector.tpp.
| matioCpp::Vector< T >::string_output_type matioCpp::Vector< T >::operator() | ( | ) | const |
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().
| 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::MultiDimensionalArray< T >::data(), and 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 | ( | ) | const |
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 | ( | ) | const |
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 matioCpp::MultiDimensionalArray< 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 | ( | ) | const |
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 | ( | ) | const |
Get this Vector as a Span (const version)
Definition at line 248 of file Vector.tpp.
References matioCpp::make_span().