![]() |
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. | |
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.
|
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.
pSlotSize | The size for each slot in a Shared Memory area to be controlled. |
pSlotQty | The quantity of slots in a Shared Memory area to be controlled. |
Definition at line 57 of file ManagedBuffer.h.
|
inline |
Definition at line 63 of file ManagedBuffer.h.
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.
pBufferPtr | |
pSlotId |
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.
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.
pSharedBufferPtr |
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.
Definition at line 85 of file ManagedBuffer.cpp.
Referenced by HSEP::SharedMemory::SharedMemory(), and HSEP::SharedMemory::~SharedMemory().
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.
pSharedBufferPtr |
Definition at line 63 of file ManagedBuffer.cpp.
Referenced by HSEP::SharedMemory::obtainSlot().
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.
pSharedBufferPtr | |
pSlotId |
Definition at line 47 of file ManagedBuffer.cpp.
Referenced by HSEP::SharedMemory::releaseSlot().
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.
pSlotId |
Definition at line 104 of file ManagedBuffer.cpp.
Referenced by HSEP::SharedMemory::signal().
|
inline |
Returns the quantity of Shared Memory area slots.
Definition at line 128 of file ManagedBuffer.h.
Referenced by HSEP::SharedMemory::read(), and HSEP::SharedMemory::write().
|
inline |
Returns the size for each slot slice in the Shared Memory area.
Definition at line 136 of file ManagedBuffer.h.
Referenced by HSEP::SharedMemory::read(), and HSEP::SharedMemory::write().
int HSEP::ManagedBuffer::wait | ( | ) |
Waits for a signal in the integrated synchronization gate, returning an slotId sent by other process.
Definition at line 92 of file ManagedBuffer.cpp.
Referenced by HSEP::SharedMemory::wait().