CLA3P v0.3.1
Compact Linear Algebra Parallel Portable Package
Loading...
Searching...
No Matches
cla3p::Ownership Class Reference

Memory ownership metadata. More...

Inheritance diagram for cla3p::Ownership:

Public Member Functions

 Ownership ()
 Default constructor.
 Ownership (bool owner)
 Ownership constructor.
 ~Ownership ()
 Destructor.
bool owner () const
 Tests memory ownership.
void unbind ()
 Relinquishes memory ownership.

Detailed Description

Memory ownership metadata.

Tracks whether an object is responsible for deallocating its associated memory. When the ownership flag is true, the object will deallocate its contents upon destruction.

Constructor & Destructor Documentation

◆ Ownership() [1/2]

cla3p::Ownership::Ownership ( )

Default constructor.

Initializes ownership state to default.

◆ Ownership() [2/2]

cla3p::Ownership::Ownership ( bool owner)

Ownership constructor.

Initializes ownership state with the specified flag.

Parameters
[in]ownerIf true, the object takes ownership of its contents.

◆ ~Ownership()

cla3p::Ownership::~Ownership ( )

Destructor.

Destroys the ownership metadata object.

Member Function Documentation

◆ owner()

bool cla3p::Ownership::owner ( ) const

Tests memory ownership.

Returns true if the object is responsible for deallocating its contents. When true, memory is automatically freed upon object destruction.

Returns
true if the object owns its contents, false otherwise.

◆ unbind()

void cla3p::Ownership::unbind ( )

Relinquishes memory ownership.

Makes the object no longer responsible for content deallocation. Use with caution as this may lead to memory leaks if the contents are not deallocated manually. Auto-allocated data should be freed using i_free().