ucc::mapped_reuse< T > Class Template Reference

Template class to map typed resusble objects into shared memory heap. More...

#include <mapped.h>

Inheritance diagram for ucc::mapped_reuse< T >:

Inheritance graph
[legend]
Collaboration diagram for ucc::mapped_reuse< T >:

Collaboration graph
[legend]

Public Member Functions

 mapped_reuse (char *name, unsigned number)
 Construct mapped reuse array of typed objects.
void initialize (void)
 Initialize typed data in mapped array.
 operator bool ()
 Check whether there are typed objects available to be allocated.
bool operator! ()
 Check whether there are typed objects available to be allocated.
 operator T * ()
 Request a typed reusable object from the free list or mapped space.
T * operator* ()
 Request a typed reusable object from the free list or mapped space by pointer reference.
T * pos (size_t member)
 Get typed object from a specific member offset within the mapped segment.
T * get (void)
 Request a typed reusable object from the free list or mapped space.
T * getTimed (timeout_t timeout)
 Request a typed reusable object from the free list or mapped space.
T * request (void)
 Request a typed reusable object from the free list or mapped space.
void removeLocked (T *object)
 Used to return a typed object to the reuse pool when the mutex lock is already held.
T * getLocked (void)
 Used to get a typed object from the reuse pool when the mutex lock is already held.
void release (T *object)
 Used to release a typed object back to the reuse typed object pool.

Detailed Description

template<class T>
class ucc::mapped_reuse< T >

Template class to map typed resusble objects into shared memory heap.

This is used to construct a read/write heap of objects that are held in a named shared memory segment. Member objects are allocated from a reusable heap but are stored in the shared memory segment as a vector.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 333 of file mapped.h.


Constructor & Destructor Documentation

template<class T >
ucc::mapped_reuse< T >::mapped_reuse ( char *  name,
unsigned  number 
) [inline]

Construct mapped reuse array of typed objects.

This is constructed for read/write access. mapped_view is used in all cases for read-only access to mapped data.

Parameters:
name of mapped segment to construct.
number of objects in the mapped vector.

Definition at line 347 of file mapped.h.


Member Function Documentation

template<class T >
T* ucc::mapped_reuse< T >::get ( void   )  [inline]

Request a typed reusable object from the free list or mapped space.

This method blocks until an object becomes available.

Returns:
free typed object.

Reimplemented from ucc::MappedReuse.

Definition at line 400 of file mapped.h.

template<class T >
T* ucc::mapped_reuse< T >::getLocked ( void   )  [inline]

Used to get a typed object from the reuse pool when the mutex lock is already held.

Returns:
typed object from pool or NULL if exhausted.

Reimplemented from ucc::MappedReuse.

Definition at line 434 of file mapped.h.

template<class T >
T* ucc::mapped_reuse< T >::getTimed ( timeout_t  timeout  )  [inline]

Request a typed reusable object from the free list or mapped space.

This method blocks until an object becomes available from another thread or the timeout expires.

Parameters:
timeout in milliseconds.
Returns:
free typed object.

Reimplemented from ucc::MappedReuse.

Definition at line 410 of file mapped.h.

template<class T >
void ucc::mapped_reuse< T >::initialize ( void   )  [inline]

Initialize typed data in mapped array.

Assumes default constructor for type.

Definition at line 354 of file mapped.h.

template<class T >
ucc::mapped_reuse< T >::operator bool (  )  [inline]

Check whether there are typed objects available to be allocated.

Returns:
true if objects are available.

Reimplemented from ucc::MappedMemory.

Definition at line 361 of file mapped.h.

template<class T >
ucc::mapped_reuse< T >::operator T * (  )  [inline]

Request a typed reusable object from the free list or mapped space.

This method blocks until an object becomes available.

Returns:
free object.

Definition at line 376 of file mapped.h.

template<class T >
bool ucc::mapped_reuse< T >::operator! (  )  [inline]

Check whether there are typed objects available to be allocated.

Returns:
true if no more typed objects are available.

Reimplemented from ucc::MappedMemory.

Definition at line 368 of file mapped.h.

template<class T >
T* ucc::mapped_reuse< T >::operator* (  )  [inline]

Request a typed reusable object from the free list or mapped space by pointer reference.

This method blocks until an object becomes available.

Returns:
free object.

Definition at line 384 of file mapped.h.

template<class T >
T* ucc::mapped_reuse< T >::pos ( size_t  member  )  [inline]

Get typed object from a specific member offset within the mapped segment.

Parameters:
member offset from start of segment. Will fault if past end.
Returns:
typed object pointer.

Definition at line 392 of file mapped.h.

template<class T >
void ucc::mapped_reuse< T >::release ( T *  object  )  [inline]

Used to release a typed object back to the reuse typed object pool.

Parameters:
object being released.

Definition at line 441 of file mapped.h.

Here is the call graph for this function:

template<class T >
void ucc::mapped_reuse< T >::removeLocked ( T *  object  )  [inline]

Used to return a typed object to the reuse pool when the mutex lock is already held.

Parameters:
object being returned.

Definition at line 426 of file mapped.h.

template<class T >
T* ucc::mapped_reuse< T >::request ( void   )  [inline]

Request a typed reusable object from the free list or mapped space.

This method does not block or wait.

Returns:
free typed object if available or NULL.

Reimplemented from ucc::MappedReuse.

Definition at line 418 of file mapped.h.


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

Generated on Wed Aug 19 22:04:11 2009 for UCommon by  doxygen 1.5.9