HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_SharedMemory Class Reference

#include <SYS_SharedMemory.h>

Public Member Functions

 SYS_SharedMemory (exint size=0)
 Create a new shared memory block of a given size. More...
 
 SYS_SharedMemory (const char *id, bool read_only=true)
 Open an existing shared memory block through the given identifier. More...
 
 ~SYS_SharedMemory ()
 
 SYS_SharedMemory (const SYS_SharedMemory &)=delete
 
SYS_SharedMemoryoperator= (const SYS_SharedMemory &)=delete
 
bool reset (exint size)
 
const char * id () const
 
exint size () const
 Returns the size of the shared memory, in bytes. More...
 
bool readOnly () const
 Returns true if this shared memory is read-only. More...
 
int64 getMemoryUsage (bool inclusive) const
 

Static Public Member Functions

static void setTempDir (const char *path)
 

Friends

class SYS_SharedMemoryView
 

Detailed Description

Creates a read-only shared memory object, that accesses an existing shared memory buffer, using a unique identifier.

Definition at line 26 of file SYS_SharedMemory.h.

Constructor & Destructor Documentation

SYS_SharedMemory::SYS_SharedMemory ( exint  size = 0)

Create a new shared memory block of a given size.

SYS_SharedMemory::SYS_SharedMemory ( const char *  id,
bool  read_only = true 
)

Open an existing shared memory block through the given identifier.

SYS_SharedMemory::~SYS_SharedMemory ( )
SYS_SharedMemory::SYS_SharedMemory ( const SYS_SharedMemory )
delete

Member Function Documentation

int64 SYS_SharedMemory::getMemoryUsage ( bool  inclusive) const

Returns an approximation of the memory used by these structures, NOT the shared memory itself.

const char* SYS_SharedMemory::id ( ) const

Returns the identifier of the shared memory segment, such that it can be opened from another process. The pointer is valid as long as this object is.

SYS_SharedMemory& SYS_SharedMemory::operator= ( const SYS_SharedMemory )
delete
bool SYS_SharedMemory::readOnly ( ) const

Returns true if this shared memory is read-only.

bool SYS_SharedMemory::reset ( exint  size)

Resets the shared memory to the given size. This has the effect of removing the previous shared memory segment (unless it's already open by someone else, in which case it gets deleted when that user closes it). This operation will also result in a new id() being generated to avoid a potential conflict with the potentially still open shared memory section. The shared memory cannot be reset if it was opened from an existing identifier.

static void SYS_SharedMemory::setTempDir ( const char *  path)
static

On some operating systems, shared memory is handled using a file system interface. On these systems, we need to know where the temporary files should be installed. This is typically in HOUDINI_TEMP_DIR.

Note: This is not thread safe, and should only be done once

exint SYS_SharedMemory::size ( ) const

Returns the size of the shared memory, in bytes.

Friends And Related Function Documentation

friend class SYS_SharedMemoryView
friend

Definition at line 73 of file SYS_SharedMemory.h.


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