#include <communShMem.h>
Inheritance diagram for CommunShMem::
Public Methods | |
CommunShMem (const String &shmemId, int size) | |
Constructor. More... | |
virtual | ~CommunShMem () |
Destructor. | |
virtual int | initialize () |
Initialization of communication. More... | |
virtual Commun & | operator>> (Buffer &b) |
Read data. More... | |
virtual Commun & | operator<< (const Buffer &b) |
Write data. More... | |
virtual int | isReady () |
Communication channel ready for reading. More... | |
Private Methods | |
int | checkClient () |
Check client. More... | |
Private Attributes | |
Semaphore | _sem1 |
semaphore. | |
Semaphore | _sem2 |
semaphore. | |
SharedMemory | _shmem |
shared memory. | |
pid_t | _pid |
client process ID. |
This class implements shared memory communication and offers the user of this class the standard interface of Commun class. Implementation is system dependent (so it is different on WIN32 and UNIX systems). It should be faster then using sockets.
Definition at line 55 of file communShMem.h.
|
Constructor. Creates shared memory block and needed semaphores for communication. If semaphores or shared memory block already exist, they are used.
Definition at line 37 of file communShMem.cpp. |
|
Check client. This routine checks if the client is still connected and is alive.
Definition at line 179 of file communShMem.cpp. Referenced by operator<<(), and operator>>().
|
|
Initialization of communication. This method only waits for first unlocking of the semaphore used during communication. In this way it recognizes that communication has started.
Reimplemented from Commun. Definition at line 155 of file communShMem.cpp. |
|
Communication channel ready for reading. This method returns TRUE, if there are data in communication channel and should be read from it.
Reimplemented from Commun. Definition at line 148 of file communShMem.cpp. |
|
Write data. This operator is used to write data from buffer to communication channel (shmem).
Reimplemented from Commun. Definition at line 102 of file communShMem.cpp. |
|
Read data. This operator is used to read data from communication channel (shmem) to buffer.
Reimplemented from Commun. Definition at line 56 of file communShMem.cpp. |