iox::runtime::IpcInterfaceCreator🔗
Class for creating and handling a IPC channel. More...
#include <ipc_interface_creator.hpp>
Inherits from iox::runtime::IpcInterfaceBase
Public Functions🔗
Name | |
---|---|
IpcInterfaceCreator(const RuntimeName_t & name, const uint64_t maxMessages =ROUDI_MAX_MESSAGES, const uint64_t messageSize =ROUDI_MESSAGE_SIZE) Constructs a IpcInterfaceCreator and opens a new IPC channel. If it fails isInitialized will return false. Therefore, isInitialized should always be called before using this class. |
|
IpcInterfaceCreator(const IpcInterfaceCreator & ) The copy constructor and assignment operator is deleted since this class manages a resource (IPC channel) which cannot be copied. Move is also not needed, it is also deleted. |
|
IpcInterfaceCreator & | operator=(const IpcInterfaceCreator & ) |
IpcInterfaceCreator(IpcInterfaceCreator && ) Not needed therefore deleted. |
|
IpcInterfaceCreator & | operator=(IpcInterfaceCreator && ) |
Friends🔗
Name | |
---|---|
class | IpcRuntimeInterface |
Additional inherited members🔗
Public Functions inherited from iox::runtime::IpcInterfaceBase
Name | |
---|---|
bool | receive(IpcMessage & answer) const Receives a message from the IPC channel and stores it in answer. |
bool | timedReceive(const units::Duration timeout, IpcMessage & answer) const Tries to receive a message from the IPC channel within a specified timeout. It stores the message in answer. |
bool | send(const IpcMessage & msg) const Tries to send the message specified in msg. |
bool | timedSend(const IpcMessage & msg, const units::Duration timeout) const Tries to send the message specified in msg to the message queue within a specified timeout. |
const RuntimeName_t & | getRuntimeName() const Returns the interface name, the unique char string which explicitly identifies the IPC channel. |
bool | isInitialized() const 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. |
void | cleanupOutdatedIpcChannel(const RuntimeName_t & name) Since there might be an outdated IPC channel due to an unclean temination this function closes the IPC channel if it's existing. |
Protected Functions inherited from iox::runtime::IpcInterfaceBase
Name | |
---|---|
bool | reopen() Closes and opens an existing IPC channel using the same parameters as before. If the queue was not open, it is just openened. |
bool | ipcChannelMapsToFile() Checks if the IPC channel has its counterpart in the file system. |
IpcInterfaceBase() 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) | |
virtual | ~IpcInterfaceBase() =default |
IpcInterfaceBase(const IpcInterfaceBase & ) delete copy and move ctor and assignment since they are not needed |
|
IpcInterfaceBase(IpcInterfaceBase && ) | |
bool | openIpcChannel(const posix::IpcChannelSide channelSide) Opens a IPC channel and default permissions stored in m_perms and stores the descriptor. |
bool | closeIpcChannel() Closes a IPC channel. |
bool | hasClosableIpcChannel() const 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. |
bool | setMessageFromString(const char * buffer, IpcMessage & answer) Set the content of answer from buffer. |
Protected Attributes inherited from iox::runtime::IpcInterfaceBase
Name | |
---|---|
RuntimeName_t | m_runtimeName |
uint64_t | m_maxMessageSize |
uint64_t | m_maxMessages |
iox::posix::IpcChannelSide | m_channelSide |
IpcChannelType | m_ipcChannel |
Friends inherited from iox::runtime::IpcInterfaceBase
Name | |
---|---|
class | IpcInterfaceUser |
Detailed Description🔗
class iox::runtime::IpcInterfaceCreator;
Class for creating and handling a IPC channel.
Note: This class makes sures the IPC channel is created uniquely
Public Functions Documentation🔗
function IpcInterfaceCreator🔗
IpcInterfaceCreator(
const RuntimeName_t & name,
const uint64_t maxMessages =ROUDI_MAX_MESSAGES,
const uint64_t messageSize =ROUDI_MESSAGE_SIZE
)
Constructs a IpcInterfaceCreator and opens a new IPC channel. If it fails isInitialized will return false. Therefore, isInitialized should always be called before using this class.
Parameters:
- name Unique identifier of the IPC channel
- maxMessages maximum number of queued messages
- message size maximum message size
function IpcInterfaceCreator🔗
IpcInterfaceCreator(
const IpcInterfaceCreator &
)
The copy constructor and assignment operator is deleted since this class manages a resource (IPC channel) which cannot be copied. Move is also not needed, it is also deleted.
function operator=🔗
IpcInterfaceCreator & operator=(
const IpcInterfaceCreator &
)
function IpcInterfaceCreator🔗
IpcInterfaceCreator(
IpcInterfaceCreator &&
)
Not needed therefore deleted.
function operator=🔗
IpcInterfaceCreator & operator=(
IpcInterfaceCreator &&
)
Friends🔗
friend IpcRuntimeInterface🔗
friend class IpcRuntimeInterface;
Updated on 31 May 2022 at 15:29:16 CEST