shm_ptr< T > Class Template Reference

Shared memory pointer implementation. More...

#include <shm_ptr.h>

Inheritance diagram for shm_ptr< T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 shm_ptr ()
 shm_ptr (T *rawptr, const shm_segment &seg)
T * get (const shm_segment &seg) const
long off (void)
long set (long off)
void reset (T *rawptr, const shm_segment &seg)

Private Attributes

long offset

Detailed Description

template<typename T>
class shm_ptr< T >

Shared memory pointer implementation.

shm_ptr gives a way to store a pointer in shared memory as an offset from the shared memory segments attached base address.

For now compiler generated copy constructor and assignment are ok.

Definition at line 19 of file shm_ptr.h.


Constructor & Destructor Documentation

template<typename T>
shm_ptr< T >::shm_ptr (  )  [inline]

shm_ptr can be constructed with an offset of zero.

Definition at line 24 of file shm_ptr.h.

template<typename T>
shm_ptr< T >::shm_ptr ( T *  rawptr,
const shm_segment seg 
) [inline]

shm_ptr can be constructed with a raw pointer and a shared segment.

Definition at line 27 of file shm_ptr.h.


Member Function Documentation

template<typename T>
T* shm_ptr< T >::get ( const shm_segment seg  )  const [inline]

get a typed pointer to an object given the shared segment

Definition at line 33 of file shm_ptr.h.

Referenced by shm_allocator::alloc(), shm_message::getText(), shm_queue< T >::lock_head(), shm_queue< T >::lock_tail(), main(), shm_queue< T >::pop(), shm_queue< T >::push(), shm_message::setText(), shm_queue< T >::size(), shm_queue< T >::unlock_head(), and shm_queue< T >::unlock_tail().

template<typename T>
long shm_ptr< T >::off ( void   )  [inline]

get the segment offset

primarily for use in comparing shm_ptrs

Definition at line 40 of file shm_ptr.h.

Referenced by shm_queue< T >::pop(), shm_queue< T >::push(), and shm_message::setText().

template<typename T>
long shm_ptr< T >::set ( long  off  )  [inline]

set the segment offset

primarily for use in initializing shm_ptrs

Definition at line 46 of file shm_ptr.h.

Referenced by shm_queue< T >::pop(), and shm_queue_header< T >::shm_queue_header().

template<typename T>
void shm_ptr< T >::reset ( T *  rawptr,
const shm_segment seg 
) [inline]

reset the offset, given a raw pointer and shared segment.

Definition at line 49 of file shm_ptr.h.

Referenced by main(), shm_queue< T >::push(), shm_message::setText(), and shm_queue< T >::shm_queue().


Member Data Documentation

template<typename T>
long shm_ptr< T >::offset [private]

Definition at line 51 of file shm_ptr.h.

Referenced by shm_ptr< shm_allocator::shm_allocator_block >::get(), shm_ptr< shm_allocator::shm_allocator_block >::off(), shm_ptr< shm_allocator::shm_allocator_block >::reset(), shm_ptr< shm_allocator::shm_allocator_block >::set(), and shm_ptr< shm_allocator::shm_allocator_block >::shm_ptr().


The documentation for this class was generated from the following file:
Project shmq hosted by   SourceForge.net
Documentation generated on Sat Sep 2 10:07:40 2006 for shmq by   doxygen.org 1.4.6