|
iceoryx_doc
1.0.1
|
Wrapper class for posix message queue. More...
#include <message_queue.hpp>


Public Member Functions | |
| MessageQueue () | |
| MessageQueue (const MessageQueue &other)=delete | |
| MessageQueue (MessageQueue &&other) | |
| MessageQueue & | operator= (const MessageQueue &other)=delete |
| MessageQueue & | operator= (MessageQueue &&other) |
| cxx::expected< IpcChannelError > | destroy () |
| close and remove message queue. | |
| cxx::expected< IpcChannelError > | send (const std::string &msg) const |
| send a message to queue using std::string. More... | |
| cxx::expected< std::string, IpcChannelError > | receive () const |
| receive message from queue using std::string. More... | |
| cxx::expected< std::string, IpcChannelError > | timedReceive (const units::Duration &timeout) const |
| try to receive message from queue for a given timeout duration using std::string. Only defined for NON_BLOCKING == false. More... | |
| cxx::expected< IpcChannelError > | timedSend (const std::string &msg, const units::Duration &timeout) const |
| try to send a message to the queue for a given timeout duration using std::string | |
| cxx::expected< bool, IpcChannelError > | isOutdated () |
Public Member Functions inherited from DesignPattern::Creation< MessageQueue, IpcChannelError > | |
| Creation (Creation &&rhs) noexcept | |
| Creation (const Creation &rhs) noexcept=default | |
| Creation & | operator= (Creation &&rhs) noexcept |
| Creation & | operator= (const Creation &rhs) noexcept=default |
| bool | isInitialized () const noexcept |
| returns true if the object was constructed successfully, otherwise false | |
Static Public Member Functions | |
| static cxx::expected< bool, IpcChannelError > | unlinkIfExists (const IpcChannelName_t &name) |
Static Public Member Functions inherited from DesignPattern::Creation< MessageQueue, IpcChannelError > | |
| static result_t | create (Targs &&... args) noexcept |
| factory method which guarantees that either a working object is produced or an error value describing the error during construction More... | |
| static result_t | verify (MessageQueue &&newObject) noexcept |
| verifies if a class was created successfully More... | |
| static iox::cxx::expected< IpcChannelError > | placementCreate (void *const memory, Targs &&... args) noexcept |
| factory method which guarantees that either a working object is produced or an error value describing the error during construction More... | |
Friends | |
| class | DesignPattern::Creation< MessageQueue, IpcChannelError > |
| for calling private constructor in create method | |
Additional Inherited Members | |
Public Types inherited from DesignPattern::Creation< MessageQueue, IpcChannelError > | |
| using | CreationPattern_t = Creation< MessageQueue, IpcChannelError > |
| using | result_t = iox::cxx::expected< MessageQueue, IpcChannelError > |
| using | errorType_t = IpcChannelError |
Protected Attributes inherited from DesignPattern::Creation< MessageQueue, IpcChannelError > | |
| bool | m_isInitialized |
| IpcChannelError | m_errorValue |
Wrapper class for posix message queue.
| NON_BLOCKING | specifies the type of message queue. A non-blocking message queue will immediately return from a send/receive call if the queue is full/empty. A blocking message has member functions timedSend and timedReceive which allow to specify a maximum timeout duration. auto mq = posix::MessageQueue<true>::CreateMessageQueue("/MqName123");
if (mq.has_value())
{
mq->send("important message, bla.");
// ...
std::string str;
mq->receive(str);
}
|
| iox::posix::MessageQueue::MessageQueue | ( | ) |
default constructor. The result is an invalid MessageQueue object which can be reassigned later by using the move constructor.
| cxx::expected<std::string, IpcChannelError> iox::posix::MessageQueue::receive | ( | ) | const |
receive message from queue using std::string.
| cxx::expected<IpcChannelError> iox::posix::MessageQueue::send | ( | const std::string & | msg | ) | const |
send a message to queue using std::string.
| cxx::expected<std::string, IpcChannelError> iox::posix::MessageQueue::timedReceive | ( | const units::Duration & | timeout | ) | const |
try to receive message from queue for a given timeout duration using std::string. Only defined for NON_BLOCKING == false.