17 #ifndef YAMICPP_AGENT_H_INCLUDED 18 #define YAMICPP_AGENT_H_INCLUDED 20 #include "agent_impl_base.h" 21 #include "connection_event_generic_dispatcher.h" 22 #include "event_callback.h" 23 #include "incoming_message_generic_dispatcher.h" 24 #include "io_error_generic_dispatcher.h" 25 #include "outgoing_message.h" 26 #include "outgoing_message_generic_dispatcher.h" 27 #include "parameters.h" 28 #include <yami4-core/dll.h> 35 class value_publisher;
106 std::string add_listener(
const std::string & listener);
115 void remove_listener(
const std::string & listener);
127 template <
typename functor>
130 std::unique_ptr<details::incoming_message_dispatcher_base> object(
131 new details::incoming_message_generic_dispatcher<functor>(f));
133 pimpl_base_->register_object(object_name,
object);
136 void register_raw_object(
const std::string & object_name,
145 void register_value_publisher(
const std::string & object_name,
168 void unregister_object(
const std::string & object_name);
180 void open_connection(
const std::string & target);
195 void open_connection(
const std::string & target,
222 std::unique_ptr<outgoing_message> send(
223 const std::string & target,
224 const std::string & object_name,
225 const std::string & message_name,
227 std::size_t priority = 0,
228 bool auto_connect =
true);
239 const std::string & target,
240 const std::string & object_name,
241 const std::string & message_name,
243 std::size_t priority = 0,
244 bool auto_connect =
true);
256 template <
typename functor>
259 const std::string & target,
260 const std::string & object_name,
261 const std::string & message_name,
263 std::size_t priority = 0,
264 bool auto_connect =
true)
266 std::unique_ptr<details::outgoing_message_dispatcher_base>
267 outgoing_message_callback(
268 new details::outgoing_message_generic_dispatcher<functor>(f));
270 return pimpl_base_->send(outgoing_message_callback,
271 target, object_name, message_name,
272 content, priority, auto_connect);
282 bool clean_outgoing_message_callback(outgoing_message_id
id);
290 void send_one_way(
const std::string & target,
291 const std::string & object_name,
292 const std::string & message_name,
294 std::size_t priority = 0,
295 bool auto_connect =
true);
314 void close_connection(
const std::string & target,
315 std::size_t priority = 0);
326 void hard_close_connection(
const std::string & target);
340 template <
typename functor>
343 std::unique_ptr<details::connection_event_dispatcher_base> monitor(
344 new details::connection_event_generic_dispatcher<functor>(f));
346 pimpl_base_->register_connection_event_monitor(monitor);
361 template <
typename functor>
364 std::unique_ptr<details::io_error_dispatcher_base> logger(
365 new details::io_error_generic_dispatcher<functor>(f));
367 pimpl_base_->register_io_error_logger(logger);
381 void get_outgoing_flow_state(std::size_t & current_level,
382 std::size_t & high_water_mark, std::size_t & low_water_mark)
const;
393 void get_channel_usage(
int & max_allowed,
int & used);
399 std::size_t get_pending_outgoing_bytes(
const std::string & target);
403 void operator=(
const agent &);
405 details::agent_impl * pimpl_;
406 details::agent_impl_base * pimpl_base_;
411 #endif // YAMICPP_AGENT_H_INCLUDED Incoming message.
Definition: incoming_message.h:48
Message broker.
Definition: agent.h:56
Event notification callback interface.
Definition: event_callback.h:37
long long outgoing_message_id
Outgoing message identifier type.
Definition: agent.h:61
void register_object(const std::string &object_name, functor &f)
Registers the new logical destination object.
Definition: agent.h:128
Collection of message parameters.
Definition: parameters.h:71
Namespace devoted to everything related to YAMI4.
Definition: activity_statistics_monitor.cpp:27
Common interface for serializable data source.
Definition: serializable.h:32
Outgoing message.
Definition: outgoing_message.h:44
void register_connection_event_monitor(functor &f)
Registers the monitor for connection-related events.
Definition: agent.h:341
void register_io_error_logger(functor &f)
Registers the logger for I/O errors.
Definition: agent.h:362
outgoing_message_id send(functor &f, const std::string &target, const std::string &object_name, const std::string &message_name, const serializable &content=parameters(), std::size_t priority=0, bool auto_connect=true)
Sends the outgoing message.
Definition: agent.h:257
Simple subscription publisher.
Definition: value_publisher.h:47