8 #ifndef MATIOCPP_ELEMENT_TPP
9 #define MATIOCPP_ELEMENT_TPP
17 std::cerr <<
"[matioCpp::Element::checkCompatibility] The variable type is not compatible with an Element." <<
std::endl;
21 if (inputPtr->isComplex)
23 std::cerr <<
"[matioCpp::Element::checkCompatibility] Cannot use a complex variable into a non-complex one." <<
std::endl;
27 if (!matioCpp::is_convertible_to_primitive_type<T>(valueType))
34 std::cerr <<
"[matioCpp::Element::checkCompatibility] The value type is not convertible to " <<
35 get_type<T>::toString() <<
"." <<
std::endl <<
36 " Input class type: " << classType <<
std::endl <<
37 " Input data type: " << dataType <<
std::endl;
53 size_t emptyDimensions[] = {1, 1};
54 initializeVariable(
"unnamed_element",
55 VariableType::Element,
65 size_t emptyDimensions[] = {1, 1};
66 initializeVariable(name,
67 VariableType::Element,
77 size_t emptyDimensions[] = {1, 1};
78 initializeVariable(name,
79 VariableType::Element,
104 size_t emptyDimensions[] = {1, 1};
135 operator()() = value;
154 return changeName(newName);
Element allows having a 1x1 variable (like double, int,..) castable to a primitive type.
matioCpp::Span< element_type > toSpan()
Get this Vector as a Span.
typename std::allocator_traits< std::allocator< element_type > >::const_pointer const_pointer
The pointer type.
reference operator()()
Access the Element.
Element()
The const pointer type.
element_type & reference
Defines the type of the Element.
bool setName(const std::string &newName)
Change the name of the Variable.
Element< T > & operator=(const Element< T > &other)
Assignement operator (copy) from another Element.
typename std::allocator_traits< std::allocator< element_type > >::pointer pointer
The reference type.
typename get_type< T >::type element_type
Defines the type specified in the template.
std::remove_cv_t< element_type > value_type
Defines the type of the Element.
ValueType valueType() const
Get the value type of the pointer.
virtual matvar_t * get() const =0
Get the shared matvar_t pointer.
VariableType variableType() const
Get the variable type of the pointer.
The matioCpp::Variable class is the equivalent of matvar_t in matio.
matioCpp::Element< T > asElement()
Cast the variable as a Element.
bool initializeVariable(const std::string &name, const VariableType &variableType, const ValueType &valueType, matioCpp::Span< const size_t > dimensions, void *data)
Initialize the variable.
MATIOCPP_CONSTEXPR Span< ElementType > make_span(ElementType *ptr, typename Span< ElementType >::index_type count)
VariableType
Define the type of variable.
ValueType
The list of types for an element of a certain variable type.
bool get_types_names_from_matvart(const matvar_t *input, std::string &classType, std::string &dataType)
Get the type names from the input pointer.
Utility metafunction to get the ValueType from a given primitive type.