SObjectizer-5 Extra
Loading...
Searching...
No Matches
unique_subscribers.hpp
Go to the documentation of this file.
1/*!
2 * \file
3 * \brief Implementation of unique_subscribers mbox.
4 *
5 * \since
6 * v.1.5.0
7 */
8
9#pragma once
10
11#include <so_5/version.hpp>
12
13#if SO_5_VERSION < SO_5_VERSION_MAKE(5u, 8u, 0u)
14#error "SObjectizer-5.8.0 of newest is required"
15#endif
16
17#include <so_5/unique_subscribers_mbox.hpp>
18
19#include <so_5_extra/error_ranges.hpp>
20
21#include <memory>
22#include <tuple>
23#include <utility>
24
25namespace so_5 {
26
27namespace extra {
28
29namespace mboxes {
30
32
33namespace errors {
34
35/*!
36 * \brief An attempt to make another subscription to the same message type.
37 *
38 * This error is reported when there is an existing subscription to
39 * the same message type. And this subscription is made for another agent.
40 *
41 * \deprecated Since v.1.6.0 there is no such error code.
42 *
43 * \since
44 * v.1.5.0
45 */
48
49/*!
50 * \brief An attempt to set a delivery filter.
51 *
52 * \deprecated Since v.1.5.1 delivery filters are supported by
53 * unique_subscribers mbox.
54 *
55 * \since v.1.5.0
56 */
57[[deprecated]]
60
61} /* namespace errors */
62
63//
64// make_mbox
65//
66/*!
67 * \brief Factory function for creation of a new instance of unique_subscribers
68 * mbox.
69 *
70 * Usage examples:
71 *
72 * Create a mbox with std::mutex as Lock_Type (this mbox can safely be
73 * used in multi-threaded environments):
74 * \code
75 * so_5::environment_t & env = ...;
76 * auto mbox = so_5::extra::mboxes::unique_subscribers::make_mbox(env);
77 * \endcode
78 *
79 * Create a mbox with so_5::null_mutex_t as Lock_Type (this mbox can only
80 * be used in single-threaded environments):
81 * \code
82 * so_5::environment_t & env = ...;
83 * auto mbox = so_5::extra::mboxes::unique_subscribers::make_mbox<so_5::null_mutex_t>(env);
84 * \endcode
85 *
86 * \tparam Lock_Type type of lock to be used for thread safety. It can be
87 * std::mutex or so_5::null_mutex_t (or any other type which can be used
88 * with std::lock_quard).
89 *
90 * \deprecated Since v.1.6.0 it's just a synonum for so_5::make_unique_subscribers_mbox().
91 * This function is kept here for compatibility reasons. It will be removed in
92 * some future release of so5extra.
93 *
94 * \since v.1.5.0
95 */
96template<
97 typename Lock_Type = std::mutex >
98[[nodiscard]][[deprecated("Use so_5::make_unique_subscribers_mbox() instead")]]
104
105} /* namespace unique_subscribers */
106
107} /* namespace mboxes */
108
109} /* namespace extra */
110
111} /* namespace so_5 */
const int mboxes_unique_subscribers_errors
Starting point for errors of mboxes::unique_subscribers submodule.
const int rc_subscription_exists
An attempt to make another subscription to the same message type.
const int rc_delivery_filters_not_supported
An attempt to set a delivery filter.
mbox_t make_mbox(so_5::environment_t &env)
Factory function for creation of a new instance of unique_subscribers mbox.
Ranges for error codes of each submodules.
Definition details.hpp:13