OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::msgbus::posix_mqueue Class Reference

Class wrapping a POSIX message queue. More...

#include <eagine/message_bus/posix_mqueue.hpp>

Public Types

using receive_handler = callable_ref< void(unsigned, span< const char >)>
 Alias for received message handler. More...
 

Public Member Functions

constexpr posix_mqueue () noexcept=default
 Default constructor.
 
 posix_mqueue (posix_mqueue &&temp) noexcept
 Move constructible.
 
 posix_mqueue (const posix_mqueue &)=delete
 Not copy constructible.
 
auto operator= (posix_mqueue &&temp)=delete
 Not move assignable.
 
auto operator= (const posix_mqueue &)=delete
 Not copy assignable.
 
auto get_name () const noexcept -> string_view
 Returns the unique name of this queue. More...
 
auto set_name (std::string name) -> auto &
 Sets the unique name of the queue. More...
 
auto set_name (identifier id) -> auto &
 Sets the unique name of the queue. More...
 
 posix_mqueue (std::string name)
 Constructs the queue and sets the specified name. More...
 
auto error_message () const -> std::string
 Returns the error message of the last failed operation. More...
 
auto had_error () const -> bool
 Indicates if there a previous operation finished with an error. More...
 
auto needs_retry () const -> bool
 Indicates if a previous operation on the queue needs to be retried. More...
 
constexpr auto is_open () const noexcept -> bool
 Indicates if this message queue is open. More...
 
constexpr auto is_usable () const noexcept -> bool
 Indicates if this message queue can be used. More...
 
auto unlink () -> auto &
 Unlinks the OS queue objects. More...
 
auto create () -> auto &
 Creates new OS queue objects. More...
 
auto open () -> auto &
 Opens existing OS queue objects. More...
 
auto close () -> posix_mqueue &
 Closes the OS queue objects. More...
 
auto max_data_size () -> valid_if_positive< span_size_t >
 Returns the absolute maximum block size that can be sent in a message. More...
 
auto data_size () noexcept -> span_size_t
 Returns the maximum block size that can be sent in a message.
 
auto send (unsigned priority, span< const char > blk) -> auto &
 Sents a block of data with the specified priority.
 
auto receive (memory::span< char > blk, receive_handler handler) -> auto &
 Receives messages and calls the specified handler on them.
 

Detailed Description

Class wrapping a POSIX message queue.

Member Typedef Documentation

◆ receive_handler

using eagine::msgbus::posix_mqueue::receive_handler = callable_ref<void(unsigned, span<const char>)>

Alias for received message handler.

See also
receive

Constructor & Destructor Documentation

◆ posix_mqueue()

eagine::msgbus::posix_mqueue::posix_mqueue ( std::string  name)
inline

Constructs the queue and sets the specified name.

See also
set_name

Member Function Documentation

◆ close()

auto eagine::msgbus::posix_mqueue::close ( ) -> posix_mqueue&
inline

Closes the OS queue objects.

See also
create
open
unlink

◆ create()

auto eagine::msgbus::posix_mqueue::create ( ) -> auto&
inline

Creates new OS queue objects.

See also
unlink
open
close

◆ error_message()

auto eagine::msgbus::posix_mqueue::error_message ( ) const -> std::string
inline

Returns the error message of the last failed operation.

See also
had_error

◆ get_name()

auto eagine::msgbus::posix_mqueue::get_name ( ) const -> string_view
inlinenoexcept

Returns the unique name of this queue.

See also
set_name

◆ had_error()

auto eagine::msgbus::posix_mqueue::had_error ( ) const -> bool
inline

Indicates if there a previous operation finished with an error.

See also
error_message
needs_retry

Referenced by is_usable().

◆ is_open()

constexpr auto eagine::msgbus::posix_mqueue::is_open ( ) const -> bool
inlineconstexprnoexcept

Indicates if this message queue is open.

See also
is_usable

Referenced by close(), is_usable(), max_data_size(), receive(), and send().

◆ is_usable()

constexpr auto eagine::msgbus::posix_mqueue::is_usable ( ) const -> bool
inlineconstexprnoexcept

Indicates if this message queue can be used.

See also
is_open
had_error

Referenced by eagine::msgbus::posix_mqueue_connection::is_usable().

◆ max_data_size()

auto eagine::msgbus::posix_mqueue::max_data_size ( ) -> valid_if_positive<span_size_t>
inline

Returns the absolute maximum block size that can be sent in a message.

See also
data_size

Referenced by data_size().

◆ needs_retry()

auto eagine::msgbus::posix_mqueue::needs_retry ( ) const -> bool
inline

Indicates if a previous operation on the queue needs to be retried.

See also
had_error

Referenced by is_usable().

◆ open()

auto eagine::msgbus::posix_mqueue::open ( ) -> auto&
inline

Opens existing OS queue objects.

See also
create
unlink
close

◆ set_name() [1/2]

auto eagine::msgbus::posix_mqueue::set_name ( identifier  id) -> auto&
inline

Sets the unique name of the queue.

See also
get_name

◆ set_name() [2/2]

auto eagine::msgbus::posix_mqueue::set_name ( std::string  name) -> auto&
inline

Sets the unique name of the queue.

See also
get_name

Referenced by eagine::msgbus::posix_mqueue_connection::open(), posix_mqueue(), and set_name().

◆ unlink()

auto eagine::msgbus::posix_mqueue::unlink ( ) -> auto&
inline

Unlinks the OS queue objects.

See also
create
open
close

The documentation for this class was generated from the following file:

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).