|
matio-cpp v0.3.0
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
|
#include <matioCpp/MatvarHandler.h>
Inheritance diagram for matioCpp::MatvarHandler: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. | |
| MatvarHandler (matvar_t *inputPtr, matioCpp::DeleteMode deleteMode=matioCpp::DeleteMode::Delete) | |
| Constructor from an already existing matvar_t pointer. | |
| MatvarHandler (const MatvarHandler &other) | |
| Copy constructor. | |
| MatvarHandler (MatvarHandler &&other) | |
| Move constructor. | |
| virtual | ~MatvarHandler () |
| Default destructor. | |
| virtual matvar_t * | get () const =0 |
| Get the shared matvar_t pointer. | |
| virtual bool | isShared () const =0 |
| Check if the onwership is shared with the current object. | |
| virtual bool | duplicateMatvar (const matvar_t *inputPtr)=0 |
| Perform a deep copy of the input pointer. | |
| virtual bool | importMatvar (matvar_t *inputPtr)=0 |
| Import the input pointer. | |
| virtual MatvarHandler * | pointerToDuplicate () const =0 |
| Get a pointer to a duplicate of the MatvarHandler. | |
| virtual WeakMatvar | weakOwnership () const =0 |
| Get a WeakMatvar version of the current MatvarHandler. | |
| virtual void | dropOwnedPointer (matvar_t *previouslyOwnedPointer)=0 |
| Drop a pointer from the list of owned pointers. | |
| ValueType | valueType () const |
| Get the value type of the pointer. | |
| VariableType | variableType () const |
| Get the variable type of the pointer. | |
Static Public Member Functions | |
| static matvar_t * | GetMatvarDuplicate (const matvar_t *inputPtr) |
| Get a duplicate of the input matvar pointer/. | |
| static void | DeleteMatvar (matvar_t *pointerToDelete, DeleteMode mode=DeleteMode::Delete) |
| Delete the specified Matvar. | |
Protected Attributes | |
| std::shared_ptr< PointerInfo > | m_ptr |
| Shared pointer to a PointerInfo. | |
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::SharedMatvar, and matioCpp::WeakMatvar.
Perform a deep copy of the input pointer.
| inputPtr | The input pointer |
Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.
Referenced by matioCpp::Variable::Variable(), and matioCpp::Variable::Variable().
Get the shared matvar_t pointer.
Implemented in matioCpp::SharedMatvar, and matioCpp::WeakMatvar.
Referenced by matioCpp::Variable::initializeVariable().
Get a duplicate of the input matvar pointer/.
| inputPtr | The input pointer |
Definition at line 221 of file MatvarHandler.cpp.
References matioCpp::CellArray, matioCpp::MultiDimensionalArray< T >::data(), std::endl(), matioCpp::get_types_from_matvart(), matioCpp::SharedMatvar::GetMatvarShallowDuplicate(), matioCpp::Variable::name(), 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().
Import the input pointer.
| inputPtr | The input pointer |
Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.
Referenced by matioCpp::Variable::initializeVariable().
Check if the onwership is shared with the current object.
Implemented in matioCpp::SharedMatvar, and matioCpp::WeakMatvar.
|
pure virtual |
Get a pointer to a duplicate of the MatvarHandler.
The pointed object has to be deallocated manually
Implemented in matioCpp::SharedMatvar, and matioCpp::WeakMatvar.
| matioCpp::ValueType matioCpp::MatvarHandler::valueType | ( | ) | const |
Get the value type of the pointer.
Definition at line 211 of file MatvarHandler.cpp.
| matioCpp::VariableType matioCpp::MatvarHandler::variableType | ( | ) | const |
Get the variable type of the pointer.
Definition at line 216 of file MatvarHandler.cpp.
|
pure virtual |
Get a WeakMatvar version of the current MatvarHandler.
Implemented in matioCpp::SharedMatvar, and matioCpp::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::MatvarHandler::PointerInfo::operator!=(), and matioCpp::MatvarHandler::PointerInfo::pointer().