All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEP::ManagedBuffer Class Reference

Managed Buffer to be used as a control center for a Shared Memory buffer. More...

#include <ManagedBuffer.h>

Public Member Functions

 ManagedBuffer (size_t pSlotSize, int pSlotQty)
 Defines an instance for control of a Shared Memory area.
 
 ~ManagedBuffer ()
 
char * calcAddressPtr (char *pBufferPtr, int pSlotId) const
 Given the pBufferPtr (Shared Memory area pointer), calculates the address for the slot identified by pSlotId.
 
void cleanSlot (char *pBufferPtr, int pSlotId)
 Clean the slot area (the slice) identified by pSlotId inside the Shared Memory Area pointed by pBufferPtr.
 
void pushFree (char *pSharedBufferPtr, int pSlotId)
 Returns a ticket for a slice slot in the corresponding Shared Memory area, cleaning that slice in the process.
 
int popFree (char *pSharedBufferPtr)
 Obtains a ticket for a free slice slot in a Shared Memory area.
 
const char * dataPtr (char *pSharedBufferPtr) const
 Returns the root for the storing data inside the provided Shared Memory area.
 
size_t dataSize () const
 Returns the total size for the Shared Memory area is being controlled.
 
int wait ()
 Waits for a signal in the integrated synchronization gate, returning an slotId sent by other process.
 
void signal (int pSlotId)
 Sends a signal to other process together with a slot id that usually will contain important data to be shared.
 
int slotQty () const
 Returns the quantity of Shared Memory area slots.
 
size_t slotSize () const
 Returns the size for each slot slice in the Shared Memory area.
 

Detailed Description

Managed Buffer to be used as a control center for a Shared Memory buffer.

The ManagedBuffer itself must be stored in a Shared Memory area.

Definition at line 36 of file ManagedBuffer.h.

Constructor & Destructor Documentation

HSEP::ManagedBuffer::ManagedBuffer ( size_t  pSlotSize,
int  pSlotQty 
)
inline

Defines an instance for control of a Shared Memory area.

The ManagedBuffer by itself doesn't content the Shared Memory area data, but the Shared Memory data control information.

Parameters
pSlotSizeThe size for each slot in a Shared Memory area to be controlled.
pSlotQtyThe quantity of slots in a Shared Memory area to be controlled.

Definition at line 57 of file ManagedBuffer.h.

HSEP::ManagedBuffer::~ManagedBuffer ( )
inline

Definition at line 63 of file ManagedBuffer.h.

Member Function Documentation

char * HSEP::ManagedBuffer::calcAddressPtr ( char *  pBufferPtr,
int  pSlotId 
) const

Given the pBufferPtr (Shared Memory area pointer), calculates the address for the slot identified by pSlotId.

Parameters
pBufferPtr
pSlotId
Returns

Definition at line 29 of file ManagedBuffer.cpp.

void HSEP::ManagedBuffer::cleanSlot ( char *  pBufferPtr,
int  pSlotId 
)

Clean the slot area (the slice) identified by pSlotId inside the Shared Memory Area pointed by pBufferPtr.

Parameters
pBufferPtr
pSlotId

Definition at line 41 of file ManagedBuffer.cpp.

const char * HSEP::ManagedBuffer::dataPtr ( char *  pSharedBufferPtr) const

Returns the root for the storing data inside the provided Shared Memory area.

Parameters
pSharedBufferPtr
Returns

Definition at line 79 of file ManagedBuffer.cpp.

size_t HSEP::ManagedBuffer::dataSize ( ) const

Returns the total size for the Shared Memory area is being controlled.

Returns

Definition at line 85 of file ManagedBuffer.cpp.

Referenced by HSEP::SharedMemory::SharedMemory(), and HSEP::SharedMemory::~SharedMemory().

+ Here is the caller graph for this function:

int HSEP::ManagedBuffer::popFree ( char *  pSharedBufferPtr)

Obtains a ticket for a free slice slot in a Shared Memory area.

Must be returned calling pushFree when not used.

Parameters
pSharedBufferPtr
Returns
the free ticket to be used.

Definition at line 63 of file ManagedBuffer.cpp.

Referenced by HSEP::SharedMemory::obtainSlot().

+ Here is the caller graph for this function:

void HSEP::ManagedBuffer::pushFree ( char *  pSharedBufferPtr,
int  pSlotId 
)

Returns a ticket for a slice slot in the corresponding Shared Memory area, cleaning that slice in the process.

Parameters
pSharedBufferPtr
pSlotId

Definition at line 47 of file ManagedBuffer.cpp.

Referenced by HSEP::SharedMemory::releaseSlot().

+ Here is the caller graph for this function:

void HSEP::ManagedBuffer::signal ( int  pSlotId)

Sends a signal to other process together with a slot id that usually will contain important data to be shared.

Parameters
pSlotId

Definition at line 104 of file ManagedBuffer.cpp.

Referenced by HSEP::SharedMemory::signal().

+ Here is the caller graph for this function:

int HSEP::ManagedBuffer::slotQty ( ) const
inline

Returns the quantity of Shared Memory area slots.

Returns

Definition at line 128 of file ManagedBuffer.h.

Referenced by HSEP::SharedMemory::read(), and HSEP::SharedMemory::write().

+ Here is the caller graph for this function:

size_t HSEP::ManagedBuffer::slotSize ( ) const
inline

Returns the size for each slot slice in the Shared Memory area.

Returns

Definition at line 136 of file ManagedBuffer.h.

Referenced by HSEP::SharedMemory::read(), and HSEP::SharedMemory::write().

+ Here is the caller graph for this function:

int HSEP::ManagedBuffer::wait ( )

Waits for a signal in the integrated synchronization gate, returning an slotId sent by other process.

Returns

Definition at line 92 of file ManagedBuffer.cpp.

Referenced by HSEP::SharedMemory::wait().

+ Here is the caller graph for this function:


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