DCMTK Version 3.6.9
OFFIS DICOM Toolkit
|
a server class for one-directional IPC messaging. More...
Public Member Functions | |
OFIPCMessageQueueServer () | |
default constructor | |
virtual | ~OFIPCMessageQueueServer () |
destructor, will implicitly call deleteQueue() if not already called by the user. | |
OFCondition | createQueue (const char *name, Uint32 port) |
create a new message queue | |
OFBool | hasQueue () const |
check if this object manages an open message queue | |
OFCondition | deleteQueue () |
delete the message queue | |
void | detachQueue () |
resets this object to default constructed state without closing the message queue. | |
OFBool | messageWaiting () |
check if an incoming message is waiting in the queue. | |
size_t | numMessagesWaiting () |
return the number of incoming messages waiting in the queue | |
OFCondition | receiveMessage (OFString &msg) |
receive a message from the message queue and remove it from the queue. | |
Static Public Member Functions | |
static void | registerSignalHandler () |
register signal handlers for SIGINT and SIGTERM that call closeAllMessageQueues() upon receiving the signal, thus globally closing all message queues created by the process, if these message queues would persist after the end of the process otherwise. | |
Private Member Functions | |
OFCondition | deleteQueueInternal () |
delete the message queue without touching the internally managed global list of message queues. | |
Friends | |
void | closeAllMessageQueues () |
friend function that will call deleteQueueInternal(). | |
a server class for one-directional IPC messaging.
It enables the user to create an IPC message queue and to receive incoming messages. Depending on the platform, the implementation is based on Windows mailslots, Posix message queues, System V message queues or, on Android, on Unix domain sockets and a separate handler thread that handles incoming connections. The latter implementation is preferred over the alternatives if the macro DCMTK_USE_UNIX_SOCKET_QUEUE is defined.
OFCondition OFIPCMessageQueueServer::createQueue | ( | const char * | name, |
Uint32 | port | ||
) |
create a new message queue
a | name for the queue that is known both to the client and the server. Typically the name of the tool using the queue. Must not contain characters that are not permitted in a filename. Should not be longer than 128 bytes. |
a | number that is known both to the client and the server. Usually this will be the port number under which the server process accepts incoming TCP/IP network connection. When used in other contexts, a number larger than 65535 should be used. |
OFCondition OFIPCMessageQueueServer::deleteQueue | ( | ) |
delete the message queue
|
private |
delete the message queue without touching the internally managed global list of message queues.
void OFIPCMessageQueueServer::detachQueue | ( | ) |
resets this object to default constructed state without closing the message queue.
This method may be called by forked child processes to make sure that the destructor executed in the child process will not close the message queue for the parent process as well.
OFBool OFIPCMessageQueueServer::hasQueue | ( | ) | const |
check if this object manages an open message queue
OFBool OFIPCMessageQueueServer::messageWaiting | ( | ) |
check if an incoming message is waiting in the queue.
size_t OFIPCMessageQueueServer::numMessagesWaiting | ( | ) |
return the number of incoming messages waiting in the queue
OFCondition OFIPCMessageQueueServer::receiveMessage | ( | OFString & | msg | ) |
receive a message from the message queue and remove it from the queue.
If no message is available, the method will immediately return EC_IPCMessageQueueEmpty (no blocking).
msg | message received into this parameter if successful |
|
static |
register signal handlers for SIGINT and SIGTERM that call closeAllMessageQueues() upon receiving the signal, thus globally closing all message queues created by the process, if these message queues would persist after the end of the process otherwise.
Does nothing on Windows.
|
friend |
friend function that will call deleteQueueInternal().
Not to be called by normal user code, not thread safe!