Allium  0.1.0
allium::PetscObjectPtr< T > Class Template Referencefinal

PETSc wrapper object for memory management. More...

#include <petsc_object_ptr.hpp>

Public Member Functions

 PetscObjectPtr (const PetscObjectPtr &other)
 
 PetscObjectPtr (PetscObjectPtr &&other)
 
 PetscObjectPtr (T new_value, bool adopt)
 
 operator T () const
 
PetscObjectPtr & operator= (const PetscObjectPtr &other)
 
void release ()
 
T abandon ()
 
void set (T new_value, bool adopt)
 
T * writable_ptr ()
 
T get () const
 

Protected Attributes

T value
 

Friends

void swap (PetscObjectPtr< T > &a, PetscObjectPtr< T > &b)
 

Detailed Description

template<typename T>
class allium::PetscObjectPtr< T >

PETSc wrapper object for memory management.

Takes care of increasing and decreasing reference counts.

Member Function Documentation

◆ abandon()

template<typename T >
T allium::PetscObjectPtr< T >::abandon ( )
inline

Gives up the ownership of value without decreasing the reference count. Returns value.

◆ release()

template<typename T >
void allium::PetscObjectPtr< T >::release ( )
inline

Decrease the reference count of the PETSc object by one and set value to nullptr.

◆ writable_ptr()

template<typename T >
T* allium::PetscObjectPtr< T >::writable_ptr ( )
inline

A pointer to set the value of the PetscObjectPtr. This releases the object and returns a pointer that can be used to set a new value. The pointer might not be used or set to null. In case a new values is provided, PetscObjectPtr adopts the referenced object, i.e., it will decrease its reference count when going out of scope.


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