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

#include <matioCpp/SharedMatvar.h>

+ Inheritance diagram for matioCpp::SharedMatvar:

Public Member Functions

 SharedMatvar ()
 Default constructor.
 
 SharedMatvar (const SharedMatvar &other)
 Copy constructor.
 
 SharedMatvar (SharedMatvar &&other)
 Move constructor.
 
 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).
 
 ~SharedMatvar ()
 Destructor.
 
virtual matvar_tget () const final
 Docs inherited.
 
virtual bool isShared () const final
 Docs inherited.
 
virtual bool duplicateMatvar (const matvar_t *inputPtr) final
 Docs inherited.
 
virtual bool importMatvar (matvar_t *inputPtr) final
 Docs inherited.
 
virtual MatvarHandlerpointerToDuplicate () const final
 Docs inherited.
 
virtual WeakMatvar weakOwnership () const final
 Docs inherited.
 
virtual void dropOwnedPointer (matvar_t *previouslyOwnedPointer) final
 Docs inherited.
 
SharedMatvaroperator= (const SharedMatvar &other)
 Copy assignement.
 
SharedMatvaroperator= (SharedMatvar &&other)
 Move assignement.
 
std::weak_ptr< MatvarHandler::Ownershipownership () const
 Get a weak_ptr to the ownership.
 
- Public Member Functions inherited from matioCpp::MatvarHandler
 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.
 
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 SharedMatvar GetMatvarShallowDuplicate (const matvar_t *inputPtr)
 Get the shallow duplicate of an input Matvar.
 
- Static Public Member Functions inherited from matioCpp::MatvarHandler
static matvar_tGetMatvarDuplicate (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.
 

Additional Inherited Members

- Protected Attributes inherited from matioCpp::MatvarHandler
std::shared_ptr< PointerInfom_ptr
 Shared pointer to a PointerInfo.
 

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.

◆ 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::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.

◆ 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.


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