RaftLib  0.3a
C++ Stream Processing Template Library
Static Public Member Functions | List of all members
SHM Class Reference

Static Public Member Functions

static void GenKey (char *buffer, size_t length)
 
static void * Init (const char *key, size_t nbytes, bool zero=true, void *ptr=nullptr)
 
static void * Open (const char *key)
 
static bool Close (const char *key, void *ptr, size_t nbytes, bool zero=false, bool unlink=false)
 

Member Function Documentation

bool SHM::Close ( const char *  key,
void *  ptr,
size_t  nbytes,
bool  zero = false,
bool  unlink = false 
)
static

Close - returns true if successful, false otherwise.

Parameters
key- const char*
ptr- start ptr to mapped region
nbytes- number of bytes for each element in mapped region
nitems- total number of items with size nbytes
zero- zero mapped region before closing, default: false
Returns
bool - true if successful.
void SHM::GenKey ( char *  buffer,
size_t  length 
)
static

GenKey - generate a shared key at the memory address pointed to by ptr *key with length length.

Parameters
buffer- char *
length- size_t
void * SHM::Init ( const char *  key,
size_t  nbytes,
bool  zero = true,
void *  ptr = nullptr 
)
static

Init - initialize SHM segment with file descriptor key, with the number of items (nitems) and number of bytes each for each item (nbytes). Returns NULL if error, and prints the error code to std::cerr

Parameters
key- const char *
nbytes- size_t
zero- zero before returning memory, default: true
Returns
void* - ptr to beginning of memory allocated
void * SHM::Open ( const char *  key)
static

Open - opens the shared memory segment with the file descriptor stored at key.

Parameters
key- const char *
Returns
void* - start of allocated memory, or NULL if error

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