matio-cpp
v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
|
#include <matioCpp/MatvarHandler.h>
Data Structures | |
struct | Dependency |
class | Ownership |
The Ownership class is used to define the ownership of a matvar. More... | |
class | PointerInfo |
Public Member Functions | |
MatvarHandler () | |
Default constructor. More... | |
MatvarHandler (matvar_t *inputPtr, matioCpp::DeleteMode deleteMode=matioCpp::DeleteMode::Delete) | |
Constructor from an already existing matvar_t pointer. More... | |
MatvarHandler (const MatvarHandler &other) | |
Copy constructor. More... | |
MatvarHandler (MatvarHandler &&other) | |
Move constructor. More... | |
virtual | ~MatvarHandler () |
Default destructor. More... | |
virtual matvar_t * | get () const =0 |
Get the shared matvar_t pointer. More... | |
virtual bool | isShared () const =0 |
Check if the onwership is shared with the current object. More... | |
virtual bool | duplicateMatvar (const matvar_t *inputPtr)=0 |
Perform a deep copy of the input pointer. More... | |
virtual bool | importMatvar (matvar_t *inputPtr)=0 |
Import the input pointer. More... | |
virtual MatvarHandler * | pointerToDuplicate () const =0 |
Get a pointer to a duplicate of the MatvarHandler. More... | |
virtual WeakMatvar | weakOwnership () const =0 |
Get a WeakMatvar version of the current MatvarHandler. More... | |
virtual void | dropOwnedPointer (matvar_t *previouslyOwnedPointer)=0 |
Drop a pointer from the list of owned pointers. More... | |
ValueType | valueType () const |
Get the value type of the pointer. More... | |
VariableType | variableType () const |
Get the variable type of the pointer. More... | |
Static Public Member Functions | |
static matvar_t * | GetMatvarDuplicate (const matvar_t *inputPtr) |
Get a duplicate of the input matvar pointer/. More... | |
static void | DeleteMatvar (matvar_t *pointerToDelete, DeleteMode mode=DeleteMode::Delete) |
Delete the specified Matvar. More... | |
Protected Attributes | |
std::shared_ptr< PointerInfo > | m_ptr |
Shared pointer to a PointerInfo. More... | |
Definition at line 13 of file MatvarHandler.h.
matioCpp::MatvarHandler::MatvarHandler | ( | ) |
Default constructor.
Initializes matvar_t* to nullptr
Definition at line 188 of file MatvarHandler.cpp.
matioCpp::MatvarHandler::MatvarHandler | ( | matvar_t * | inputPtr, |
matioCpp::DeleteMode | deleteMode = matioCpp::DeleteMode::Delete |
||
) |
Constructor from an already existing matvar_t pointer.
inputPtr | The input matvar_t pointer |
deleteMode | The mode with which the pointer has to be deleted |
Definition at line 193 of file MatvarHandler.cpp.
matioCpp::MatvarHandler::MatvarHandler | ( | const MatvarHandler & | other | ) |
Copy constructor.
other | The other MatvarHandler to copy |
Definition at line 199 of file MatvarHandler.cpp.
matioCpp::MatvarHandler::MatvarHandler | ( | matioCpp::MatvarHandler && | other | ) |
Move constructor.
other | The other MatvarHandler to move |
Definition at line 205 of file MatvarHandler.cpp.
|
inlinevirtual |
Default destructor.
Definition at line 200 of file MatvarHandler.h.
|
static |
Delete the specified Matvar.
pointerToDelete | The matvar to be deleted |
mode | The deletion mode |
Definition at line 303 of file MatvarHandler.cpp.
Referenced by matioCpp::Variable::initializeComplexVariable(), matioCpp::Variable::initializeVariable(), matioCpp::Variable::setCellElement(), and matioCpp::Variable::setStructField().
|
pure virtual |
Drop a pointer from the list of owned pointers.
previouslyOwnedPointer | The pointer that is not owned anymore |
Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.
|
pure virtual |
Perform a deep copy of the input pointer.
inputPtr | The input pointer |
Implemented in matioCpp::SharedMatvar, and matioCpp::WeakMatvar.
Referenced by matioCpp::Variable::Variable().
|
pure virtual |
Get the shared matvar_t pointer.
Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.
Referenced by matioCpp::CellArray::CellArray(), matioCpp::Element< T >::Element(), matioCpp::Variable::initializeVariable(), matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray(), matioCpp::Struct::Struct(), matioCpp::StructArray::StructArray(), and matioCpp::Vector< T >::Vector().
|
static |
Get a duplicate of the input matvar pointer/.
inputPtr | The input pointer |
Definition at line 221 of file MatvarHandler.cpp.
References matioCpp::CellArray, std::vector< T >::data(), std::endl(), matioCpp::SharedMatvar::get(), matioCpp::get_types_from_matvart(), matioCpp::SharedMatvar::GetMatvarShallowDuplicate(), matioCpp::Struct, and matioCpp::StructArray.
Referenced by matioCpp::CellArray::CellArray(), matioCpp::SharedMatvar::duplicateMatvar(), matioCpp::StructArray::fromVectorOfStructs(), matioCpp::CellArray::fromVectorOfVariables(), matioCpp::Struct::fromVectorOfVariables(), matioCpp::Variable::setCellElement(), matioCpp::Variable::setStructField(), matioCpp::Struct::Struct(), and matioCpp::StructArray::StructArray().
|
pure virtual |
Import the input pointer.
inputPtr | The input pointer |
Implemented in matioCpp::SharedMatvar, and matioCpp::WeakMatvar.
Referenced by matioCpp::Variable::initializeVariable().
|
pure virtual |
Check if the onwership is shared with the current object.
Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.
|
pure virtual |
Get a pointer to a duplicate of the MatvarHandler.
The pointed object has to be deallocated manually
Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.
matioCpp::ValueType matioCpp::MatvarHandler::valueType | ( | ) | const |
Get the value type of the pointer.
Definition at line 211 of file MatvarHandler.cpp.
Referenced by matioCpp::CellArray::CellArray(), matioCpp::Element< T >::Element(), matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray(), matioCpp::Struct::Struct(), matioCpp::StructArray::StructArray(), and matioCpp::Vector< T >::Vector().
matioCpp::VariableType matioCpp::MatvarHandler::variableType | ( | ) | const |
Get the variable type of the pointer.
Definition at line 216 of file MatvarHandler.cpp.
Referenced by matioCpp::CellArray::CellArray(), matioCpp::Element< T >::Element(), matioCpp::MultiDimensionalArray< T >::MultiDimensionalArray(), matioCpp::Struct::Struct(), matioCpp::StructArray::StructArray(), and matioCpp::Vector< T >::Vector().
|
pure virtual |
Get a WeakMatvar version of the current MatvarHandler.
Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.
Referenced by matioCpp::WeakMatvar::WeakMatvar().
|
protected |
Shared pointer to a PointerInfo.
This allows sharing the same matvar_t across several objects.
Since it is separate from the ownership, it is possible to avoid deallocating this pointer if necessary (e.g. when getting an element from a struct).
Definition at line 167 of file MatvarHandler.h.
Referenced by matioCpp::MatvarHandler::PointerInfo::changePointer(), matioCpp::MatvarHandler::PointerInfo::deletePointer(), matioCpp::SharedMatvar::GetMatvarShallowDuplicate(), matioCpp::MatvarHandler::PointerInfo::operator!=(), matioCpp::SharedMatvar::operator=(), matioCpp::WeakMatvar::operator=(), matioCpp::MatvarHandler::Ownership::own(), matioCpp::MatvarHandler::PointerInfo::pointer(), matioCpp::WeakMatvar::WeakMatvar(), and matioCpp::SharedMatvar::weakOwnership().