matio-cpp  v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
matioCpp::MatvarHandler Class Referenceabstract

#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. 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 MatvarHandlerpointerToDuplicate () 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< PointerInfom_ptr
 Shared pointer to a PointerInfo. More...
 

Detailed Description

Definition at line 13 of file MatvarHandler.h.

Constructor & Destructor Documentation

◆ MatvarHandler() [1/4]

matioCpp::MatvarHandler::MatvarHandler ( )

Default constructor.

Initializes matvar_t* to nullptr

Definition at line 188 of file MatvarHandler.cpp.

◆ MatvarHandler() [2/4]

matioCpp::MatvarHandler::MatvarHandler ( matvar_t *  inputPtr,
matioCpp::DeleteMode  deleteMode = matioCpp::DeleteMode::Delete 
)

Constructor from an already existing matvar_t pointer.

Parameters
inputPtrThe input matvar_t pointer
deleteModeThe mode with which the pointer has to be deleted

Definition at line 193 of file MatvarHandler.cpp.

◆ MatvarHandler() [3/4]

matioCpp::MatvarHandler::MatvarHandler ( const MatvarHandler other)

Copy constructor.

Parameters
otherThe other MatvarHandler to copy

Definition at line 199 of file MatvarHandler.cpp.

◆ MatvarHandler() [4/4]

matioCpp::MatvarHandler::MatvarHandler ( matioCpp::MatvarHandler &&  other)

Move constructor.

Parameters
otherThe other MatvarHandler to move

Definition at line 205 of file MatvarHandler.cpp.

◆ ~MatvarHandler()

virtual matioCpp::MatvarHandler::~MatvarHandler ( )
inlinevirtual

Default destructor.

Definition at line 200 of file MatvarHandler.h.

Member Function Documentation

◆ DeleteMatvar()

void matioCpp::MatvarHandler::DeleteMatvar ( matvar_t *  pointerToDelete,
DeleteMode  mode = DeleteMode::Delete 
)
static

Delete the specified Matvar.

Parameters
pointerToDeleteThe matvar to be deleted
modeThe 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().

◆ dropOwnedPointer()

virtual void matioCpp::MatvarHandler::dropOwnedPointer ( matvar_t *  previouslyOwnedPointer)
pure virtual

Drop a pointer from the list of owned pointers.

Parameters
previouslyOwnedPointerThe pointer that is not owned anymore

Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.

◆ duplicateMatvar()

virtual bool matioCpp::MatvarHandler::duplicateMatvar ( const matvar_t *  inputPtr)
pure virtual

Perform a deep copy of the input pointer.

Parameters
inputPtrThe input pointer
Returns
True if successful, false otherwise (e.g. if isShared is false, or the input pointer is null).

Implemented in matioCpp::SharedMatvar, and matioCpp::WeakMatvar.

Referenced by matioCpp::Variable::Variable().

◆ get()

virtual matvar_t* matioCpp::MatvarHandler::get ( ) const
pure virtual

◆ GetMatvarDuplicate()

◆ importMatvar()

virtual bool matioCpp::MatvarHandler::importMatvar ( matvar_t *  inputPtr)
pure virtual

Import the input pointer.

Parameters
inputPtrThe input pointer
Returns
True if successful, false otherwise (e.g. if isShared is false, or the input pointer is null).

Implemented in matioCpp::SharedMatvar, and matioCpp::WeakMatvar.

Referenced by matioCpp::Variable::initializeVariable().

◆ isShared()

virtual bool matioCpp::MatvarHandler::isShared ( ) const
pure virtual

Check if the onwership is shared with the current object.

Returns
True if the current object is sharing the ownership of the matvar_t.

Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.

◆ pointerToDuplicate()

virtual MatvarHandler* matioCpp::MatvarHandler::pointerToDuplicate ( ) const
pure virtual

Get a pointer to a duplicate of the MatvarHandler.

The pointed object has to be deallocated manually

Returns
A pointer to a copy of the MatvarHandler.

Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.

◆ valueType()

matioCpp::ValueType matioCpp::MatvarHandler::valueType ( ) const

◆ variableType()

matioCpp::VariableType matioCpp::MatvarHandler::variableType ( ) const

◆ weakOwnership()

virtual WeakMatvar matioCpp::MatvarHandler::weakOwnership ( ) const
pure virtual

Get a WeakMatvar version of the current MatvarHandler.

Returns
A WeakMatvar version of the current MatvarHandler.

Implemented in matioCpp::WeakMatvar, and matioCpp::SharedMatvar.

Referenced by matioCpp::WeakMatvar::WeakMatvar().

Field Documentation

◆ m_ptr

std::shared_ptr<PointerInfo> matioCpp::MatvarHandler::m_ptr
protected

The documentation for this class was generated from the following files: