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

#include <matioCpp/SharedMatvar.h>

+ Inheritance diagram for matioCpp::SharedMatvar:

Public Member Functions

 SharedMatvar ()
 Default constructor. More...
 
 SharedMatvar (const SharedMatvar &other)
 Copy constructor. More...
 
 SharedMatvar (SharedMatvar &&other)
 Move constructor. More...
 
 SharedMatvar (matvar_t *inputPtr)
 Import an existing matvar_t and take control of it (it will be deallocated when no other SharedMatvar objects point to it). More...
 
 ~SharedMatvar ()
 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 *inputPtr) final
 Docs inherited. More...
 
virtual bool importMatvar (matvar_t *inputPtr) 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...
 
SharedMatvaroperator= (const SharedMatvar &other)
 Copy assignement. More...
 
SharedMatvaroperator= (SharedMatvar &&other)
 Move assignement. More...
 
std::weak_ptr< MatvarHandler::Ownershipownership () const
 Get a weak_ptr to the ownership. 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...
 

Static Public Member Functions

static SharedMatvar GetMatvarShallowDuplicate (const matvar_t *inputPtr)
 Get the shallow duplicate of an input Matvar. More...
 
- 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...
 

Additional Inherited Members

- 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 SharedMatvar.h.

Constructor & Destructor Documentation

◆ SharedMatvar() [1/4]

matioCpp::SharedMatvar::SharedMatvar ( )

Default constructor.

It initialize the matvar_t to nullptr and it is the only owner of it.

Definition at line 14 of file SharedMatvar.cpp.

◆ SharedMatvar() [2/4]

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

Copy constructor.

Parameters
otherThe other object from which to copy.

Definition at line 21 of file SharedMatvar.cpp.

◆ SharedMatvar() [3/4]

matioCpp::SharedMatvar::SharedMatvar ( matioCpp::SharedMatvar &&  other)

Move constructor.

Parameters
otherThe other object from which to get the context.

Definition at line 28 of file SharedMatvar.cpp.

◆ SharedMatvar() [4/4]

matioCpp::SharedMatvar::SharedMatvar ( matvar_t *  inputPtr)

Import an existing matvar_t and take control of it (it will be deallocated when no other SharedMatvar objects point to it).

Parameters
inputPtrThe input pointer to control.

Definition at line 35 of file SharedMatvar.cpp.

◆ ~SharedMatvar()

matioCpp::SharedMatvar::~SharedMatvar ( )

Destructor.

Definition at line 42 of file SharedMatvar.cpp.

Member Function Documentation

◆ dropOwnedPointer()

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

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 87 of file SharedMatvar.cpp.

◆ duplicateMatvar()

bool matioCpp::SharedMatvar::duplicateMatvar ( const matvar_t *  inputPtr)
finalvirtual

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 58 of file SharedMatvar.cpp.

References matioCpp::MatvarHandler::GetMatvarDuplicate().

◆ get()

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

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 47 of file SharedMatvar.cpp.

Referenced by matioCpp::MatvarHandler::GetMatvarDuplicate(), and matioCpp::File::write().

◆ GetMatvarShallowDuplicate()

matioCpp::SharedMatvar matioCpp::SharedMatvar::GetMatvarShallowDuplicate ( const matvar_t *  inputPtr)
static

Get the shallow duplicate of an input Matvar.

Parameters
inputPtrThe pointer do duplicate in a shallow way
Returns
A SharedMatvar owning the shallow duplicate
Warning
If the inputPtr gets deallocated, trying to use the output SharedMatvar may result in a segfault.

Definition at line 111 of file SharedMatvar.cpp.

References matioCpp::MatvarHandler::m_ptr, and matioCpp::ShallowDelete.

Referenced by matioCpp::MatvarHandler::GetMatvarDuplicate(), and matioCpp::File::write().

◆ importMatvar()

bool matioCpp::SharedMatvar::importMatvar ( matvar_t *  inputPtr)
finalvirtual

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 63 of file SharedMatvar.cpp.

References matioCpp::Delete.

◆ isShared()

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

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 53 of file SharedMatvar.cpp.

◆ operator=() [1/2]

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

Copy assignement.

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

Definition at line 92 of file SharedMatvar.cpp.

References matioCpp::MatvarHandler::m_ptr.

◆ operator=() [2/2]

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

Move assignement.

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

Definition at line 99 of file SharedMatvar.cpp.

◆ ownership()

std::weak_ptr< matioCpp::MatvarHandler::Ownership > matioCpp::SharedMatvar::ownership ( ) const

Get a weak_ptr to the ownership.

Returns
A weak_ptr to the ownership.

Definition at line 106 of file SharedMatvar.cpp.

◆ pointerToDuplicate()

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

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 74 of file SharedMatvar.cpp.

◆ weakOwnership()

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

Docs inherited.

Implements matioCpp::MatvarHandler.

Definition at line 79 of file SharedMatvar.cpp.

References matioCpp::MatvarHandler::m_ptr.

Referenced by matioCpp::WeakMatvar::operator=(), and matioCpp::WeakMatvar::WeakMatvar().


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