Util--  1.1
Public Types | Public Member Functions | Friends | List of all members
utilmm::smart::ref_count::manager< Memory > Class Template Reference

Reference counting management. More...

#include <utilmm/smart/bits/ref_count_manager.hh>

Public Types

typedef Memory::base_type base_type
 public type of pointed cells More...
 
typedef Memory::mem_cell mem_cell
 real type of pointed cells More...
 

Public Member Functions

mem_cell manage (base_type *ptr)
 Add new pointer in management. More...
 
mem_cell assign (mem_cell c)
 Assignment of a cell. More...
 
void release (mem_cell c)
 Unassignement of a cell. More...
 
bool null (mem_cell c)
 Check if null. More...
 
base_typeget_ptr (mem_cell c)
 real pointer value. More...
 

Friends

template<class Ty >
class singleton::wrapper
 

Detailed Description

template<class Memory>
class utilmm::smart::ref_count::manager< Memory >

Reference counting management.

Parameters
Memorya model for the memory

This class is a manager for smart::pointer that control the life time policy of memory cells managed by Memory

Note
utilmm::smart::simple_memory is a quite simple and illustrative model for Memory
Author
Frédéric Py fpy@l.nosp@m.aas..nosp@m.fr

Member Typedef Documentation

◆ base_type

template<class Memory >
typedef Memory::base_type utilmm::smart::ref_count::manager< Memory >::base_type

public type of pointed cells

◆ mem_cell

template<class Memory >
typedef Memory::mem_cell utilmm::smart::ref_count::manager< Memory >::mem_cell

real type of pointed cells

This type will store all the information of the reference counter it may be compatible with the std::pair<base_type,size_t>* type.

Member Function Documentation

◆ assign()

template<class Memory >
mem_cell utilmm::smart::ref_count::manager< Memory >::assign ( mem_cell  c)

Assignment of a cell.

This function is called by utilmm::smart::pointer to indicate to the manager that a given cell is assigned to a new pointer.

Parameters
cThe cell assigned
Postcondition
reference counter of c is incremented by 1
Returns
c ater the operation

◆ get_ptr()

template<class Memory >
base_type* utilmm::smart::ref_count::manager< Memory >::get_ptr ( mem_cell  c)
inline

real pointer value.

This function give an access to the real pointer value of a given cell.

Parameters
cThe cell
Returns
the pointer value of the cell

◆ manage()

template<class Memory >
mem_cell utilmm::smart::ref_count::manager< Memory >::manage ( base_type ptr)

Add new pointer in management.

Parameters
ptrThe pointer to manage

This function is called by smart::pointer when this one wants to add a new pointer to the manager management.

Returns
The cell corresponding to this pointer.

◆ null()

template<class Memory >
bool utilmm::smart::ref_count::manager< Memory >::null ( mem_cell  c)
inline

Check if null.

Check if a given cell points to nothing

Parameters
cThe cell to check
Return values
trueif c is null
falseelse

◆ release()

template<class Memory >
void utilmm::smart::ref_count::manager< Memory >::release ( mem_cell  c)

Unassignement of a cell.

This function is called by utilmm::smart::pointer to indicate that a pointer has stopped to used a given cell.

Parameters
cThe cell released
Postcondition
The counter for c is decrmented by 1 and, if this counter has reached the 0 value the cell is detroyed.

Friends And Related Function Documentation

◆ singleton::wrapper

template<class Memory >
template<class Ty >
friend class singleton::wrapper
friend

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

Generated on Mon Sep 24 2018 17:06:40 for Util-- by doxygen 1.8.13
SourceForge.net Project Page