Skip to content

iox::runtime::IpcInterfaceUser🔗

Class for using a IPC channel.

#include <ipc_interface_user.hpp>

Inherits from iox::runtime::IpcInterfaceBase

Public Functions🔗

Name
IpcInterfaceUser(const RuntimeName_t & name, const uint64_t maxMessages =APP_MAX_MESSAGES, const uint64_t messageSize =APP_MESSAGE_SIZE)
Constructs a IpcInterfaceUser and opens a IPC channel. Therefore, isInitialized should always be called before using this class.
IpcInterfaceUser(const IpcInterfaceUser & )
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 & )
IpcInterfaceUser(IpcInterfaceUser && )
Not needed therefore deleted.
IpcInterfaceUser & operator=(IpcInterfaceUser && )

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 IpcInterfaceCreator
class IpcRuntimeInterface

Public Functions Documentation🔗

function IpcInterfaceUser🔗

IpcInterfaceUser(
    const RuntimeName_t & name,
    const uint64_t maxMessages =APP_MAX_MESSAGES,
    const uint64_t messageSize =APP_MESSAGE_SIZE
)

Constructs a IpcInterfaceUser and opens a IPC channel. 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 IpcInterfaceUser🔗

IpcInterfaceUser(
    const IpcInterfaceUser & 
)

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.

function operator=🔗

IpcInterfaceUser & operator=(
    const IpcInterfaceUser & 
)

function IpcInterfaceUser🔗

IpcInterfaceUser(
    IpcInterfaceUser && 
)

Not needed therefore deleted.

function operator=🔗

IpcInterfaceUser & operator=(
    IpcInterfaceUser && 
)

Updated on 31 May 2022 at 15:29:16 CEST