shm_segment Class Reference

Persistent shared memory segments with history. More...

#include <shm_segment.h>

List of all members.

Public Member Functions

 shm_segment (int i, int flg)
 shm_segment (int key, int size, int perm)
 ~shm_segment ()
void * get_base () const
int get_flag () const
int get_key () const
int get_id () const
int get_size () const
bool persist (bool p)
void destroy ()

Private Attributes

key_t key
int shmflg
int shmid
int size
void * attach
bool persistant
shmid_ds * shmctlds


Detailed Description

Persistent shared memory segments with history.

Shared memory segment class

The shared memory class is a thin object implemented on the shmget() and shmat() calls. Since an additional call to the function shmctl() is required to remove the segment, (using the option IPC_RMID), queue persistence is obtained with lack of an action in the segment destructor.

Definition at line 27 of file shm_segment.h.


Constructor & Destructor Documentation

shm_segment::shm_segment ( int  i,
int  flg 
)

connect to an existing segment

Definition at line 83 of file shm_segment.h.

References attach, shmctlds, and shmid.

shm_segment::shm_segment ( int  key,
int  size,
int  perm 
)

create a new segment

Definition at line 100 of file shm_segment.h.

References attach, key, shmid, and size.

shm_segment::~shm_segment (  ) 

deconstruct a segment instance

Definition at line 109 of file shm_segment.h.

References attach, persistant, and shmid.


Member Function Documentation

void* shm_segment::get_base (  )  const [inline]

get the base address of attached segment

Definition at line 41 of file shm_segment.h.

References attach.

Referenced by shm_ptr< shm_allocator::shm_allocator_block >::get(), shm_allocator::init(), shm_allocator::init_allocator_header(), shm_queue< T >::pop(), shm_queue< T >::push(), shm_allocator::remove_block(), shm_ptr< shm_allocator::shm_allocator_block >::reset(), shm_ptr< shm_allocator::shm_allocator_block >::shm_ptr(), and shm_queue< T >::shm_queue().

int shm_segment::get_flag (  )  const [inline]

get flags used for creation or attachment

Definition at line 44 of file shm_segment.h.

References shmflg.

int shm_segment::get_key (  )  const [inline]

get segment key

Definition at line 47 of file shm_segment.h.

Referenced by shm_allocator::init(), and shm_allocator::init_allocator_header().

int shm_segment::get_id (  )  const [inline]

get shared memory identifier

Definition at line 50 of file shm_segment.h.

References shmid.

Referenced by reportInitialization().

int shm_segment::get_size (  )  const [inline]

get segment size in bytes

Definition at line 53 of file shm_segment.h.

Referenced by shm_allocator::init_allocator_header().

bool shm_segment::persist ( bool  p  )  [inline]

set persistence behavior

Definition at line 56 of file shm_segment.h.

References persistant.

void shm_segment::destroy (  ) 


Member Data Documentation

key_t shm_segment::key [private]

key to be passed to shmget()

Definition at line 62 of file shm_segment.h.

Referenced by shm_segment().

int shm_segment::shmflg [private]

shmflg to be passed to shmget()

Definition at line 65 of file shm_segment.h.

Referenced by get_flag().

int shm_segment::shmid [private]

return value from shmget()

Definition at line 68 of file shm_segment.h.

Referenced by get_id(), shm_segment(), and ~shm_segment().

int shm_segment::size [private]

size to be passed to shmget()

Definition at line 71 of file shm_segment.h.

Referenced by shm_segment().

void* shm_segment::attach [private]

base attach point

Definition at line 74 of file shm_segment.h.

Referenced by get_base(), shm_segment(), and ~shm_segment().

bool shm_segment::persistant [private]

persist segment

Definition at line 77 of file shm_segment.h.

Referenced by persist(), and ~shm_segment().

struct shmid_ds* shm_segment::shmctlds [private]

pointer to shmctl data structure

Definition at line 80 of file shm_segment.h.

Referenced by shm_segment().


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