1 #ifndef MATIOCPP_MATVARHANDLER_H
2 #define MATIOCPP_MATVARHANDLER_H
119 void dropDependencies(matvar_t* previouslyOwned);
154 void drop(matvar_t* previouslyOwned);
206 virtual matvar_t*
get()
const = 0;
The Ownership class is used to define the ownership of a matvar.
void drop(matvar_t *previouslyOwned)
Drop a previously owned pointer and deleted if necessary.
bool isOwning(matvar_t *test)
Check if an input pointer is owned by this ownership object.
void own(matvar_t *owned, const MatvarHandler *owner, matioCpp::DeleteMode mode)
Add a pointer to the list of owned pointers.
Ownership(std::weak_ptr< PointerInfo > pointerToDeallocate)
Constructor.
void dropAll()
Drops all the previously owned pointers and free those that need to be deallocated,...
matvar_t * pointer()
Get the matvar pointer.
PointerInfo()
The deletion mode.
void deletePointer()
Delete the matvar pointer.
ValueType valueType() const
Get the value type.
VariableType variableType() const
Get the variable type.
bool operator!=(const PointerInfo &other) const
Comparison operator.
void changePointer(matvar_t *ptr, DeleteMode deleteMode)
Change the input pointer.
DeleteMode deleteMode() const
Get the deletion mode.
~PointerInfo()
Destructor.
static void DeletePointer(matvar_t *ptr, DeleteMode deleteMode)
Delete the given pointer given the mode.
virtual bool duplicateMatvar(const matvar_t *inputPtr)=0
Perform a deep copy of the input pointer.
static matvar_t * GetMatvarDuplicate(const matvar_t *inputPtr)
Get a duplicate of the input matvar pointer/.
virtual bool importMatvar(matvar_t *inputPtr)=0
Import the input pointer.
virtual bool isShared() const =0
Check if the onwership is shared with the current object.
virtual MatvarHandler * pointerToDuplicate() const =0
Get a pointer to a duplicate of the MatvarHandler.
virtual void dropOwnedPointer(matvar_t *previouslyOwnedPointer)=0
Drop a pointer from the list of owned pointers.
static void DeleteMatvar(matvar_t *pointerToDelete, DeleteMode mode=DeleteMode::Delete)
Delete the specified Matvar.
ValueType valueType() const
Get the value type of the pointer.
virtual ~MatvarHandler()
Default destructor.
MatvarHandler()
Default constructor.
std::shared_ptr< PointerInfo > m_ptr
Shared pointer to a PointerInfo.
virtual matvar_t * get() const =0
Get the shared matvar_t pointer.
VariableType variableType() const
Get the variable type of the pointer.
virtual WeakMatvar weakOwnership() const =0
Get a WeakMatvar version of the current MatvarHandler.
DeleteMode
The delete mode of matvar_t pointers.
@ Delete
The handler deletes the pointer but not the data.
VariableType
Define the type of variable.
ValueType
The list of types for an element of a certain variable type.
matioCpp::DeleteMode mode
The set of dependencies.
std::unordered_set< matvar_t * > dependencies
matvar_t * parent
Deletion mode for the dependency.