Reference documentation for deal.II version 8.5.1
Public Member Functions | Private Attributes | List of all members
VectorMemory< VectorType >::Pointer Class Reference

#include <deal.II/lac/vector_memory.h>

Public Member Functions

 Pointer (VectorMemory< VectorType > &mem)
 
 ~Pointer ()
 
 operator VectorType * () const
 
VectorType & operator* () const
 
VectorType * operator-> () const
 

Private Attributes

SmartPointer< VectorMemory< VectorType >, Pointerpool
 
VectorType * v
 

Detailed Description

template<typename VectorType = ::Vector<double>>
class VectorMemory< VectorType >::Pointer

A class that looks like a pointer for all practical purposes and that upon construction time allocates a vector from a VectorMemory object (or an object of a derived class) that is passed to the constructor. The destructor then automatically returns the vector's ownership to the same VectorMemory object.

Pointers of this type are therefore safe in the sense that they automatically call VectorMemory::free() when they are destroyed, whether that happens at the end of a code block or because local variables are destroyed during exception unwinding. These kinds of object thus relieve the user from using vector management functions explicitly.

Author
Guido Kanschat, 2009

Definition at line 123 of file vector_memory.h.

Constructor & Destructor Documentation

◆ Pointer()

template<typename VectorType = ::Vector<double>>
VectorMemory< VectorType >::Pointer::Pointer ( VectorMemory< VectorType > &  mem)

Constructor, automatically allocating a vector from mem.

◆ ~Pointer()

template<typename VectorType = ::Vector<double>>
VectorMemory< VectorType >::Pointer::~Pointer ( )

Destructor, automatically releasing the vector from the memory pool.

Member Function Documentation

◆ operator VectorType *()

template<typename VectorType = ::Vector<double>>
VectorMemory< VectorType >::Pointer::operator VectorType * ( ) const

Conversion to regular pointer.

◆ operator*()

template<typename VectorType = ::Vector<double>>
VectorType& VectorMemory< VectorType >::Pointer::operator* ( ) const

Dereferencing operator.

◆ operator->()

template<typename VectorType = ::Vector<double>>
VectorType* VectorMemory< VectorType >::Pointer::operator-> ( ) const

Dereferencing operator.

Member Data Documentation

◆ pool

template<typename VectorType = ::Vector<double>>
SmartPointer<VectorMemory<VectorType>,Pointer> VectorMemory< VectorType >::Pointer::pool
private

The memory pool used.

Definition at line 154 of file vector_memory.h.

◆ v

template<typename VectorType = ::Vector<double>>
VectorType* VectorMemory< VectorType >::Pointer::v
private

The pointer to the vector.

Definition at line 159 of file vector_memory.h.


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