Public Types | Public Member Functions | Private Types | Private Attributes
utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal > Class Template Reference

Unique instance memory manager. More...

#include <uniq_memory.hh>

List of all members.

Public Types

typedef Ty const base_type
 Real pointed type.
typedef mem_type::iterator mem_cell
 type of managed mem cells

Public Member Functions

mem_cell create (base_type *ptr)
 Attachment of a new pointer.
void destroy (mem_cell c)
 Destroy a memory cell.
mem_cell null_cell ()
 null cell creation

Private Types

typedef hash_map< base_type
*, size_t, hash_ptr< Ty, Hash >
, eq_ptr< Ty, Equal > > 
mem_type

Private Attributes

mem_type the_mem

Detailed Description

template<typename Ty, class Hash, class Equal>
class utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >

Unique instance memory manager.

Parameters:
TyThe type of managed cells
HashA hash functor for Ty
EqualAn equality functor for Ty

This class is a memory manager for the utilmm::smart::ref_count::manager class. It implements a memory where there's one and only one element with a given value.

In this memory we have the guarantee that there's no mem_cell pair with pointed values that return true when passed as argument to Equal

Author:
Frédéric Py <fpy@laas.fr>

Definition at line 97 of file uniq_memory.hh.


Member Typedef Documentation

template<typename Ty , class Hash , class Equal >
typedef Ty const utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >::base_type

Real pointed type.

Definition at line 100 of file uniq_memory.hh.

template<typename Ty , class Hash , class Equal >
typedef mem_type::iterator utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >::mem_cell

type of managed mem cells

Definition at line 110 of file uniq_memory.hh.

template<typename Ty , class Hash , class Equal >
typedef hash_map< base_type *, size_t, hash_ptr<Ty, Hash>, eq_ptr<Ty, Equal> > utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >::mem_type [private]

Definition at line 104 of file uniq_memory.hh.


Member Function Documentation

template<typename Ty , class Hash , class Equal >
mem_cell utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >::create ( base_type ptr)

Attachment of a new pointer.

This function adds a new pointer to the memory management.

Parameters:
ptrThe pointer to manage
Returns:
The cell associated to ptr
Note:
if memory has allready a mem_cell equivalent to ptr then ptr is deleted
template<typename Ty , class Hash , class Equal >
void utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >::destroy ( mem_cell  c)

Destroy a memory cell.

This function Will detroy a memory cell and the real pointed value

Parameters:
cThe cell to destroy
template<typename Ty , class Hash , class Equal >
mem_cell utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >::null_cell ( ) [inline]

null cell creation

This function create the cell corresponding to null

Returns:
the null cell

Definition at line 118 of file uniq_memory.hh.


Member Data Documentation

template<typename Ty , class Hash , class Equal >
mem_type utilmm::smart::ref_count::uniq_memory< Ty, Hash, Equal >::the_mem [private]

Definition at line 106 of file uniq_memory.hh.


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


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:32