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

#include <matioCpp/WeakMatvar.h>

+ Inheritance diagram for matioCpp::WeakMatvar:

Public Member Functions

 WeakMatvar ()
 Default constructor. More...
 
 WeakMatvar (const WeakMatvar &other)
 Copy constructor. More...
 
 WeakMatvar (WeakMatvar &&other)
 Move constructor. More...
 
 WeakMatvar (const SharedMatvar &other)
 Construct a WeakMatvar from a SharedMatvar. More...
 
 WeakMatvar (matvar_t *inputPtr, const SharedMatvar &owner, DeleteMode mode=DeleteMode::DoNotDelete)
 Import an already existing matvar_t pointer which is owned by owner. More...
 
 WeakMatvar (matvar_t *inputPtr, const MatvarHandler *owner, DeleteMode mode=DeleteMode::DoNotDelete)
 Import an already existing matvar_t pointer which is owned by owner. More...
 
 ~WeakMatvar ()
 Destructor. More...
 
virtual matvar_t * get () const final
 Docs inherited. More...
 
virtual bool isShared () const final
 Docs inherited. More...
 
virtual bool duplicateMatvar (const matvar_t *) final
 Docs inherited. More...
 
virtual bool importMatvar (matvar_t *) final
 Docs inherited. More...
 
virtual MatvarHandlerpointerToDuplicate () const final
 Docs inherited. More...
 
virtual WeakMatvar weakOwnership () const final
 Docs inherited. More...
 
virtual void dropOwnedPointer (matvar_t *previouslyOwnedPointer) final
 Docs inherited. More...
 
WeakMatvaroperator= (const WeakMatvar &other)
 Copy assignement. More...
 
WeakMatvaroperator= (WeakMatvar &&other)
 Move assignement. More...
 
WeakMatvaroperator= (const SharedMatvar &other)
 Assignement operator from a SharedMatvar. More...
 
- Public Member Functions inherited from matioCpp::MatvarHandler
 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...
 
ValueType valueType () const
 Get the value type of the pointer. More...
 
VariableType variableType () const
 Get the variable type of the pointer. More...
 

Friends

class matioCpp::SharedMatvar
 

Additional Inherited Members

- Static Public Member Functions inherited from matioCpp::MatvarHandler
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 inherited from matioCpp::MatvarHandler
std::shared_ptr< PointerInfom_ptr
 Shared pointer to a PointerInfo. More...
 

Detailed Description

Definition at line 15 of file WeakMatvar.h.

Constructor & Destructor Documentation

◆ WeakMatvar() [1/6]

matioCpp::WeakMatvar::WeakMatvar ( )

Default constructor.

This objects points to no matvar_t.

Definition at line 10 of file WeakMatvar.cpp.

◆ WeakMatvar() [2/6]

matioCpp::WeakMatvar::WeakMatvar ( const WeakMatvar other)

Copy constructor.

Parameters
otherThe other object from which to copy.

Definition at line 15 of file WeakMatvar.cpp.

◆ WeakMatvar() [3/6]

matioCpp::WeakMatvar::WeakMatvar ( matioCpp::WeakMatvar &&  other)

Move constructor.

Parameters
otherThe other object from which to get the context.

Definition at line 22 of file WeakMatvar.cpp.

◆ WeakMatvar() [4/6]

matioCpp::WeakMatvar::WeakMatvar ( const SharedMatvar other)

Construct a WeakMatvar from a SharedMatvar.

The WeakMatvar object will have a weak_ptr to the same Ownership object of SharedMatvar. This object will point (in a shared way) to the same matvar_t pointer. The content of matvar_t may be deallocated if all the SharedMatvar objects are deallocated.

Parameters
otherThe input SharedMatvar object.

Definition at line 29 of file WeakMatvar.cpp.

References matioCpp::MatvarHandler::m_ptr, and matioCpp::SharedMatvar::weakOwnership().

◆ WeakMatvar() [5/6]

matioCpp::WeakMatvar::WeakMatvar ( matvar_t *  inputPtr,
const SharedMatvar owner,
DeleteMode  mode = DeleteMode::DoNotDelete 
)

