iox::posix::NamedPipe🔗
Inherits from DesignPattern::Creation< NamedPipe, IpcChannelError >
Public Types🔗
Name | |
---|---|
using cxx::string< MAX_MESSAGE_SIZE > | Message_t |
using concurrent::LockFreeQueue< Message_t, MAX_NUMBER_OF_MESSAGES > | MessageQueue_t |
Public Functions🔗
Name | |
---|---|
NamedPipe(const NamedPipe & ) | |
NamedPipe & | operator=(const NamedPipe & ) |
NamedPipe() For compatibility with IpcChannel alias, default ctor which creates an uninitialized NamedPipe. |
|
NamedPipe(NamedPipe && rhs) | |
NamedPipe & | operator=(NamedPipe && rhs) |
~NamedPipe() | |
cxx::expected< IpcChannelError > | destroy() destroys an initialized named pipe. |
cxx::expected< bool, IpcChannelError > | isOutdated() for compatibility with IpcChannelError |
cxx::expected< IpcChannelError > | trySend(const std::string & message) const tries to send a message via the named pipe. if the pipe is full IpcChannelError::TIMEOUT is returned |
cxx::expected< IpcChannelError > | send(const std::string & message) const sends a message via the named pipe. if the pipe is full this call is blocking until the message could be delivered |
cxx::expected< IpcChannelError > | timedSend(const std::string & message, const units::Duration & timeout) const sends a message via the named pipe. |
cxx::expected< std::string, IpcChannelError > | tryReceive() const tries to receive a message via the named pipe. if the pipe is empty IpcChannelError::TIMEOUT is returned |
cxx::expected< std::string, IpcChannelError > | receive() const receives a message via the named pipe. if the pipe is empty this call is blocking until a message was received |
cxx::expected< std::string, IpcChannelError > | timedReceive(const units::Duration & timeout) const receives a message via the named pipe. |
cxx::expected< bool, IpcChannelError > | unlinkIfExists(const IpcChannelName_t & name) removes a named pipe artifact from the system |
Public Attributes🔗
Name | |
---|---|
constexpr uint64_t | MAX_MESSAGE_SIZE |
constexpr uint64_t | MAX_NUMBER_OF_MESSAGES |
constexpr uint64_t | NULL_TERMINATOR_SIZE |
constexpr units::Duration | CYCLE_TIME |
constexpr const char | NAMED_PIPE_PREFIX |
Friends🔗
Name | |
---|---|
class | DesignPattern::Creation< NamedPipe, IpcChannelError > |
Additional inherited members🔗
Public Types inherited from DesignPattern::Creation< NamedPipe, IpcChannelError >
Name | |
---|---|
using Creation< DerivedClass, ErrorType > | CreationPattern_t |
using iox::cxx::expected< DerivedClass, ErrorType > | result_t |
using ErrorType | errorType_t |
Public Functions inherited from DesignPattern::Creation< NamedPipe, IpcChannelError >
Name | |
---|---|
template <typename... Targs> result_t |
create(Targs &&... args) factory method which guarantees that either a working object is produced or an error value describing the error during construction |
result_t | verify(DerivedClass && newObject) verifies if a class was created successfully |
template <typename... Targs> iox::cxx::expected< ErrorType > |
placementCreate(void *const memory, Targs &&... args) factory method which guarantees that either a working object is produced or an error value describing the error during construction |
Creation() =default | |
Creation(Creation && rhs) | |
Creation(const Creation & rhs) =default | |
bool | isInitialized() const returns true if the object was constructed successfully, otherwise false |
Protected Attributes inherited from DesignPattern::Creation< NamedPipe, IpcChannelError >
Name | |
---|---|
bool | m_isInitialized |
ErrorType | m_errorValue |
Public Types Documentation🔗
using Message_t🔗
using iox::posix::NamedPipe::Message_t = cxx::string<MAX_MESSAGE_SIZE>;
using MessageQueue_t🔗
using iox::posix::NamedPipe::MessageQueue_t = concurrent::LockFreeQueue<Message_t, MAX_NUMBER_OF_MESSAGES>;
Public Functions Documentation🔗
function NamedPipe🔗
NamedPipe(
const NamedPipe &
)
function operator=🔗
NamedPipe & operator=(
const NamedPipe &
)
function NamedPipe🔗
NamedPipe()
For compatibility with IpcChannel alias, default ctor which creates an uninitialized NamedPipe.
function NamedPipe🔗
NamedPipe(
NamedPipe && rhs
)
function operator=🔗
NamedPipe & operator=(
NamedPipe && rhs
)
function ~NamedPipe🔗
~NamedPipe()
function destroy🔗
cxx::expected< IpcChannelError > destroy()
destroys an initialized named pipe.
Return: is always successful
function isOutdated🔗
cxx::expected< bool, IpcChannelError > isOutdated()
for compatibility with IpcChannelError
Return: always false
function trySend🔗
cxx::expected< IpcChannelError > trySend(
const std::string & message
) const
tries to send a message via the named pipe. if the pipe is full IpcChannelError::TIMEOUT is returned
Return: on failure an error which describes the failure
function send🔗
cxx::expected< IpcChannelError > send(
const std::string & message
) const
sends a message via the named pipe. if the pipe is full this call is blocking until the message could be delivered
Parameters:
- message the message which should be sent, is not allowed to be longer then MAX_MESSAGE_SIZE
Return: success when message was sent otherwise an error which describes the failure
function timedSend🔗
cxx::expected< IpcChannelError > timedSend(
const std::string & message,
const units::Duration & timeout
) const
sends a message via the named pipe.
Parameters:
- message the message which should be sent, is not allowed to be longer then MAX_MESSAGE_SIZE
- timeout the timeout on how long this method should retry to send the message
Return: success when message was sent otherwise an error which describes the failure
function tryReceive🔗
cxx::expected< std::string, IpcChannelError > tryReceive() const
tries to receive a message via the named pipe. if the pipe is empty IpcChannelError::TIMEOUT is returned
Return: on success a string containing the message, otherwise an error which describes the failure
function receive🔗
cxx::expected< std::string, IpcChannelError > receive() const
receives a message via the named pipe. if the pipe is empty this call is blocking until a message was received
Return: on success a string containing the message, otherwise an error which describes the failure
function timedReceive🔗
cxx::expected< std::string, IpcChannelError > timedReceive(
const units::Duration & timeout
) const
receives a message via the named pipe.
Parameters:
- timeout the timeout on how long this method should retry to receive a message
Return: on success a string containing the message, otherwise an error which describes the failure
function unlinkIfExists🔗
static cxx::expected< bool, IpcChannelError > unlinkIfExists(
const IpcChannelName_t & name
)
removes a named pipe artifact from the system
Return: true if the artifact was removed, false when no artifact was found and IpcChannelError::INTERNAL_LOGIC_ERROR when shm_unlink failed
Public Attributes Documentation🔗
variable MAX_MESSAGE_SIZE🔗
static constexpr uint64_t MAX_MESSAGE_SIZE = 4U * 1024U;
variable MAX_NUMBER_OF_MESSAGES🔗
static constexpr uint64_t MAX_NUMBER_OF_MESSAGES = 10U;
variable NULL_TERMINATOR_SIZE🔗
static constexpr uint64_t NULL_TERMINATOR_SIZE = 0U;
variable CYCLE_TIME🔗
static constexpr units::Duration CYCLE_TIME = units::Duration::fromMilliseconds(10);
variable NAMED_PIPE_PREFIX🔗
static constexpr const char NAMED_PIPE_PREFIX = "iox_np_";
Friends🔗
friend DesignPattern::Creation< NamedPipe, IpcChannelError >🔗
friend class DesignPattern::Creation< NamedPipe, IpcChannelError >(
DesignPattern::Creation< NamedPipe, IpcChannelError >
);
Updated on 17 March 2022 at 12:15:57 CET