|
matio-cpp v0.3.0
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
|
MultiDimensionalArray is a particular type of Variable specialized for multidimensional arrays of a generic type T. More...
#include <matioCpp/MultiDimensionalArray.h>
Inheritance diagram for matioCpp::MultiDimensionalArray< T >:Public Types | |
| using | type = T |
| using | element_type = typename get_type< T >::type |
| Defines the type specified in the template. | |
| using | value_type = std::remove_cv_t< element_type > |
| Defines the type of an element of the MultiDimensionalArray. | |
| using | allocator_type = std::allocator< element_type > |
| Defines the type of an element of the MultiDimensionalArray without "const". | |
| using | index_type = size_t |
| Defines how to allocate T. | |
| using | reference = element_type & |
| The type used for indices. | |
| using | pointer = typename std::allocator_traits< std::allocator< element_type > >::pointer |
| The reference type. | |
| using | const_pointer = typename std::allocator_traits< std::allocator< element_type > >::const_pointer |
| The pointer type. | |
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. | |
MultiDimensionalArray is a particular type of Variable specialized for multidimensional arrays of a generic type T.
Definition at line 21 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::allocator_type = std::allocator<element_type> |
Defines the type of an element of the MultiDimensionalArray without "const".
Useful to use make_span.
Definition at line 41 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::const_pointer = typename std::allocator_traits<std::allocator<element_type> >::const_pointer |
The pointer type.
Definition at line 49 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::element_type = typename get_type<T>::type |
Defines the type specified in the template.
Definition at line 37 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::index_type = size_t |
Defines how to allocate T.
Definition at line 43 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::pointer = typename std::allocator_traits<std::allocator<element_type> >::pointer |
The reference type.
Definition at line 47 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::reference = element_type& |
The type used for indices.
Definition at line 45 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::type = T |
Definition at line 35 of file MultiDimensionalArray.h.
| using matioCpp::MultiDimensionalArray< T >::value_type = std::remove_cv_t<element_type> |
Defines the type of an element of the MultiDimensionalArray.
Definition at line 39 of file MultiDimensionalArray.h.
| matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray | ( | ) |
The const pointer type.
Default Constructor
Definition at line 46 of file MultiDimensionalArray.tpp.
References std::vector< T >::data(), and matioCpp::MultiDimensionalArray.
Referenced by matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray().
| matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray | ( | const std::string & | name | ) |
Constructor.
| name | The name of the MultiDimensionalArray |
Definition at line 57 of file MultiDimensionalArray.tpp.
References std::vector< T >::data(), and matioCpp::MultiDimensionalArray.
| matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray | ( | const std::string & | name, |
| const std::vector< index_type > & | dimensions | ||
| ) |
Constructor.
| name | The name of the MultiDimensionalArray |
| dimensions | The dimensions of the MultiDimensionalArray |
| matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray | ( | const std::string & | name, |
| const std::vector< index_type > & | dimensions, | ||
| const_pointer | inputVector | ||
| ) |
Constructor.
| name | The name of the MultiDimensionalArray |
| dimensions | The dimensions of the MultiDimensionalArray |
| inputVector | The raw pointer to the data stored in column-major order |
| matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray | ( | const MultiDimensionalArray< T > & | other | ) |
Copy constructor.
Definition at line 109 of file MultiDimensionalArray.tpp.
| matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray | ( | MultiDimensionalArray< T > && | other | ) |
Move constructor.
Definition at line 115 of file MultiDimensionalArray.tpp.
References std::forward().
| matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray | ( | 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 121 of file MultiDimensionalArray.tpp.
References std::vector< T >::data(), matioCpp::Variable::initializeVariable(), matioCpp::MultiDimensionalArray, matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray(), matioCpp::Variable::valueType(), and matioCpp::Variable::variableType().
| matioCpp::MultiDimensionalArray< T >::~MultiDimensionalArray | ( | ) |
Destructor.
Definition at line 137 of file MultiDimensionalArray.tpp.
| void matioCpp::MultiDimensionalArray< T >::clear | ( | ) |
Clear the multidimensional array.
Definition at line 269 of file MultiDimensionalArray.tpp.
References std::move().
| matioCpp::MultiDimensionalArray< T >::pointer matioCpp::MultiDimensionalArray< T >::data | ( | ) |
Direct access to the underlying array.
Definition at line 275 of file MultiDimensionalArray.tpp.
Referenced by matioCpp::CellArray::CellArray(), matioCpp::Span< ElementType, Extent >::data(), matioCpp::MatvarHandler::PointerInfo::DeletePointer(), matioCpp::StructArray::fromVectorOfStructs(), matioCpp::CellArray::fromVectorOfVariables(), matioCpp::Struct::fromVectorOfVariables(), matioCpp::MatvarHandler::GetMatvarDuplicate(), matioCpp::Variable::initializeComplexVariable(), matioCpp::Variable::initializeComplexVector(), matioCpp::Variable::initializeVariable(), matioCpp::make_span(), matioCpp::make_span(), matioCpp::details::span_iterator< Span, IsConst >::operator*(), matioCpp::details::span_iterator< Span, IsConst >::operator->(), matioCpp::Vector< T >::operator=(), matioCpp::MultiDimensionalArray< T >::resize(), matioCpp::Vector< T >::resize(), matioCpp::Struct::Struct(), and matioCpp::StructArray::StructArray().
| matioCpp::MultiDimensionalArray< T >::const_pointer matioCpp::MultiDimensionalArray< T >::data | ( | ) | const |
Direct access to the underlying array.
Definition at line 281 of file MultiDimensionalArray.tpp.
| bool matioCpp::MultiDimensionalArray< T >::fromVectorizedArray | ( | const std::vector< index_type > & | dimensions, |
| const_pointer | inputVector | ||
| ) |
Set from a vectorized array.
| dimensions | The input dimensions |
| inputVector | The input pointer. |
Definition at line 157 of file MultiDimensionalArray.tpp.
References std::endl(), and matioCpp::MultiDimensionalArray.
| bool matioCpp::MultiDimensionalArray< T >::indicesFromRawIndex | ( | size_t | rawIndex, |
| std::vector< index_type > & | el | ||
| ) | const |
Get the indices given the raw index.
| rawIndex | The input raw index from which to compute the indices |
| el | The output indices |
Definition at line 195 of file MultiDimensionalArray.tpp.
References std::endl(), and matioCpp::MultiDimensionalArray< T >::resize().
| matioCpp::MultiDimensionalArray< T >::index_type matioCpp::MultiDimensionalArray< T >::numberOfElements | ( | ) | const |
Get the total number of elements in the array.
Definition at line 287 of file MultiDimensionalArray.tpp.
| reference matioCpp::MultiDimensionalArray< T >::operator() | ( | const std::vector< index_type > & | el | ) |
Access specified element.
| el | The element to be accessed. |
| value_type matioCpp::MultiDimensionalArray< T >::operator() | ( | const std::vector< index_type > & | el | ) | const |
Access specified element.
| el | The element to be accessed. |
| reference matioCpp::MultiDimensionalArray< T >::operator() | ( | index_type | el | ) |
Access specified element.
| el | The element to be accessed (raw index). |
| value_type matioCpp::MultiDimensionalArray< T >::operator() | ( | index_type | el | ) | const |
Access specified element.
| el | The element to be accessed (raw index). |
| matioCpp::MultiDimensionalArray< T > & matioCpp::MultiDimensionalArray< T >::operator= | ( | const MultiDimensionalArray< T > & | other | ) |
Assignement operator (copy) from another MultiDimensionalArray.
| other | The other MultiDimensionalArray. |
Definition at line 143 of file MultiDimensionalArray.tpp.
| matioCpp::MultiDimensionalArray< T > & matioCpp::MultiDimensionalArray< T >::operator= | ( | matioCpp::MultiDimensionalArray< T > && | other | ) |
Assignement operator (move) from another MultiDimensionalArray.
| other | The other MultiDimensionalArray. |
Definition at line 150 of file MultiDimensionalArray.tpp.
References std::forward().
| reference matioCpp::MultiDimensionalArray< T >::operator[] | ( | const std::vector< index_type > & | el | ) |
Access specified element.
| el | The element to be accessed. |
| value_type matioCpp::MultiDimensionalArray< T >::operator[] | ( | const std::vector< index_type > & | el | ) | const |
Access specified element.
| el | The element to be accessed. |
| reference matioCpp::MultiDimensionalArray< T >::operator[] | ( | index_type | el | ) |
Access specified element.
| el | The element to be accessed (raw index). |
| value_type matioCpp::MultiDimensionalArray< T >::operator[] | ( | index_type | el | ) | const |
Access specified element.
| el | The element to be accessed (raw index). |
| matioCpp::MultiDimensionalArray< T >::index_type matioCpp::MultiDimensionalArray< T >::rawIndexFromIndices | ( | const std::vector< index_type > & | el | ) | const |
Get the index in the vectorized array corresponding to the provided indices.
| el | The desired element |
Since the array is stored in column-major, an element (i,j,k,l,..) of an array of dimensions (n,m,p,k,...) corresponds to a row index equal to i + j*n + k*n*m + l*n*m*p +...
Definition at line 175 of file MultiDimensionalArray.tpp.
Referenced by matioCpp::computeSlicingInfo().
| void matioCpp::MultiDimensionalArray< T >::resize | ( | const std::vector< index_type > & | newDimensions | ) |
Resize the vector.
| newDimensions | The new dimensions. |
Definition at line 246 of file MultiDimensionalArray.tpp.
References matioCpp::MultiDimensionalArray< T >::data(), std::endl(), and matioCpp::MultiDimensionalArray.
Referenced by matioCpp::CellArray::indicesFromRawIndex(), matioCpp::MultiDimensionalArray< T >::indicesFromRawIndex(), matioCpp::StructArray::indicesFromRawIndex(), and matioCpp::File::variableNames().
| bool matioCpp::MultiDimensionalArray< T >::setName | ( | const std::string & | newName | ) |
Change the name of the Variable.
| newName | The new name |
Definition at line 240 of file MultiDimensionalArray.tpp.
| matioCpp::Span< typename matioCpp::MultiDimensionalArray< T >::element_type > matioCpp::MultiDimensionalArray< T >::toSpan | ( | ) |
Get this MultiDimensionalArray as a Span.
Definition at line 228 of file MultiDimensionalArray.tpp.
References matioCpp::make_span().
| const matioCpp::Span< const typename matioCpp::MultiDimensionalArray< T >::element_type > matioCpp::MultiDimensionalArray< T >::toSpan | ( | ) | const |
Get this MultiDimensionalArray as a Span (const version)
Definition at line 234 of file MultiDimensionalArray.tpp.
References matioCpp::make_span().