Import an already existing matvar_t pointer which is owned by owner.

owner needs to make sure that inputPtr is deallocated.

Parameters
inputPtrThe matvar_t pointer to import
ownerThe owner of inputPtr (the one that takes care of deallocating it)
modeSpecifies if owner has to deallocate the inputPtr or not

Definition at line 36 of file WeakMatvar.cpp.

◆ WeakMatvar() [6/6]

matioCpp::WeakMatvar::WeakMatvar ( matvar_t *  inputPtr,
const MatvarHandler owner,
DeleteMode  mode = DeleteMode::DoNotDelete 
)

Import an already existing matvar_t pointer which is owned by owner.

owner needs to make sure that inputPtr is deallocated.

Parameters
inputPtrThe matvar_t pointer to import
ownerThe owner of inputPtr (the one that takes care of deallocating it)
modeSpecifies if owner has to deallocate the inputPtr or not
Note
An assertion is thrown if owner is not shared

Definition at line 48 of file WeakMatvar.cpp.

References matioCpp::MatvarHandler::weakOwnership().

◆ ~WeakMatvar()

matioCpp::WeakMatvar::~WeakMatvar ( )

Destructor.

Definition at line 60 of file WeakMatvar.cpp.

Member Function Documentation

◆ dropOwnedPointer()

void matioCpp::WeakMatvar::dropOwnedPointer ( matvar_t *  previouslyOwnedPointer)
finalvirtual

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 109 of file WeakMatvar.cpp.

◆ duplicateMatvar()

bool matioCpp::WeakMatvar::duplicateMatvar ( const matvar_t *  )
finalvirtual

Docs inherited.

This always returns false.

Implements matioCpp::MatvarHandler.

Definition at line 85 of file WeakMatvar.cpp.

References std::endl().

◆ get()

matvar_t * matioCpp::WeakMatvar::get ( ) const
finalvirtual

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 65 of file WeakMatvar.cpp.

◆ importMatvar()

bool matioCpp::WeakMatvar::importMatvar ( matvar_t *  )
finalvirtual

Docs inherited.

This always returns false.

Implements matioCpp::MatvarHandler.

Definition at line 92 of file WeakMatvar.cpp.

References std::endl().

◆ isShared()

bool matioCpp::WeakMatvar::isShared ( ) const
finalvirtual

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 80 of file WeakMatvar.cpp.

◆ operator=() [1/3]

matioCpp::WeakMatvar & matioCpp::WeakMatvar::operator= ( const SharedMatvar other)

Assignement operator from a SharedMatvar.

Parameters
otherThe SharedMatvar from which to share the ownership and import the matvar_t pointer.
Returns
A reference to the current object.

Definition at line 132 of file WeakMatvar.cpp.

References matioCpp::SharedMatvar::weakOwnership().

◆ operator=() [2/3]

matioCpp::WeakMatvar & matioCpp::WeakMatvar::operator= ( const WeakMatvar other)

Copy assignement.

Parameters
otherThe other object to copy.
Returns
A reference to the current object.

Definition at line 118 of file WeakMatvar.cpp.

References matioCpp::MatvarHandler::m_ptr.

◆ operator=() [3/3]

matioCpp::WeakMatvar & matioCpp::WeakMatvar::operator= ( matioCpp::WeakMatvar &&  other)

Move assignement.

Parameters
otherThe other object to get the context.
Returns
A reference to the current object.

Definition at line 125 of file WeakMatvar.cpp.

◆ pointerToDuplicate()

matioCpp::MatvarHandler * matioCpp::WeakMatvar::pointerToDuplicate ( ) const
finalvirtual

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 99 of file WeakMatvar.cpp.

◆ weakOwnership()

matioCpp::WeakMatvar matioCpp::WeakMatvar::weakOwnership ( ) const
finalvirtual

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 104 of file WeakMatvar.cpp.

Friends And Related Function Documentation

◆ matioCpp::SharedMatvar

friend class matioCpp::SharedMatvar
friend

Definition at line 22 of file WeakMatvar.h.


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