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> 32 #ifdef YAMI4_WITH_NETX 34 #endif // YAMI4_WITH_NETX 39 class value_publisher;
80 #ifdef YAMI4_WITH_NETX 81 void set_netx_context(NX_IP * ip, NX_PACKET_POOL * packet_pool);
86 #endif // YAMI4_WITH_NETX 118 std::string add_listener(
const std::string & listener);
127 void remove_listener(
const std::string & listener);
139 template <
typename functor>
142 std::unique_ptr<details::incoming_message_dispatcher_base> object(
143 new details::incoming_message_generic_dispatcher<functor>(f));
145 pimpl_base_->register_object(object_name,
object);
148 void register_raw_object(
const std::string & object_name,
157 void register_value_publisher(
const std::string & object_name,
180 void unregister_object(
const std::string & object_name);
192 void open_connection(
const std::string & target);
207 void open_connection(
const std::string & target,
234 std::unique_ptr<outgoing_message> send(
235 const std::string & target,
236 const std::string & object_name,
237 const std::string & message_name,
239 std::size_t priority = 0,
240 bool auto_connect =
true);
251 const std::string & target,
252 const std::string & object_name,
253 const std::string & message_name,
255 std::size_t priority = 0,
256 bool auto_connect =
true);
268 template <
typename functor>
271 const std::string & target,
272 const std::string & object_name,
273 const std::string & message_name,
275 std::size_t priority = 0,
276 bool auto_connect =
true)
278 std::unique_ptr<details::outgoing_message_dispatcher_base>
279 outgoing_message_callback(
280 new details::outgoing_message_generic_dispatcher<functor>(f));
282 return pimpl_base_->send(outgoing_message_callback,
283 target, object_name, message_name,
284 content, priority, auto_connect);
294 bool clean_outgoing_message_callback(outgoing_message_id
id);
302 void send_one_way(
const std::string & target,
303 const std::string & object_name,
304 const std::string & message_name,
306 std::size_t priority = 0,
307 bool auto_connect =
true);
326 void close_connection(
const std::string & target,
327 std::size_t priority = 0);
338 void hard_close_connection(
const std::string & target);
352 template <
typename functor>
355 std::unique_ptr<details::connection_event_dispatcher_base> monitor(
356 new details::connection_event_generic_dispatcher<functor>(f));
358 pimpl_base_->register_connection_event_monitor(monitor);
373 template <
typename functor>
376 std::unique_ptr<details::io_error_dispatcher_base> logger(
377 new details::io_error_generic_dispatcher<functor>(f));
379 pimpl_base_->register_io_error_logger(logger);
393 void get_outgoing_flow_state(std::size_t & current_level,
394 std::size_t & high_water_mark, std::size_t & low_water_mark)
const;
405 void get_channel_usage(std::size_t & max_allowed, std::size_t & used);
411 std::size_t get_pending_outgoing_bytes(
const std::string & target);
436 void run_dispatcher(std::size_t dispatcher_index);
440 void operator=(
const agent &);
442 details::agent_impl * pimpl_;
443 details::agent_impl_base * pimpl_base_;
448 #endif // YAMICPP_AGENT_H_INCLUDED Incoming message.
Definition: incoming_message.h:48
Message broker.
Definition: agent.h:60
Event notification callback interface.
Definition: event_callback.h:37
long long outgoing_message_id
Outgoing message identifier type.
Definition: agent.h:65
void register_object(const std::string &object_name, functor &f)
Registers the new logical destination object.
Definition: agent.h:140
Collection of message parameters.
Definition: parameters.h:71
Namespace devoted to everything related to YAMI4.
Definition: activity_statistics_monitor.h:23
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:353
void register_io_error_logger(functor &f)
Registers the logger for I/O errors.
Definition: agent.h:374
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:269
Simple subscription publisher.
Definition: value_publisher.h:47