1 #ifndef MATIOCPP_STRUCTARRAY_H
2 #define MATIOCPP_STRUCTARRAY_H
StructArray is a particular type of Variable specialized for array of structs.
bool fromVectorOfStructs(const std::vector< index_type > &dimensions, const std::vector< matioCpp::Struct > &elements)
Set from a vector of Variables.
bool addField(const std::string &newField)
Add a new field to all the structs.
void clear()
Clear the struct array.
index_type numberOfFields() const
Get the total number of fields in the struct.
Element operator()(const std::vector< index_type > &el)
Access specified element.
index_type rawIndexFromIndices(const std::vector< index_type > &el) const
Get the linear index corresponding to the provided indices.
bool setName(const std::string &newName)
Change the name of the Variable.
void resize(const std::vector< index_type > &newDimensions)
Resize the array.
size_t getFieldIndex(const std::string &field) const
Get the index of the specified field in the struct by performing a linear search.
StructArray()
Const version of Element.
bool isFieldExisting(const std::string &field) const
Check if a field is existing It performs a linear search over the output of fields().
Element operator[](const std::vector< index_type > &el)
Access specified element.
std::vector< std::string > fields() const
Get the list of fields.
bool indicesFromRawIndex(size_t rawIndex, std::vector< index_type > &el) const
Get the indices given the raw index.
~StructArray()
Destructor.
bool addFields(const std::vector< std::string > &newFields)
Add the fields to all the structs.
StructArray & operator=(const StructArray &other)
Assignement operator (copy) from another StructArray.
index_type numberOfElements() const
Get the total number of elements in the array.
bool setElement(const std::vector< index_type > &el, const matioCpp::Struct &newValue)
Set the element at the specified position.
Struct is a particular type of Variable specialized for structs.
The matioCpp::Variable class is the equivalent of matvar_t in matio.
std::string name() const
Get the name of the Variable.
matioCpp::Span< const size_t > dimensions() const
Get the dimensions of this object.
matioCpp::VariableType variableType() const
Get the VariableType.
matioCpp::ValueType valueType() const
Get the ValueType.
VariableType
Define the type of variable.
ValueType
The list of types for an element of a certain variable type.