FARGOS/VISTA Object Management Environment Core
..
|
Manager for collection of shared memory variables. More...
#include <shared_variable.hpp>
Public Member Functions | |
void | attachExistingSegment (unsigned char *segment, size_t segmentLength) |
Use an existing, already initialized, memory segment for variable storage. More... | |
void | attachExistingSegment (BufferRegion *bfr) |
Overloaded variant of attachExistingSegment() that uses an BufferRegion object in control of an already initialized segment. More... | |
void | initializeSegment (unsigned char *segment, size_t segmentLength, const char *componentName) |
Initialize a memory segment for use as variable storage. More... | |
void | initializeSegment (BufferRegion *bfr) |
Overloaded variant of initializeSegment that initializes a memory segment already under control of a BufferRegion for use as variable storage. More... | |
unsigned char * | createAndAttachStandardSegment (const char *componentName, size_t *segmentLength) |
Convenience function to create a file and map it to segment for variable storage. The filename will include the component name, date, and process Id. More... | |
SharedMemoryVariableManager (bool inDataSegment=true) | |
Constructor for a shared memory variable manager. More... | |
~SharedMemoryVariableManager () | |
int | takeDeferredRegistrations (SharedMemoryVariableManager *otherMgr) |
SharedMemoryVariable::SharedMemoryVariable_Record * | iterateOver32BitSegment (SharedBufferAllocRecord_32 **iterator) |
SharedMemoryVariable::SharedMemoryVariable_Record * | iterateOver64BitSegment (SharedBufferAllocRecord_64 **iterator) |
size_t | offsetInSegment (const SharedMemoryVariable::SharedMemoryVariable_Record *rec) const |
bool | initialized () const OME_ALWAYS_INLINE |
bool | registerVariable (SharedMemoryVariable &var) |
Register a single variable with the segment manager. More... | |
void | registerVariables (int count, SharedMemoryVariable *vars[]) |
Register an array of variables with the segment manager. More... | |
Static Public Member Functions | |
static unsigned char * | createSegment (const char *fileName, size_t *segmentLengthPtr, int initMode=MAP_FILE_INIT, const char *desiredMagicNumber=SMV_MAGIC_NUMBER) |
Open a file and map it to a memory segment for variable storage. More... | |
Protected Types | |
typedef std::list< SharedMemoryVariable * > | smv_list_t |
Protected Member Functions | |
void | allocateVariable (SharedMemoryVariable *var) |
Internal routine to allocate storage within the segment for a shared memory variable. More... | |
void | allocateDeferredVariables () |
Internal routine to allocate previously registered SharedMemoryVariables within a newly allocated segment. More... | |
Protected Attributes | |
smv_list_t * | deferredList |
BufferRegion * | bfrMgr |
unsigned char * | regionBase |
size_t | regionLength |
Manager for collection of shared memory variables.
|
protected |
|
explicit |
Constructor for a shared memory variable manager.
inDataSegment | should be set to false if the object is constructed in the heap (e.g., via the new operator). |
SharedMemoryVariableManager::~SharedMemoryVariableManager | ( | ) |
|
protected |
Internal routine to allocate previously registered SharedMemoryVariables within a newly allocated segment.
|
protected |
Internal routine to allocate storage within the segment for a shared memory variable.
References SharedMemoryVariable::SharedMemoryVariable_Record::allocatedLength, SharedBufferAllocRecord_32::blockLen, SharedMemoryVariable::dataPointer, SharedMemoryVariable::getMinLength(), SharedMemoryVariable::getName(), SharedMemoryVariable::getType(), SharedMemoryVariable::noteNowRegistered(), SharedMemoryVariable::SharedMemoryVariable_Record::parentNodeOffset, SharedMemoryVariable::parentNodeRecord, SharedMemoryVariable::SharedMemoryVariable_Record::recordType, SharedMemoryVariable::registered, SharedMemoryVariable::SharedMemoryVariable_Record::varName, and SharedMemoryVariable::SharedMemoryVariable_Record::varNameLength.
void SharedMemoryVariableManager::attachExistingSegment | ( | BufferRegion * | bfr | ) |
Overloaded variant of attachExistingSegment() that uses an BufferRegion object in control of an already initialized segment.
bfr | specifies the BufferRegion manager owning the segment. Ownership of the BufferRegion object is transferred. |
This routine does not destroy the existing contents of the region.
References BufferRegion::getBufferBase(), and BufferRegion::getRegionLength().
void SharedMemoryVariableManager::attachExistingSegment | ( | unsigned char * | segment, |
size_t | segmentLength | ||
) |
Use an existing, already initialized, memory segment for variable storage.
This routine does not destroy the existing contents of the region and is typically used by an external process to access a segment.
unsigned char * SharedMemoryVariableManager::createAndAttachStandardSegment | ( | const char * | componentName, |
size_t * | segmentLength | ||
) |
Convenience function to create a file and map it to segment for variable storage. The filename will include the component name, date, and process Id.
References FILENAME_WITH_EVERYTHING, makeQualifiedFileName(), MAP_FILE_INIT, safe_strcpy, and SMV_MAGIC_NUMBER.
|
static |
Open a file and map it to a memory segment for variable storage.
fileName | specifies the file to be opened. |
segmentLengthPtr | points to an area from which the desired segment length will be taken or will be filled in with the size of the opened file. |
initMode | is a mode for createMappedFile(), typically MAP_FILE_INIT. |
desiredMagicNumber | points to a sequence of character that will be used as the magic number for the segment. Typically this is SMV_MAGIC_NUMBER. |
References createMappedFile(), SharedBufferRegionHeader_32::magicNumber, and MAP_FILE_RESET.
Referenced by ReadMappedCircularBuffer::ReadMappedCircularBuffer().
|
inline |
References bfrMgr.
void SharedMemoryVariableManager::initializeSegment | ( | BufferRegion * | bfr | ) |
Overloaded variant of initializeSegment that initializes a memory segment already under control of a BufferRegion for use as variable storage.
bfr | points to an already established BufferRegion whose region will be initialized for use. Ownership of the BufferRegion object is transferred. |
References BufferRegion::getBufferBase(), and BufferRegion::getRegionLength().
void SharedMemoryVariableManager::initializeSegment | ( | unsigned char * | segment, |
size_t | segmentLength, | ||
const char * | componentName | ||
) |
Initialize a memory segment for use as variable storage.
segment | points to the base of the segment |
segmentLength | specifies the length of the segment |
componentName | specifies the name of the component initializing the segment. |
References SMV_MAGIC_NUMBER.
SharedMemoryVariable::SharedMemoryVariable_Record * SharedMemoryVariableManager::iterateOver32BitSegment | ( | SharedBufferAllocRecord_32 ** | iterator | ) |
SharedMemoryVariable::SharedMemoryVariable_Record * SharedMemoryVariableManager::iterateOver64BitSegment | ( | SharedBufferAllocRecord_64 ** | iterator | ) |
|
inline |
References bfrMgr, and BufferRegion::getBufferBase().
bool SharedMemoryVariableManager::registerVariable | ( | SharedMemoryVariable & | var | ) |
Register a single variable with the segment manager.
References SharedMemoryVariable::getName(), and SharedMemoryVariable::registered.
Referenced by SharedMemoryVariable::SharedMemoryVariable().
void SharedMemoryVariableManager::registerVariables | ( | int | count, |
SharedMemoryVariable * | vars[] | ||
) |
Register an array of variables with the segment manager.
int SharedMemoryVariableManager::takeDeferredRegistrations | ( | SharedMemoryVariableManager * | otherMgr | ) |
References deferredList, and SharedMemoryVariable::variableManager.
|
protected |
Referenced by initialized(), and offsetInSegment().
|
protected |
Referenced by takeDeferredRegistrations().
|
protected |
|
protected |
![]() | Generated: Tue Jul 28 2020 16:03:27
Support Information |