libdodo: dodo::data::memory::shared Class Reference

dodo::data::memory::shared Class Reference

provides shared data functionality More...

#include <dataMemoryShared.h>

Collaboration diagram for dodo::data::memory::shared:

List of all members.

Classes

struct  __shared__
 defines shared data More...

Public Member Functions

 shared (const int key)
 constructor
 shared ()
 constructor
 ~shared ()
 destructor
void open (const int key) const
 open or create shared memory object
void close () const
 close shared memory object
void * map (unsigned long size=0) const
 map shared data
void unmap () const
 unmap shared data
void * data () const
unsigned long size () const

Static Public Member Functions

static void remove (int key)
 remove the shared data from the system

Protected Attributes

int handle
 shared data descriptor
struct __shared__ sh
 shared data
__key__ * key
 key for the shared data
bool autogenerated
 true if key was autogenerated

Detailed Description

provides shared data functionality

Note:
if the key was not autogenerated the semaphore is not removed from the system you should call remove to remove it from the system

Definition at line 50 of file dataMemoryShared.h.


Constructor & Destructor Documentation

dodo::data::memory::shared::shared ( const int  key  ) 

constructor

Parameters:
key defines shared memory key
Note:
if key is 0 - key will be generated if you want to share data between different instances of process - set own key, otherwise(like fork) - it may be generated
dodo::data::memory::shared::shared (  ) 

constructor

dodo::data::memory::shared::~shared (  ) 

destructor


Member Function Documentation

void dodo::data::memory::shared::close (  )  const

close shared memory object

void* dodo::data::memory::shared::data (  )  const
Returns:
shared data
void* dodo::data::memory::shared::map ( unsigned long  size = 0  )  const

map shared data

Returns:
shared data
Parameters:
size defines size of shared data
Note:
if map is called twice - old data will be unmapped is size is 0 it will be detected automatically
void dodo::data::memory::shared::open ( const int  key  )  const

open or create shared memory object

Parameters:
key defines shared memory key
Note:
if key is 0 - key will be generated if you want to share data between different instances of process - set own key, otherwise(like fork) - it may be generated
static void dodo::data::memory::shared::remove ( int  key  )  [static]

remove the shared data from the system

Parameters:
key defines the key of the shared data
unsigned long dodo::data::memory::shared::size (  )  const
Returns:
size of shared data
Note:
this should be called before map to obtain the size of the already allocated shared memory
void dodo::data::memory::shared::unmap (  )  const

unmap shared data


Member Data Documentation

bool dodo::data::memory::shared::autogenerated [mutable, protected]

true if key was autogenerated

Definition at line 158 of file dataMemoryShared.h.

int dodo::data::memory::shared::handle [mutable, protected]

shared data descriptor

Definition at line 129 of file dataMemoryShared.h.

__key__* dodo::data::memory::shared::key [protected]

key for the shared data

Definition at line 156 of file dataMemoryShared.h.

struct __shared__ dodo::data::memory::shared::sh [read, protected]

shared data

Definition at line 154 of file dataMemoryShared.h.


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

Generated on Sun Nov 8 03:44:48 2009 for libdodo by  doxygen 1.6.1