mapped_array< T > Class Template Reference

Template class to map typed vector into shared memory. More...

#include <mapped.h>

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

Public Member Functions

 mapped_array (const char *name, unsigned number)
 Construct mapped vector array of typed objects.
void initialize (void)
 Initialize typed data in mapped array.
void * addLock (void)
 Add mapped space while holding lock for one object.
T * operator() (unsigned member)
 Get typed pointer to member object of vector in mapped segment.
T * operator() (void)
 Allocate mapped space for one object.
T & operator[] (unsigned member)
 Reference typed object of vector in mapped segment.
unsigned getSize (void)
 Get member size of typed objects that can be held in mapped vector.

Protected Member Functions

void create (const char *fn, unsigned members)

Detailed Description

template<class T>
class mapped_array< T >

Template class to map typed vector into shared memory.

This is used to construct a typed read/write vector of objects that are held in a named shared memory segment.

Author:
David Sugar <dyfet@gnutelephony.org>

Definition at line 260 of file mapped.h.


Constructor & Destructor Documentation

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

Construct mapped vector 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. Member objects are linearly allocated from the shared memory segment, or may simply be directly accessed by offset.

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

Definition at line 277 of file mapped.h.


Member Function Documentation

template<class T >
void* mapped_array< T >::addLock ( void   )  [inline]

Add mapped space while holding lock for one object.

Returns:
address of object.

Definition at line 291 of file mapped.h.

Here is the call graph for this function:

template<class T >
unsigned mapped_array< T >::getSize ( void   )  [inline]

Get member size of typed objects that can be held in mapped vector.

Returns:
members mapped in segment.

Definition at line 321 of file mapped.h.

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

Initialize typed data in mapped array.

Assumes default constructor for type.

Definition at line 284 of file mapped.h.

Here is the call graph for this function:

template<class T >
T* mapped_array< T >::operator() ( void   )  [inline]

Allocate mapped space for one object.

Returns:
address of object.

Definition at line 306 of file mapped.h.

Here is the call graph for this function:

template<class T >
T* mapped_array< T >::operator() ( unsigned  member  )  [inline]

Get typed pointer to member object of vector in mapped segment.

Parameters:
member to access.
Returns:
typed pointer or NULL if past end of array.

Definition at line 299 of file mapped.h.

Here is the call graph for this function:

template<class T >
T& mapped_array< T >::operator[] ( unsigned  member  )  [inline]

Reference typed object of vector in mapped segment.

Parameters:
member to access.
Returns:
typed reference.

Definition at line 314 of file mapped.h.

Here is the call graph for this function:


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

Generated on 28 Dec 2009 for UCommon by  doxygen 1.6.1