17 #ifndef YAMICPP_VALUE_PUBLISHER_H_INCLUDED 18 #define YAMICPP_VALUE_PUBLISHER_H_INCLUDED 20 #include "incoming_message_generic_dispatcher.h" 21 #include "value_publisher_overflow_generic_dispatcher.h" 22 #include <yami4-core/dll.h> 33 class incoming_message;
38 class value_publisher_impl;
78 template <
typename functor>
81 user_command_handler_.reset(
82 new details::incoming_message_generic_dispatcher<functor>(f));
83 init(user_command_handler_.get());
104 template <
typename incoming_message_functor,
105 typename queue_overflow_functor>
107 std::size_t max_queue_length, queue_overflow_functor & qof)
109 user_command_handler_.reset(
110 new details::incoming_message_generic_dispatcher<
111 incoming_message_functor>(f));
112 user_overflow_handler_.reset(
113 new details::value_publisher_overflow_generic_dispatcher<
114 queue_overflow_functor>(qof));
115 init(user_command_handler_.get(),
116 max_queue_length, user_overflow_handler_.get());
125 void register_at(
agent & controlling_agent,
126 const std::string & object_name);
140 void subscribe(
const std::string & destination_target,
141 const std::string & destination_object);
146 void unsubscribe(
const std::string & destination_target);
156 void publish(
const serializable & value, std::size_t priority = 0);
159 std::size_t get_number_of_subscribers()
const;
166 std::vector<std::pair<std::string, std::string> >
167 get_subscribers()
const;
174 void init(details::incoming_message_dispatcher_base * imd = NULL,
175 std::size_t max_queue_length = 1,
176 details::value_publisher_overflow_dispatcher_base * qod = NULL);
178 details::value_publisher_impl * pimpl_;
180 std::unique_ptr<details::incoming_message_dispatcher_base>
181 user_command_handler_;
182 std::unique_ptr<details::value_publisher_overflow_dispatcher_base>
183 user_overflow_handler_;
188 #endif // YAMICPP_VALUE_PUBLISHER_H_INCLUDED Message broker.
Definition: agent.h:56
value_publisher(functor &f)
Constructor.
Definition: value_publisher.h:79
value_publisher(incoming_message_functor &f, std::size_t max_queue_length, queue_overflow_functor &qof)
Constructor.
Definition: value_publisher.h:106
Namespace devoted to everything related to YAMI4.
Definition: activity_statistics_monitor.cpp:27
Common interface for serializable data source.
Definition: serializable.h:32
Simple subscription publisher.
Definition: value_publisher.h:47