matio-cpp
v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
|
#include <matioCpp/StructArrayElement.h>
Public Types | |
using | index_type = size_t |
using | input_vector_type = std::conditional_t< isConst, const matioCpp::StructArray, matioCpp::StructArray > |
The type used for indices. More... | |
using | output_variable_type = std::conditional_t< isConst, const matioCpp::Variable, matioCpp::Variable > |
using | output_struct_type = std::conditional_t< isConst, const matioCpp::Struct, matioCpp::Struct > |
Public Member Functions | |
StructArrayElement (index_type index, input_vector_type *array) | |
Element. More... | |
StructArrayElement ()=delete | |
Deleted default constructor. More... | |
StructArrayElement (const StructArrayElement< isConst > &other) | |
Copy operator. More... | |
template<bool B, typename = typename std::enable_if_t<!B && isConst>> | |
StructArrayElement (const StructArrayElement< B > &other) | |
Copy operator. More... | |
StructArrayElement (matioCpp::StructArrayElement< isConst > &&other) | |
Move operator. More... | |
template<bool B, typename = typename std::enable_if_t<!B && isConst>> | |
StructArrayElement (matioCpp::StructArrayElement< B > &&other) | |
Move operator. More... | |
StructArrayElement & | operator= (const StructArrayElement &other)=delete |
Deleted copy assignement since it is not clear whether the index or the content have to be copied. More... | |
StructArrayElement< isConst > & | operator= (StructArrayElement< isConst > &&other) |
Move assignement. More... | |
template<bool B, typename = typename std::enable_if_t<!B && isConst>> | |
StructArrayElement< isConst > & | operator= (StructArrayElement< B > &&other) |
Move assignement (from non-const to const) More... | |
template<bool B = isConst, typename = typename std::enable_if_t<(B == isConst) && !B>> | |
StructArrayElement & | operator= (const matioCpp::Struct &other) const |
Assignement operator from a struct. More... | |
template<bool B = isConst, typename = typename std::enable_if_t<(B == isConst) && !B>> | |
bool | fromVectorOfVariables (const std::vector< Variable > &elements) const |
Set from a vector of Variables. More... | |
index_type | numberOfFields () const |
Get the total number of fields in the struct. More... | |
std::vector< std::string > | fields () const |
Get the list of fields. More... | |
bool | isFieldExisting (const std::string &field) const |
Check if a field is existing It performs a linear search over the output of fields(). More... | |
size_t | getFieldIndex (const std::string &field) const |
Get the index of the specified field in the struct by performing a linear search. More... | |
template<bool B = isConst, typename = typename std::enable_if_t<(B == isConst) && !B>> | |
bool | setField (index_type index, const Variable &newValue) const |
Set the field at the specified position. More... | |
template<bool B = isConst, typename = typename std::enable_if_t<(B == isConst) && !B>> | |
bool | setField (const std::string &field, const Variable &newValue) const |
Set the field given the field name. More... | |
template<bool B = isConst, typename = typename std::enable_if_t<(B == isConst) && !B>> | |
bool | setField (const Variable &newValue) const |
Set the field given the newValue name. More... | |
output_struct_type | asStruct () const |
Get the element as a Struct. More... | |
output_variable_type | operator() (index_type el) const |
Access field at a specific index. More... | |
output_variable_type | operator() (const std::string &el) const |
Access field at a specific index. More... | |
output_variable_type | operator[] (index_type el) const |
Access field at a specific index. More... | |
output_variable_type | operator[] (const std::string &el) const |
Access field at a specific index. More... | |
template<bool B, typename > | |
matioCpp::StructArrayElement< isConst > & | operator= (matioCpp::StructArrayElement< B > &&other) |
template<bool B, typename > | |
matioCpp::StructArrayElement< isConst > & | operator= (const matioCpp::Struct &other) const |
Friends | |
class | StructArrayElement< true > |
The pointer to the array. More... | |
Definition at line 16 of file StructArrayElement.h.
using matioCpp::StructArrayElement< isConst >::index_type = size_t |
Definition at line 21 of file StructArrayElement.h.
using matioCpp::StructArrayElement< isConst >::input_vector_type = std::conditional_t<isConst, const matioCpp::StructArray, matioCpp::StructArray> |
The type used for indices.
Definition at line 23 of file StructArrayElement.h.
using matioCpp::StructArrayElement< isConst >::output_struct_type = std::conditional_t<isConst, const matioCpp::Struct, matioCpp::Struct> |
Definition at line 27 of file StructArrayElement.h.
using matioCpp::StructArrayElement< isConst >::output_variable_type = std::conditional_t<isConst, const matioCpp::Variable, matioCpp::Variable> |
Definition at line 25 of file StructArrayElement.h.
matioCpp::StructArrayElement< isConst >::StructArrayElement | ( | index_type | index, |
input_vector_type * | array | ||
) |
|
delete |
Deleted default constructor.
matioCpp::StructArrayElement< isConst >::StructArrayElement | ( | const StructArrayElement< isConst > & | other | ) |
Copy operator.
other | The Element to be copied |
Definition at line 20 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::StructArrayElement | ( | const StructArrayElement< B > & | other | ) |
Copy operator.
other | The Element to be copied |
Definition at line 29 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::StructArrayElement | ( | matioCpp::StructArrayElement< isConst > && | other | ) |
Move operator.
other | The Element to be moved |
Definition at line 38 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::StructArrayElement | ( | matioCpp::StructArrayElement< B > && | other | ) |
Move operator.
other | The Element to be moved |
Definition at line 47 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::output_struct_type matioCpp::StructArrayElement< isConst >::asStruct |
Get the element as a Struct.
Definition at line 190 of file StructArrayElement.tpp.
std::vector< std::string > matioCpp::StructArrayElement< isConst >::fields |
Get the list of fields.
Definition at line 131 of file StructArrayElement.tpp.
bool matioCpp::StructArrayElement< isConst >::fromVectorOfVariables | ( | const std::vector< Variable > & | elements | ) | const |
Set from a vector of Variables.
elements | The elements to be set. |
Definition at line 91 of file StructArrayElement.tpp.
References std::endl(), std::vector< T >::size(), and std::to_string().
size_t matioCpp::StructArrayElement< isConst >::getFieldIndex | ( | const std::string & | field | ) | const |
Get the index of the specified field in the struct by performing a linear search.
field | The field to search |
Definition at line 143 of file StructArrayElement.tpp.
bool matioCpp::StructArrayElement< isConst >::isFieldExisting | ( | const std::string & | field | ) | const |
Check if a field is existing It performs a linear search over the output of fields().
Definition at line 137 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::index_type matioCpp::StructArrayElement< isConst >::numberOfFields |
Get the total number of fields in the struct.
Definition at line 125 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::output_variable_type matioCpp::StructArrayElement< isConst >::operator() | ( | const std::string & | el | ) | const |
Access field at a specific index.
el | The name of the field to be accessed. |
Definition at line 203 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::output_variable_type matioCpp::StructArrayElement< isConst >::operator() | ( | index_type | el | ) | const |
Access field at a specific index.
el | The index of the field to be accessed. |
Definition at line 196 of file StructArrayElement.tpp.
matioCpp::StructArrayElement<isConst>& matioCpp::StructArrayElement< isConst >::operator= | ( | const matioCpp::Struct & | other | ) | const |
Definition at line 78 of file StructArrayElement.tpp.
References matioCpp::unused().
StructArrayElement& matioCpp::StructArrayElement< isConst >::operator= | ( | const matioCpp::Struct & | other | ) | const |
Assignement operator from a struct.
other | The struct to be copied |
|
delete |
Deleted copy assignement since it is not clear whether the index or the content have to be copied.
matioCpp::StructArrayElement<isConst>& matioCpp::StructArrayElement< isConst >::operator= | ( | matioCpp::StructArrayElement< B > && | other | ) |
Definition at line 66 of file StructArrayElement.tpp.
StructArrayElement<isConst>& matioCpp::StructArrayElement< isConst >::operator= | ( | StructArrayElement< B > && | other | ) |
matioCpp::StructArrayElement< isConst > & matioCpp::StructArrayElement< isConst >::operator= | ( | matioCpp::StructArrayElement< isConst > && | other | ) |
Move assignement.
other | The other Element. |
Definition at line 56 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::output_variable_type matioCpp::StructArrayElement< isConst >::operator[] | ( | const std::string & | el | ) | const |
Access field at a specific index.
el | The name of the field to be accessed. |
Definition at line 218 of file StructArrayElement.tpp.
matioCpp::StructArrayElement< isConst >::output_variable_type matioCpp::StructArrayElement< isConst >::operator[] | ( | index_type | el | ) | const |
Access field at a specific index.
el | The index of the field to be accessed. |
Definition at line 211 of file StructArrayElement.tpp.
bool matioCpp::StructArrayElement< isConst >::setField | ( | const std::string & | field, |
const Variable & | newValue | ||
) | const |
Set the field given the field name.
field | The field to change |
newValue | The Variable that will be copied in the specified field (the name is not considered) |
Definition at line 166 of file StructArrayElement.tpp.
References std::endl().
bool matioCpp::StructArrayElement< isConst >::setField | ( | const Variable & | newValue | ) | const |
Set the field given the newValue name.
newValue | The Variable that will be copied in the specified field |
Definition at line 182 of file StructArrayElement.tpp.
References matioCpp::Variable::name().
bool matioCpp::StructArrayElement< isConst >::setField | ( | index_type | index, |
const Variable & | newValue | ||
) | const |
Set the field at the specified position.
index | The linear index of the specified field |
newValue | The Variable that will be copied in the specified location |
Definition at line 150 of file StructArrayElement.tpp.
References std::endl(), and matioCpp::Variable::isValid().
|
friend |
The pointer to the array.
Definition at line 213 of file StructArrayElement.h.