5#ifndef YAMICPP_VALUE_PUBLISHER_H_INCLUDED
6#define YAMICPP_VALUE_PUBLISHER_H_INCLUDED
8#include "incoming_message_generic_dispatcher.h"
9#include "value_publisher_overflow_generic_dispatcher.h"
10#include <yami4-core/dll.h>
21class incoming_message;
26class value_publisher_impl;
66 template <
typename functor>
69 user_command_handler_.reset(
71 init(user_command_handler_.get());
92 template <
typename incoming_message_functor,
93 typename queue_overflow_functor>
95 std::size_t max_queue_length, queue_overflow_functor & qof)
97 user_command_handler_.reset(
99 incoming_message_functor>(f));
100 user_overflow_handler_.reset(
102 queue_overflow_functor>(qof));
103 init(user_command_handler_.get(),
104 max_queue_length, user_overflow_handler_.get());
114 const std::string & object_name);
129 const std::string & destination_object);
154 std::vector<std::pair<std::string, std::string> >
163 std::size_t max_queue_length = 1,
166 details::value_publisher_impl * pimpl_;
168 std::unique_ptr<details::incoming_message_dispatcher_base>
169 user_command_handler_;
170 std::unique_ptr<details::value_publisher_overflow_dispatcher_base>
171 user_overflow_handler_;
Message broker.
Definition: agent.h:45
Definition: incoming_message_dispatcher_base.h:20
Definition: incoming_message_generic_dispatcher.h:23
Definition: value_publisher_overflow_dispatcher_base.h:21
Definition: value_publisher_overflow_generic_dispatcher.h:20
Common interface for serializable data source.
Definition: serializable.h:21
Simple subscription publisher.
Definition: value_publisher.h:36
value_publisher(incoming_message_functor &f, std::size_t max_queue_length, queue_overflow_functor &qof)
Constructor.
Definition: value_publisher.h:94
value_publisher()
Constructor.
void publish(const serializable &value, std::size_t priority=0)
Publishes the new value.
void unregister()
Unregisters the publisher from its associated agent.
void unsubscribe(const std::string &destination_target)
Unsubscribes the given listener.
void register_at(agent &controlling_agent, const std::string &object_name)
Registers the publisher at the given agent.
value_publisher(functor &f)
Constructor.
Definition: value_publisher.h:67
~value_publisher()
Destructor.
std::vector< std::pair< std::string, std::string > > get_subscribers() const
Returns the information about all active subscribers.
void subscribe(const std::string &destination_target, const std::string &destination_object)
Subscribes the new listener.
std::size_t get_number_of_subscribers() const
Returns the number of active subscribers.
Namespace devoted to everything related to YAMI4.
Definition: agent.h:21