UCommon
Public Member Functions | Protected Member Functions
ucommon::mapped_array< T > Class Template Reference

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

#include <mapped.h>

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

Public Member Functions

void * addLock (void)
 Add mapped space while holding lock for one object.
void initialize (void)
 Initialize typed data in mapped array.
 mapped_array (const char *name, unsigned number)
 Construct mapped vector array of typed objects.
unsigned max (void) const
 Get member size of typed objects that can be held in mapped vector.
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.

Protected Member Functions

void create (const char *fn, unsigned members)

Detailed Description

template<class T>
class ucommon::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 278 of file mapped.h.


Constructor & Destructor Documentation

template<class T >
ucommon::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:
nameof mapped segment to construct.
numberof objects in the mapped vector.

Definition at line 295 of file mapped.h.


Member Function Documentation

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

Add mapped space while holding lock for one object.

Returns:
address of object.

Definition at line 309 of file mapped.h.

Here is the call graph for this function:

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

Initialize typed data in mapped array.

Assumes default constructor for type.

Definition at line 302 of file mapped.h.

Here is the call graph for this function:

template<class T >
unsigned ucommon::mapped_array< T >::max ( void  ) const [inline]

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

Returns:
members mapped in segment.

Definition at line 339 of file mapped.h.

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

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

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

Definition at line 317 of file mapped.h.

Here is the call graph for this function:

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

Allocate mapped space for one object.

Returns:
address of object.

Definition at line 324 of file mapped.h.

Here is the call graph for this function:

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

Reference typed object of vector in mapped segment.

Parameters:
memberto access.
Returns:
typed reference.

Definition at line 332 of file mapped.h.

Here is the call graph for this function:


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