Class for using a IPC channel.
More...
#include <ipc_interface_user.hpp>
|
| IpcInterfaceUser (const RuntimeName_t &name, const uint64_t maxMessages=APP_MAX_MESSAGES, const uint64_t messageSize=APP_MESSAGE_SIZE) noexcept |
| Constructs a IpcInterfaceUser and opens a IPC channel. Therefore, isInitialized should always be called before using this class. More...
|
|
| IpcInterfaceUser (const IpcInterfaceUser &)=delete |
| The copy constructor and assignment operator are deleted since this class manages a resource (IPC channel) which cannot be copied. Since move is not needed it is also deleted.
|
|
IpcInterfaceUser & | operator= (const IpcInterfaceUser &)=delete |
|
| IpcInterfaceUser (IpcInterfaceUser &&)=delete |
| Not needed therefore deleted.
|
|
IpcInterfaceUser & | operator= (IpcInterfaceUser &&)=delete |
|
bool | receive (IpcMessage &answer) const noexcept |
| Receives a message from the IPC channel and stores it in answer. More...
|
|
bool | timedReceive (const units::Duration timeout, IpcMessage &answer) const noexcept |
| Tries to receive a message from the IPC channel within a specified timeout. It stores the message in answer. More...
|
|
bool | send (const IpcMessage &msg) const noexcept |
| Tries to send the message specified in msg. More...
|
|
bool | timedSend (const IpcMessage &msg, const units::Duration timeout) const noexcept |
| Tries to send the message specified in msg to the message queue within a specified timeout. More...
|
|
const RuntimeName_t & | getRuntimeName () const noexcept |
| Returns the interface name, the unique char string which explicitly identifies the IPC channel. More...
|
|
bool | isInitialized () const noexcept |
| If the IPC channel could not be opened or linked in the constructor it will return false, otherwise true. This is needed since the constructor is not allowed to throw an exception. You should always check a IPC channel with isInitialized before using it, since all other methods will fail and return false if a message could not be successfully initialized. More...
|
|
|
static void | cleanupOutdatedIpcChannel (const RuntimeName_t &name) noexcept |
| Since there might be an outdated IPC channel due to an unclean temination this function closes the IPC channel if it's existing. More...
|
|
bool | reopen () noexcept |
| Closes and opens an existing IPC channel using the same parameters as before. If the queue was not open, it is just openened. More...
|
|
bool | ipcChannelMapsToFile () noexcept |
| Checks if the IPC channel has its counterpart in the file system. More...
|
|
| IpcInterfaceBase ()=delete |
| The default constructor is explicitly deleted since every IPC channel needs a unique string to be identified with.
|
|
| IpcInterfaceBase (const RuntimeName_t &runtimeName, const uint64_t maxMessages, const uint64_t messageSize) noexcept |
|
| IpcInterfaceBase (const IpcInterfaceBase &)=delete |
| delete copy and move ctor and assignment since they are not needed
|
|
| IpcInterfaceBase (IpcInterfaceBase &&)=delete |
|
IpcInterfaceBase & | operator= (const IpcInterfaceBase &)=delete |
|
IpcInterfaceBase & | operator= (IpcInterfaceBase &&)=delete |
|
bool | openIpcChannel (const posix::IpcChannelSide channelSide) noexcept |
| Opens a IPC channel and default permissions stored in m_perms and stores the descriptor. More...
|
|
bool | closeIpcChannel () noexcept |
| Closes a IPC channel. More...
|
|
bool | hasClosableIpcChannel () const noexcept |
| If a IPC channel was moved then m_runtimeName was cleared and this object gave up the control of that specific IPC channel and therefore shouldnt unlink or close it. Otherwise the object which it was moved to can end up with an invalid IPC channel descriptor. More...
|
|
static bool | setMessageFromString (const char *buffer, IpcMessage &answer) noexcept |
| Set the content of answer from buffer. More...
|
|
RuntimeName_t | m_runtimeName |
|
uint64_t | m_maxMessageSize {0U} |
|
uint64_t | m_maxMessages {0U} |
|
iox::posix::IpcChannelSide | m_channelSide {posix::IpcChannelSide::CLIENT} |
|
IpcChannelType | m_ipcChannel |
|
Class for using a IPC channel.
◆ IpcInterfaceUser()
iox::runtime::IpcInterfaceUser::IpcInterfaceUser |
( |
const RuntimeName_t & |
name, |
|
|
const uint64_t |
maxMessages = APP_MAX_MESSAGES , |
|
|
const uint64_t |
messageSize = APP_MESSAGE_SIZE |
|
) |
| |
|
noexcept |
Constructs a IpcInterfaceUser and opens a IPC channel. Therefore, isInitialized should always be called before using this class.
- Parameters
-
[in] | name | Unique identifier of the IPC channel |
[in] | maxMessages | maximum number of queued messages |
[in] | message | size maximum message size |
The documentation for this class was generated from the following file: