|
lintel 0.2.0
|
#include <MessageQueueCore.h>
Public Member Functions | |
| MessageQueueCore (std::string name, int32_t msgCount, std::size_t msgSize) | |
| ~MessageQueueCore () | |
| MessageQueueCore (const MessageQueueCore &)=delete | |
| MessageQueueCore & | operator= (const MessageQueueCore &)=delete |
| int32_t | numberMessagesOf () const |
| void | sendOf (const void *message, std::size_t size) |
| bool | trySendOf (const void *message, std::size_t size) |
| bool | sendOfWithTimeout (const void *message, std::size_t size, const std::chrono::milliseconds &timeout) |
| void | receiveOf (void *message, std::size_t size) |
| bool | tryReceiveOf (void *message, std::size_t size) |
Static Public Member Functions | |
| static void | removeOf (const std::string &messageQueueName) |
| static int32_t | numberMessagesOfIfExistsOf (const std::string &messageQueueName) |
Non-template core of MessageQueue. Owns the underlying POSIX message queue, so translation units that use MessageQueue<T> do not have to parse the boost::interprocess headers. Messages are passed as byte buffers whose size the caller (MessageQueue<T>) derives from its own type.
| lintel::MessageQueueCore::MessageQueueCore | ( | std::string | name, |
| int32_t | msgCount, | ||
| std::size_t | msgSize | ||
| ) |
open or create the message queue
| name | of the message queue. No filepath just name. |
| msgCount | limit of queue itself |
| msgSize | maximum size of a single message in bytes |
| lintel::MessageQueueCore::~MessageQueueCore | ( | ) |
|
delete |
| int32_t lintel::MessageQueueCore::numberMessagesOf | ( | ) | const |
|
static |
Open an existing queue without creating it and read its message count.
| messageQueueName | name of the queue to inspect |
|
delete |
receives message. No message => waits until message is available
| message | buffer receiving the message |
| size | maximum size of the received message in bytes |
remove of message queue
| messageQueueName | name of the queue to remove |
send of message. Message Queue full => blocks until message queue is free
| message | buffer holding the message |
| size | of the message in bytes |
| bool lintel::MessageQueueCore::sendOfWithTimeout | ( | const void * | message, |
| std::size_t | size, | ||
| const std::chrono::milliseconds & | timeout | ||
| ) |
send with a bounded wait. If the message queue stays full for the whole timeout the message is dropped.
| message | buffer holding the message |
| size | of the message in bytes |
| timeout | maximum time to wait for queue space |
try to receive message. No message => non blocking and return false
| message | buffer receiving the message |
| size | maximum size of the received message in bytes |
send non blocking. Message Queue full => return false and doesn't send message.
| message | buffer holding the message |
| size | of the message in bytes |