SObjectizer 5.8
Loading...
Searching...
No Matches
message_holder.hpp
Go to the documentation of this file.
1/*
2 SObjectizer 5.
3*/
4
5/*!
6 \file
7 \brief Definition of the template class message_holder.
8
9 \since
10 v.5.6.0
11*/
12
13#pragma once
14
15#include <so_5/message.hpp>
16
17#include <so_5/compiler_features.hpp>
18
19#include <type_traits>
20
21namespace so_5
22{
23
24/*!
25 * \brief Type of ownership of a message instance inside message_holder.
26 *
27 * This type is intended to be used as parameter for message_holder_t
28 * template.
29 *
30 * \since
31 * v.5.6.0
32 */
34 {
35 //! Type of ownership will be automatically detected in dependency
36 //! of message mutability.
38 //! An instance of message_holder should be the unique holder of
39 //! the message instance.
40 //! In that case message_holder will be similar to unique_ptr.
41 unique,
42 //! Several instances of message_holder can own the message instance.
43 //! In that case message_holder will be similar to shared_ptr.
44 shared
45 };
46
47namespace details
48{
49
51{
52
53//! A helper function to get a const raw pointer from smart pointer.
54template< typename M >
55M *
56get_ptr( const intrusive_ptr_t<M> & msg ) noexcept
57 {
58 return msg.get();
59 }
60
61//! A helper function to get a const raw pointer from smart pointer.
62/*!
63 * This overload is for case when M is a user type message.
64 */
65template< typename M >
66M *
67get_ptr( const intrusive_ptr_t< user_type_message_t<M> > & msg ) noexcept
68 {
69 return std::addressof(msg->m_payload);
70 }
71
72/*!
73 * \brief Basic part of message_holder implementations.
74 *
75 * Contains method which should be present in all implementations.
76 *
77 * \since
78 * v.5.6.0
79 */
80template< typename Payload, typename Envelope >
82 {
83 protected :
84 //! Message instance.
85 /*!
86 * Can be empty if the message_holder doens't hold anything
87 * (in that case empty message_holder is an analogue of nullptr).
88 */
90
91 public :
92 using payload_type = Payload;
93 using envelope_type = Envelope;
94
95 basic_message_holder_impl_t() noexcept = default;
96
98 intrusive_ptr_t< Envelope > msg ) noexcept
99 : m_msg{ std::move(msg) }
100 {}
101
102 //! Drops to pointer to the message instance.
103 /*!
104 * The message_holder becomes empty as the result.
105 */
106 void
107 reset() noexcept
108 {
109 m_msg.reset();
110 }
111
112 //! Check for the emptiness of message_holder.
113 [[nodiscard]]
114 bool
115 empty() const noexcept
116 {
117 return !static_cast<bool>( m_msg );
118 }
119
120 //! Check for the non-emptiness of message_holder.
121 [[nodiscard]]
122 operator bool() const noexcept
123 {
124 return !this->empty();
125 }
126
127 //! Check for the emptiness of message_holder.
128 [[nodiscard]]
129 bool operator!() const noexcept
130 {
131 return this->empty();
132 }
133 };
134
135/*!
136 * \brief A part of implementation of message_holder to be used for
137 * shared ownership of message instances.
138 *
139 * This implementation allows copy and move.
140 *
141 * This implementation provides const make_reference() method that
142 * returns a copy of underlying smart pointer.
143 *
144 * \since
145 * v.5.6.0
146 */
147template< typename Payload, typename Envelope >
149 : public basic_message_holder_impl_t<Payload, Envelope>
150 {
151 using direct_base_type = basic_message_holder_impl_t<Payload, Envelope>;
152
153 public :
154 using direct_base_type::direct_base_type;
155
156 //! Make an another reference to the message.
157 /*!
158 * Returns empty smart pointer if message_holder is empty.
159 */
160 [[nodiscard]]
161 intrusive_ptr_t< Envelope >
162 make_reference() const noexcept
163 {
164 return this->m_msg;
165 }
166 };
167
168/*!
169 * \brief A part of implementation of message_holder to be used for
170 * unique ownership of message instances.
171 *
172 * This implementation allows only move operations and disables
173 * copy constructor/operator.
174 *
175 * This implementation provides non-const make_reference() method that
176 * extracts underlying smart pointer and leaves message_holder empty.
177 *
178 * \since
179 * v.5.6.0
180 */
181template< typename Payload, typename Envelope >
183 : public basic_message_holder_impl_t<Payload, Envelope>
184 {
185 using direct_base_type = basic_message_holder_impl_t<Payload, Envelope>;
186
187 public :
188 using direct_base_type::direct_base_type;
189
191 const unique_message_holder_impl_t & ) = delete;
192
194 unique_message_holder_impl_t && ) = default;
195
198 const unique_message_holder_impl_t & ) = delete;
199
202 unique_message_holder_impl_t && ) noexcept = default;
203
204 //! Extracts the smart pointer to the message.
205 /*!
206 * Returns empty smart pointer if message_holder is empty.
207 *
208 * Leaves the message_holder instance empty.
209 */
210 [[nodiscard]]
211 intrusive_ptr_t< Envelope >
212 make_reference() noexcept
213 {
214 return { std::move(this->m_msg) };
215 }
216 };
217
218/*!
219 * \brief A meta-function for selection a base of message_holder implementation
220 * in compile-time.
221 *
222 * If Ownership is message_ownership_t::autodetect then message's mutability
223 * is examined. If message immutable then shared_message_holder_impl_t
224 * will be selected as the base class. For mutable messages
225 * unique_message_holder_impl_t will be used.
226 *
227 * \since
228 * v.5.6.0
229 */
230template<
231 typename Msg,
232 message_ownership_t Ownership >
234 {
235 static_assert( !is_signal<Msg>::value,
236 "Signals can't be used with message_holder" );
237
238 using P = typename message_payload_type< Msg >::payload_type;
239 using E = typename message_payload_type< Msg >::envelope_type;
240
241 using type = std::conditional_t<
243 std::conditional_t<
245 message_mutability_traits<Msg>::mutability,
248 std::conditional_t<
249 message_ownership_t::shared == Ownership,
252 >;
253 };
254
255/*!
256 * \brief Just a shortcut for impl_selector meta-function.
257 *
258 * \since
259 * v.5.6.0
260 */
261template<
262 typename Msg,
263 message_ownership_t Ownership >
264using impl_selector_t = typename impl_selector<Msg, Ownership>::type;
265
266/*!
267 * \brief An of mixin with getters for message_holder.
268 *
269 * It is assumed that shared_message_holder_impl_t or
270 * unique_message_holder_impl_t will be used as Base template parameter.
271 *
272 * \since
273 * v.5.6.0
274 */
275template< typename Base, typename Return_Type >
276class msg_accessors_t : public Base
277 {
278 public :
279 using Base::Base;
280
281 //! Get a pointer to the message inside message_holder.
282 /*!
283 * \attention
284 * Returns nullptr is message_holder is empty.
285 */
286 [[nodiscard]]
287 Return_Type *
288 get() const noexcept
289 {
290 return get_ptr( this->m_msg );
291 }
292
293 //! Get a reference to the message inside message_holder.
294 /*!
295 * \attention
296 * An attempt to use this method on empty message_holder is UB.
297 */
298 [[nodiscard]]
299 Return_Type &
300 operator * () const noexcept { return *get(); }
301
302 //! Get a pointer to the message inside message_holder.
303 /*!
304 * \attention
305 * An attempt to use this method on empty message_holder is UB.
306 */
307 [[nodiscard]]
308 Return_Type *
309 operator->() const noexcept { return get(); }
310 };
311
312/*!
313 * \brief A meta-function for selection of type of accessors mixin.
314 *
315 * \since
316 * v.5.6.0
317 */
318template<
319 message_mutability_t Mutability,
320 typename Base >
322 {
323 using type = std::conditional_t<
325 msg_accessors_t<Base, typename Base::payload_type const>,
326 msg_accessors_t<Base, typename Base::payload_type> >;
327 };
328
329/*!
330 * \brief Just a shortcut for accessor_selector meta-function.
331 *
332 * \since
333 * v.5.6.0
334 */
335template<
336 message_mutability_t Mutability,
337 typename Base >
338using accessor_selector_t =
339 typename accessor_selector<Mutability, Base>::type;
340
341} /* namespace message_holder_details */
342
343} /* namespace details */
344
345/*!
346 * \brief A class for holding an instance of a message.
347 *
348 * \attention
349 * This class should be used with messages only. Signals are not supported
350 * by that class.
351 *
352 * This class is intended for simplification of holding message instances
353 * for some time and resending them later. For example:
354 * \code
355 * class my_actor final : public so_5::agent_t {
356 * // A stored message.
357 * so_5::message_holder_t<my_message> stored_;
358 * ...
359 * void on_message(mhood_t<my_message> cmd) {
360 * // Store message inside the agent.
361 * stored_ = cmd.make_holder();
362 * ...
363 * // Initiate a delayed message to resend the stored message later.
364 * so_5::send_delayed<resend_message>(*this, 10s);
365 * }
366 * ...
367 * void on_resend_message(mhood_t<resend_message>) {
368 * // Resend the stored message.
369 * so_5::send(some_target, stored_);
370 * // The stored message is no more needed.
371 * stored_.reset();
372 *
373 * // Or we can write:
374 * // so_5::send(some_target, std::move(stored_));
375 * }
376 * };
377 * \endcode
378 * This class is also intended to be used with preallocated messages:
379 * \code
380 * class prealloc_msg_demo final : public so_5::agent_t {
381 * so_5::message_holder_t<request> request_;
382 * ...
383 * prealloc_msg_demo(
384 * context_t ctx,
385 * ... // Some other params.
386 * ) : request_{std::piecewise_construct, ...} // Preallocation of message.
387 * {}
388 *
389 * void on_some_event(...) {
390 * ...
391 * // It is time to send preallocated message.
392 * so_5::send(some_target, request_);
393 * ...
394 * }
395 * };
396 * \endcode
397 *
398 * The main benefit of that class is the ability to correctly handle
399 * messages of arbitrary user types (e.g. messages not derived from
400 * so_5::message_t class) and mutability flags. For example, the following
401 * cases are correctly handled by message_holder_t:
402 * \code
403 * struct status_data { // This is message that is not derived from so_5::message_t.
404 * ... // Some fields.
405 * };
406 *
407 * so_5::message_holder_t<status_data> msg1;
408 * so_5::message_holder_t<so_5::immutable_msg<status_data>> msg2;
409 * so_5::message_holder_t<so_5::mutable_msg<status_data>> msg3;
410 * \endcode
411 *
412 * This is an example of how immutable and mutable preallocated messages
413 * can be used with message_holder_t:
414 * \code
415 * class preallocated_messages_owner final : public so_5::agent_t {
416 * so_5::message_holder_t<some_message> first_;
417 * so_5::message_holder_t<so_5::mutable_msg<another_message>> second_;
418 * ...
419 * void on_some_event(mhood_t<some_event>) {
420 * // It is time to send preallocated messages.
421 *
422 * // This message will be sent as immutable message.
423 * so_5::send(dest, first_);
424 *
425 * // This message will be sent as mutable message.
426 * so_5::send(dest, std::move(second_));
427 * }
428 * };
429 * \endcode
430 *
431 * \par Methods of message_holder_t class
432 *
433 * Class message_holder_t provides the following methods:
434 * \code
435 * // Default constructor. Creates an empty holder.
436 * message_holder_t();
437 *
438 * // Constructs holder for holding the specified message instance.
439 * message_holder_t(so_5::intrusive_ptr<envelope_type> msg);
440 *
441 * // Creates a new instance of message from 'args' and constructs holder for it.
442 * template<typename... Args>
443 * message_holder_t(std::piecewise_construct_t, Args && ...args);
444 *
445 * // Creates a new instance of message from 'args' and constructs holder for it.
446 * template<typename... Args>
447 * static message_holder_t make(Args && ...args);
448 *
449 * // Returns true if message_holder is empty.
450 * bool empty() const noexcept;
451 * bool operator!() const noexcept;
452 *
453 * // Returns true if message_holder is not empty.
454 * operator bool() const noexcept;
455 *
456 * // Drops the content of message_holder.
457 * void reset() noexcept;
458 * \endcode
459 *
460 * There are also some more methods which are depend on mutability of
461 * message and the type of ownership. They are described below.
462 *
463 * \par Getters are depend on mutability of message
464 *
465 * If a message_holder holds an immutable message then there are the following
466 * getter methods:
467 * \code
468 * const payload_type * get() const noexcept;
469 * const payload_type & operator*() const noexcept;
470 * const payload_type * operator->() const noexcept;
471 * \endcode
472 * But if message_holder holds a mutable message those getters are still here
473 * but they have non-const return type:
474 * \code
475 * payload_type * get() const noexcept;
476 * payload_type & operator*() const noexcept;
477 * payload_type * operator->() const noexcept;
478 * \endcode
479 *
480 * \par Shared and unique ownership
481 *
482 * A message_holder works like a smart pointer. But what kind of smart pointer?
483 *
484 * It depends on Ownership template parameters.
485 *
486 * But default Ownership is so_5::message_ownership_t::autodetected.
487 * In this case the behavior of a message_holder depends of the mutability
488 * of message. If message is immutable then message_holders is like
489 * std::shared_ptr: several message_holders can hold pointers to the
490 * same message instances.
491 *
492 * If message is mutable then message_holder is like
493 * std::unique_ptr: only one message_holder can hold a pointer to a message
494 * instance.
495 *
496 * For example:
497 * \code
498 * // Immutable message.
499 * so_5::message_holder_t<my_msg> msg1{std::piecewise_construct, ...};
500 * so_5::message_holder_t<my_msg> msg2{ msg1 };
501 * assert(msg1.get() == msg2.get()); // Now msg1 and msg2 refer to the same msg.
502 *
503 * // Mutable message.
504 * so_5::message_holder_t<so_5::mutable_msg<my_msg>> msg3{...};
505 * so_5::message_holder_t<so_5::mutable_msg<my_msg>> msg4{ msg3 }; // WON'T COMPILE!
506 * so_5::message_holder_t<so_5::mutable_msg<my_msg>> msg5{ std::move(msg3) };
507 * assert(msg3.empty()); // Now msg3 is empty.
508 * assert(!msg5.empty()); // And only msg5 holds the message.
509 * \endcode
510 *
511 * The value of Ownership parameter can be specified manually.
512 * In that case we can have an unique-holder for an immutable message:
513 * \code
514 * so_5::message_holder_t<my_msg, so_5::message_ownership_t::unique> msg1{...};
515 * // WON'T COMPILE!
516 * so_5::message_holder_t<my_msg, so_5::message_ownership_t::unique> msg2{ msg1 };
517 * // Will compile but ownership will be moved:
518 * so_5::message_holder_t<my_msg, so_5::message_ownership_t::unique> msg3{ std::move(msg) };
519 * \endcode
520 * There can also be a shared-holder for a mutable message:
521 * \code
522 * so_5::message_holder_t<my_msg, so_5::message_ownership_t::shared> msg1{...};
523 * // No problems.
524 * so_5::message_holder_t<my_msg, so_5::message_ownership_t::shared> msg2{ msg1 };
525 * \endcode
526 * But this approach should be taken with an additional care because it allows
527 * to make several sends of the same mutable message instances at the same time.
528 *
529 * If a message_holder works as std::shared_ptr then there is the following
530 * methods:
531 * \code
532 * // Copy constructor and operator.
533 * message_holder_t(const message_holder_t &) noexcept;
534 * message_holder_t & operator=(const message_holder_t &) noexcept;
535 * // Move constructor and operator.
536 * message_holder_t(message_holder_t &&) noexcept;
537 * message_holder_t & operator=(message_holder_t &&) noexcept;
538 *
539 * // Getter for the underlying smart pointer.
540 * intrusive_ptr_t<envelope_type> make_reference() const noexcept;
541 * \endcode
542 *
543 * If a message_holder works as std::unique_ptr then copy operator/constructors
544 * are disabled and make_reference() leaves the message_holder object empty:
545 * \code
546 * // Move constructor and operator.
547 * message_holder_t(message_holder_t &&) noexcept;
548 * message_holder_t & operator=(message_holder_t &&) noexcept;
549 *
550 * // Extracts the underlying smart pointer.
551 * // Leaves the message_holder object empty.
552 * intrusive_ptr_t<envelope_type> make_reference() noexcept;
553 * \endcode
554 *
555 * \par Creation of an instance of message to be stored inside a message_holder
556 *
557 * There are several ways of creation of a message to be stored inside
558 * a message_holder object.
559 *
560 * The recommended way is to use the constructor of message_holder with
561 * std::piecewise_construct_t argument. This constructor automatically
562 * creates an underlying message instance:
563 * \code
564 * struct my_msg {
565 * int a_;
566 * std::string b_;
567 * };
568 * so_5::message_holder_t<my_msg> msg{std::piecewise_construct,
569 * 0, // value for my_msg's a_ field.
570 * "hello" // value for my_msg's b_ field.
571 * };
572 * \endcode
573 * Sometimes a static method make() can be used for similar purpose:
574 * \code
575 * auto make_message() {
576 * return so_5::message_holder_t<my_msg>::make(0, "hello");
577 * }
578 * \endcode
579 *
580 * But sometimes an instance of message is present as raw pointer,
581 * std::unique_ptr or so_5::intrusive_ptr_t objects. In that case the
582 * constructor that accepts intrusive_ptr_t can be used:
583 * \code
584 * // Somewhere in 3rd-party library.
585 * std::unique_ptr<some_message> make_message() {
586 * return std::make_unique<some_message>(...);
587 * }
588 *
589 * // Somewhere in your code.
590 * so_5::message_holder_t<some_message> msg{make_message()};
591 * \endcode
592 *
593 * \since
594 * v.5.6.0
595 */
596template<
597 typename Msg,
600 : public details::message_holder_details::accessor_selector_t<
601 details::message_mutability_traits<Msg>::mutability,
602 details::message_holder_details::impl_selector_t<Msg, Ownership> >
603 {
604 using base_type = details::message_holder_details::accessor_selector_t<
605 details::message_mutability_traits<Msg>::mutability,
606 details::message_holder_details::impl_selector_t<Msg, Ownership> >;
607
608 static_assert( !is_signal< Msg >::value,
609 "message_holder_t can't be used with signals" );
610
611 public :
612 using payload_type = typename base_type::payload_type;
613 using envelope_type = typename base_type::envelope_type;
614
615 using base_type::base_type;
616
617 //! Special constructor for constructing message_holder with
618 //! a new message instance inside.
619 /*!
620 * Usage example:
621 * \code
622 * struct my_message {
623 * int a_;
624 * std::string b_;
625 * std::chrono::millisecons c_;
626 * };
627 *
628 * so_5::message_holder_t<my_message> msg{ std::piecewise_construct,
629 * 0, // value for my_message's a_ field.
630 * "hello", // value for my_message's b_ field.
631 * 15s // value for my_message's c_ field.
632 * };
633 * \endcode
634 */
635 template< typename... Args >
637 std::piecewise_construct_t,
638 Args && ...args )
640 {}
641
642 friend void
644 {
645 using std::swap;
646 swap( a.m_msg, b.m_msg );
647 }
648
649 //! Create a new instance of message_holder with a new message inside.
650 /*!
651 * Usage example:
652 * \code
653 * struct my_message {
654 * int a_;
655 * std::string b_;
656 * std::chrono::millisecons c_;
657 * };
658 *
659 * auto make_message() {
660 * return so_5::message_holder_t<my_message>(
661 * 0, // value for my_message's a_ field.
662 * "hello", // value for my_message's b_ field.
663 * 15s ); // value for my_message's c_ field.
664 * }
665 * \endcode
666 */
667 template< typename... Args >
668 [[nodiscard]]
669 static message_holder_t
670 make( Args && ...args )
671 {
672 return { make_msg_instance( std::forward<Args>(args)... ) };
673 }
674
675 private :
676 //! Create a new instance of message.
677 template< typename... Args >
678 [[nodiscard]]
679 static intrusive_ptr_t< envelope_type >
680 make_msg_instance( Args && ...args )
681 {
682 using namespace details;
683
684 // Mutability of a message will be changed appropriately
685 // in make_message_instance.
688 };
689
690 return msg;
691 }
692 };
693
694} /* namespace so_5 */
virtual void unsubscribe_event_handler(const std::type_index &type_index, abstract_message_sink_t &subscriber) noexcept=0
Remove all message handlers.
virtual void subscribe_event_handler(const std::type_index &type_index, abstract_message_sink_t &subscriber)=0
Add the message handler.
virtual so_5::environment_t & environment() const noexcept=0
SObjectizer Environment for which the mbox is created.
abstract_message_box_t(const abstract_message_box_t &)=delete
virtual void drop_delivery_filter(const std::type_index &msg_type, abstract_message_sink_t &subscriber) noexcept=0
Removes delivery filter for message type and subscriber.
virtual void set_delivery_filter(const std::type_index &msg_type, const delivery_filter_t &filter, abstract_message_sink_t &subscriber)=0
Set a delivery filter for message type and subscriber.
virtual ~abstract_message_box_t() noexcept=default
virtual mbox_id_t id() const =0
Unique ID of this mbox.
virtual std::string query_name() const =0
Get the mbox name.
abstract_message_box_t & operator=(abstract_message_box_t &&)=delete
virtual void do_deliver_message(message_delivery_mode_t delivery_mode, const std::type_index &msg_type, const message_ref_t &message, unsigned int redirection_deep)=0
Deliver message for all subscribers with respect to message limits.
abstract_message_box_t & operator=(const abstract_message_box_t &)=delete
virtual mbox_type_t type() const =0
Get the type of message box.
abstract_message_box_t(abstract_message_box_t &&)=delete
Interface for message sink.
abstract_message_sink_t & operator=(const abstract_message_sink_t &)=default
abstract_message_sink_t(const abstract_message_sink_t &)=default
abstract_message_sink_t(abstract_message_sink_t &&) noexcept=default
abstract_message_sink_t & operator=(abstract_message_sink_t &&) noexcept=default
static bool special_sink_ptr_compare(const abstract_message_sink_t *a, const abstract_message_sink_t *b) noexcept
virtual void push_event(mbox_id_t mbox_id, message_delivery_mode_t delivery_mode, const std::type_index &msg_type, const message_ref_t &message, unsigned int redirection_deep, const message_limit::impl::action_msg_tracer_t *tracer)=0
Get a message and push it to the appropriate destination.
virtual priority_t sink_priority() const noexcept=0
Get the priority for the message sink.
virtual environment_t & environment() const noexcept=0
virtual ~abstract_message_sink_t() noexcept=default
Interface for holders of message_sink instances.
virtual const abstract_message_sink_t & sink() const noexcept=0
Get a const reference to the underlying message sink.
virtual abstract_message_sink_t & sink() noexcept=0
Get a reference to the underlying message sink.
virtual ~abstract_sink_owner_t() noexcept=default
A context for agent construction and tuning.
environment_t * m_env
SObjectizer Environment to work in.
agent_context_t(environment_t &env, agent_tuning_options_t options)
const agent_tuning_options_t & options() const
Read-only access to agent options.
agent_context_t(environment_t &env)
Constructor for the case when only environment available.
environment_t & environment() const
Access to SObjectizer Environment.
agent_tuning_options_t & options()
Read-Write access to agent options.
friend void swap(so_5::agent_context_t &a, so_5::agent_context_t &b) noexcept
Swap operation.
agent_tuning_options_t m_options
Options for agent tuning.
environment_t & env() const
Access to SObjectizer Environment.
Helper class for holding agent's identity (name or pointer).
agent_identity_t(std::string_view name) noexcept
Initializing constructor for case when agent has a user specified name.
agent_identity_t(const agent_t *pointer) noexcept
Initializing constructor for case when agent has no user specified name.
Interface of the agent state listener.
A base class for agents.
Definition agent.hpp:673
void so_subscribe_deadletter_handler(const so_5::mbox_t &mbox, Event_Handler &&handler, thread_safety_t thread_safety=thread_safety_t::unsafe)
Create a subscription for deadletter handler for a specific message from a specific mbox.
Definition agent.hpp:2080
static demand_handler_pfn_t get_demand_handler_on_start_ptr() noexcept
Definition agent.cpp:1323
impl::state_listener_controller_t m_state_listener_controller
State listeners controller.
Definition agent.hpp:2803
decltype(auto) so_low_level_exec_as_event_handler(Lambda &&lambda) noexcept(noexcept(lambda()))
Helper method that allows to run a block of code as non-thread-safe event handler.
Definition agent.hpp:2630
static void process_enveloped_msg(current_thread_id_t working_thread_id, execution_demand_t &d, const impl::event_handler_data_t *handler_data)
Actual implementation of enveloped message handling.
Definition agent.cpp:1445
std::unique_ptr< impl::sinks_storage_t > m_message_sinks
Holder of message sinks for that agent.
Definition agent.hpp:2843
const state_t st_default
Definition agent.hpp:2774
bool so_has_subscription(const mbox_t &mbox) const noexcept
Check the presence of a subscription in the default_state.
Definition agent.hpp:1856
void do_change_agent_state(const state_t &state_to_be_set)
Perform actual operations related to state switch.
Definition agent.cpp:1637
void so_drop_delivery_filter(const mbox_t &mbox) noexcept
Drop a delivery filter.
Definition agent.hpp:2531
void so_initiate_agent_definition()
A correct initiation of so_define_agent method call.
Definition agent.cpp:829
const agent_t * self_ptr() const
Get the raw pointer of itself.
Definition agent.hpp:834
so_5::current_thread_id_t m_working_thread_id
Working thread id.
Definition agent.hpp:2899
default_rw_spinlock_t m_event_queue_lock
Event queue operation protector.
Definition agent.hpp:2867
bool so_has_subscription(const mbox_t &mbox, const state_t &target_state) const noexcept
Check the presence of a subscription.
Definition agent.hpp:1811
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, bool >::type so_has_subscription(const mbox_t &mbox, Method_Pointer) const noexcept
Check the presence of a subscription.
Definition agent.hpp:1956
const name_for_agent_t m_name
Optional name for the agent.
Definition agent.hpp:2948
static const impl::event_handler_data_t * find_deadletter_handler(execution_demand_t &demand)
Search for event handler between deadletter handlers.
Definition agent.cpp:1627
static demand_handler_pfn_t get_demand_handler_on_message_ptr() noexcept
Definition agent.cpp:1388
bool is_agent_deactivated() const noexcept
Is agent already deactivated.
Definition agent.cpp:1753
void so_switch_to_awaiting_deregistration_state()
Switching agent to special state in case of unhandled exception.
Definition agent.cpp:756
const state_t & so_current_state() const
Access to the current agent state.
Definition agent.hpp:934
static void process_message(current_thread_id_t working_thread_id, execution_demand_t &d, thread_safety_t thread_safety, event_handler_method_t method)
Actual implementation of message handling.
Definition agent.cpp:1412
agent_ref_t create_ref()
Make an agent reference.
Definition agent.cpp:1016
void so_drop_deadletter_handler(const so_5::mbox_t &mbox)
Drops the subscription for deadletter handler.
Definition agent.hpp:2129
bool so_is_active_state(const state_t &state_to_check) const noexcept
Is a state activated?
Definition agent.cpp:713
void ensure_operation_is_on_working_thread(const char *operation_name) const
Enables operation only if it is performed on agent's working thread.
Definition agent.cpp:1485
static constexpr const state_t::history_t deep_history
Short alias for so_5::state_t::history_t::deep.
Definition agent.hpp:737
bool so_was_defined() const
Is method define_agent already called?
Definition agent.cpp:847
agent_status_t
Enumeration of possible agent statuses.
Definition agent.hpp:2785
@ defined
Agent is defined.
@ state_switch_in_progress
State switch operation is in progress.
void destroy_all_subscriptions_and_filters() noexcept
Destroy all agent's subscriptions.
Definition agent.cpp:1009
void so_create_deadletter_subscription(const mbox_t &mbox, const std::type_index &msg_type, const event_handler_method_t &method, thread_safety_t thread_safety)
Create a subscription for a deadletter handler.
Definition agent.cpp:1114
void shutdown_agent() noexcept
Agent shutdown deriver.
Definition agent.cpp:1029
void ensure_binding_finished()
Ensures that all agents from cooperation are bound to dispatchers.
Definition agent.cpp:1314
coop_t * m_agent_coop
Agent is belong to this cooperation.
Definition agent.hpp:2902
disp_binder_shptr_t so_this_agent_disp_binder() const
Returns the dispatcher binder that is used for binding this agent.
Definition agent.hpp:2671
void so_drop_subscription(const mbox_t &mbox, const state_t &target_state)
Drop subscription for the state specified.
Definition agent.hpp:1560
agent_status_t m_current_status
Current agent status.
Definition agent.hpp:2800
event_queue_t * m_event_queue
A pointer to event_queue.
Definition agent.hpp:2882
void so_set_delivery_filter(const mbox_t &mbox, Lambda &&lambda)
Set a delivery filter.
Definition agent.hpp:3410
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, void >::type so_drop_subscription_for_all_states(const mbox_t &mbox, Method_Pointer)
Drop subscription for all states.
Definition agent.hpp:1716
virtual void so_define_agent()
Hook on define agent for SObjectizer.
Definition agent.cpp:841
void drop_all_delivery_filters() noexcept
Drops all delivery filters.
Definition agent.cpp:1510
disp_binder_shptr_t m_disp_binder
Binder for this agent.
Definition agent.hpp:2936
bool do_check_subscription_presence(const mbox_t &mbox, const std::type_index &msg_type, const state_t &target_state) const noexcept
Check the presence of a subscription.
Definition agent.cpp:1199
void do_state_switch(const state_t &state_to_be_set) noexcept
Actual action for switching agent state.
Definition agent.cpp:1678
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, bool >::type so_has_subscription(const mbox_t &mbox, const state_t &target_state, Method_Pointer) const noexcept
Check the presence of a subscription.
Definition agent.hpp:1901
std::unique_ptr< impl::delivery_filter_storage_t > m_delivery_filters
Delivery filters for that agents.
Definition agent.hpp:2911
void so_drop_subscription_for_all_states(const mbox_t &mbox)
Drop subscription for all states.
Definition agent.hpp:1770
void return_to_default_state_if_possible() noexcept
Return agent to the default state.
Definition agent.cpp:1741
subscription_bind_t so_subscribe_self()
Initiate subscription to agent's direct mbox.
Definition agent.hpp:1416
agent_t(environment_t &env)
Constructor.
Definition agent.cpp:646
void do_set_delivery_filter(const mbox_t &mbox, const std::type_index &msg_type, delivery_filter_unique_ptr_t filter)
Set a delivery filter.
Definition agent.cpp:1520
static void call_push_event(agent_t &agent, const message_limit::control_block_t *limit, mbox_id_t mbox_id, const std::type_index &msg_type, const message_ref_t &message)
Push an event to the agent's event queue.
Definition agent.hpp:1037
mbox_t so_make_new_direct_mbox()
Create a new direct mbox for that agent.
Definition agent.cpp:768
static execution_hint_t so_create_execution_hint(execution_demand_t &demand)
Create execution hint for the specified demand.
Definition agent.cpp:901
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, void >::type so_drop_subscription(const mbox_t &mbox, Method_Pointer)
Drop subscription for the default agent state.
Definition agent.hpp:1611
void so_change_state(const state_t &new_state)
Change the current state of the agent.
Definition agent.cpp:811
void push_event(const message_limit::control_block_t *limit, mbox_id_t mbox_id, const std::type_index &msg_type, const message_ref_t &message)
Push event into the event queue.
Definition agent.cpp:1265
static custom_direct_mbox_factory_t custom_direct_mbox_factory(Lambda &&lambda)
Helper for creation a custom direct mbox factory.
Definition agent.hpp:1135
coop_handle_t so_coop() const
Get a handle of agent's coop.
Definition agent.cpp:860
void so_deregister_agent_coop_normally()
A helper method for deregistering agent's coop in case of normal deregistration.
Definition agent.cpp:982
void do_drop_delivery_filter(const mbox_t &mbox, const std::type_index &msg_type) noexcept
Drop a delivery filter.
Definition agent.cpp:1548
virtual exception_reaction_t so_exception_reaction() const noexcept
A reaction from SObjectizer to an exception from agent's event.
Definition agent.cpp:746
void so_deactivate_agent()
Deactivate the agent.
Definition agent.cpp:820
disp_binder_shptr_t so_this_coop_disp_binder() const
Returns the dispatcher binder that is used as the default binder for the agent's coop.
Definition agent.cpp:988
abstract_message_sink_t & detect_sink_for_message_type(const std::type_index &msg_type)
Helper function that returns a message sink to be used for subscriptions for specified message type.
Definition agent.cpp:1153
static void demand_handler_on_message(current_thread_id_t working_thread_id, execution_demand_t &d)
Calls event handler for message.
Definition agent.cpp:1371
static constexpr const state_t::history_t shallow_history
Short alias for so_5::state_t::history_t::shallow.
Definition agent.hpp:730
virtual void so_evt_finish()
Hook of agent finish in SObjectizer.
Definition agent.cpp:707
static demand_handler_pfn_t get_demand_handler_on_finish_ptr() noexcept
Definition agent.cpp:1365
void so_add_nondestroyable_listener(agent_state_listener_t &state_listener)
Add a state listener to the agent.
Definition agent.cpp:728
static const impl::event_handler_data_t * handler_finder_msg_tracing_disabled(execution_demand_t &demand, const char *context_marker)
Handler finder for the case when message delivery tracing is disabled.
Definition agent.cpp:1559
const state_t * m_current_state_ptr
Current agent state.
Definition agent.hpp:2777
const mbox_t m_direct_mbox
A direct mbox for the agent.
Definition agent.hpp:2889
bool so_has_deadletter_handler(const so_5::mbox_t &mbox) const noexcept
Checks the presence of deadletter handler for a message of a specific type from a specific mbox.
Definition agent.hpp:2170
agent_t * self_ptr()
Definition agent.hpp:840
const priority_t m_priority
Priority of the agent.
Definition agent.hpp:2918
agent_identity_t so_agent_name() const noexcept
Get an optional name of the agent.
Definition agent.cpp:1000
static const impl::event_handler_data_t * handler_finder_msg_tracing_enabled(execution_demand_t &demand, const char *context_marker)
Handler finder for the case when message delivery tracing is enabled.
Definition agent.cpp:1572
void bind_to_coop(coop_t &coop)
Bind agent to the cooperation.
Definition agent.cpp:1023
static const impl::event_handler_data_t * find_event_handler_for_current_state(execution_demand_t &demand)
Actual search for event handler with respect to parent-child relationship between agent states.
Definition agent.cpp:1606
static void demand_handler_on_start(current_thread_id_t working_thread_id, execution_demand_t &d)
Calls so_evt_start method for agent.
Definition agent.cpp:1287
const mbox_t & so_direct_mbox() const
Get the agent's direct mbox.
Definition agent.cpp:762
impl::subscription_storage_unique_ptr_t m_subscriptions
All agent's subscriptions.
Definition agent.hpp:2830
void so_destroy_deadletter_subscription(const mbox_t &mbox, const std::type_index &msg_type)
Destroy a subscription for a deadletter handler.
Definition agent.cpp:1139
static void demand_handler_on_finish(current_thread_id_t working_thread_id, execution_demand_t &d)
Calls so_evt_finish method for agent.
Definition agent.cpp:1329
bool do_check_deadletter_presence(const mbox_t &mbox, const std::type_index &msg_type) const noexcept
Check the presence of a deadletter handler.
Definition agent.cpp:1209
void do_drop_subscription_for_all_states(const mbox_t &mbox, const std::type_index &msg_type)
Remove subscription for all states.
Definition agent.cpp:1184
agent_t(context_t ctx)
Constructor which simplifies agent construction with or without agent's tuning options.
Definition agent.cpp:659
static agent_tuning_options_t tuning_options()
Create tuning options object with default values.
Definition agent.hpp:1103
void so_add_destroyable_listener(agent_state_listener_unique_ptr_t state_listener)
Add a state listener to the agent.
Definition agent.cpp:737
environment_t & so_environment() const noexcept
Access to the SObjectizer Environment which this agent is belong.
Definition agent.cpp:853
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, void >::type so_drop_subscription(const mbox_t &mbox, const state_t &target_state, Method_Pointer)
Drop subscription for the state specified.
Definition agent.hpp:1516
priority_t so_priority() const noexcept
Get the priority of the agent.
Definition agent.hpp:2555
const state_t & so_default_state() const
Access to the agent's default state.
Definition agent.cpp:775
subscription_bind_t so_subscribe(const mbox_t &mbox_ref)
Initiate subscription.
Definition agent.hpp:1359
virtual ~agent_t()
Definition agent.cpp:693
void so_bind_to_dispatcher(event_queue_t &queue) noexcept
Binding agent to the dispatcher.
Definition agent.cpp:872
void so_destroy_event_subscription(const mbox_t &mbox, const std::type_index &subscription_type, const state_t &target_state)
Destroy event subscription.
Definition agent.hpp:1461
void so_set_delivery_filter_for_mutable_msg(const mbox_t &mbox, Lambda &&lambda)
Set a delivery filter for a mutable message.
Definition agent.hpp:3433
environment_t & m_env
SObjectizer Environment for which the agent is belong.
Definition agent.hpp:2846
void so_drop_subscription(const mbox_t &mbox)
Drop subscription for the default agent state.
Definition agent.hpp:1655
void so_deregister_agent_coop(int dereg_reason)
A helper method for deregistering agent's coop.
Definition agent.cpp:975
void do_drop_subscription(const mbox_t &mbox, const std::type_index &msg_type, const state_t &target_state)
Remove subscription for the state specified.
Definition agent.cpp:1169
agent_t(environment_t &env, agent_tuning_options_t tuning_options)
Constructor which allows specification of agent's tuning options.
Definition agent.cpp:652
handler_finder_t m_handler_finder
Function for searching event handler.
Definition agent.hpp:2823
virtual void so_evt_start()
Hook on agent start inside SObjectizer.
Definition agent.cpp:701
static demand_handler_pfn_t get_demand_handler_on_enveloped_msg_ptr() noexcept
Definition agent.cpp:1406
void so_create_event_subscription(const mbox_t &mbox_ref, std::type_index type_index, const state_t &target_state, const event_handler_method_t &method, thread_safety_t thread_safety, event_handler_kind_t handler_kind)
Create a subscription for an event.
Definition agent.cpp:1083
void so_set_delivery_filter(const mbox_t &mbox, delivery_filter_unique_ptr_t filter)
Set a delivery filter.
Definition agent.hpp:2426
static void demand_handler_on_enveloped_msg(current_thread_id_t working_thread_id, execution_demand_t &d)
Handles the enveloped message.
Definition agent.cpp:1394
A collector for agent tuning options.
name_for_agent_t m_agent_name
Optional name for an agent.
so_5::priority_t query_priority() const noexcept
Get priority value.
bool m_is_user_provided_subscription_storage_factory
Does a user provide a specific subscription_storage_factory?
agent_tuning_options_t & agent_name(name_for_agent_t name)
Set a name for agent.
subscription_storage_factory_t m_subscription_storage_factory
name_for_agent_t giveout_agent_name() noexcept
Gives away the name for an agent.
friend void swap(so_5::agent_tuning_options_t &a, so_5::agent_tuning_options_t &b) noexcept
message_limit::description_container_t m_message_limits
bool has_agent_name() const noexcept
Does a name specified for an agent?
agent_tuning_options_t & custom_direct_mbox_factory(custom_direct_mbox_factory_t factory)
Set custom direct mbox factory.
const custom_direct_mbox_factory_t & query_custom_direct_mbox_factory() const noexcept
Get a reference to custom direct mbox factory.
so_5::priority_t m_priority
Priority for agent.
bool is_user_provided_subscription_storage_factory() const noexcept
Does a user provide a specific subscription_storage_factory?
static subscription_storage_factory_t default_subscription_storage_factory()
Default subscription storage factory.
const subscription_storage_factory_t & query_subscription_storage_factory() const noexcept
agent_tuning_options_t & message_limits(Args &&... args)
agent_tuning_options_t & subscription_storage_factory(subscription_storage_factory_t factory) noexcept(noexcept(std::declval< subscription_storage_factory_t & >()=std::move(factory)))
Set factory for subscription storage creation.
message_limit::description_container_t giveout_message_limits()
agent_tuning_options_t & priority(so_5::priority_t v)
Set priority for agent.
custom_direct_mbox_factory_t m_custom_direct_mbox_factory
Optional factory for custom direct mboxes.
The base class for the object with a reference counting.
atomic_refcounted_t(const atomic_refcounted_t &)=delete
unsigned long dec_ref_count() noexcept
Decrement reference count.
atomic_refcounted_t() noexcept
Default constructor.
atomic_counter_t m_ref_counter
Object reference count.
void inc_ref_count() noexcept
Increments reference count.
~atomic_refcounted_t() noexcept=default
Destructor.
atomic_refcounted_t & operator=(const atomic_refcounted_t &)=delete
It's a kind of strong typedef for coop's deregistration reason.
Definition coop.hpp:80
Type of smart handle for a cooperation.
Agent cooperation.
Definition coop.hpp:389
exception_reaction_t exception_reaction() const noexcept
Get the current exception rection flag for that cooperation.
Definition coop.hpp:758
std::mutex m_lock
A lock for synchonization of some operations on coop.
Definition coop.hpp:1077
disp_binder_shptr_t coop_disp_binder() const noexcept(noexcept(disp_binder_shptr_t{ this->m_coop_disp_binder }))
Return the default dispatcher binder for the coop.
Definition coop.hpp:1316
coop_handle_t handle() noexcept
Get handle for this coop.
Definition coop.hpp:432
An interface of delivery filter object.
Definition mbox.hpp:62
delivery_filter_t(delivery_filter_t &&)=delete
virtual bool check(const abstract_message_sink_t &receiver, message_t &msg) const noexcept=0
Checker for a message instance.
delivery_filter_t & operator=(delivery_filter_t &&)=delete
delivery_filter_t(const delivery_filter_t &)=delete
virtual ~delivery_filter_t() noexcept=default
delivery_filter_t & operator=(const delivery_filter_t &)=delete
basic_message_holder_impl_t(intrusive_ptr_t< Envelope > msg) noexcept
operator bool() const noexcept
Check for the non-emptiness of message_holder.
bool operator!() const noexcept
Check for the emptiness of message_holder.
bool empty() const noexcept
Check for the emptiness of message_holder.
void reset() noexcept
Drops to pointer to the message instance.
An of mixin with getters for message_holder.
Return_Type & operator*() const noexcept
Get a reference to the message inside message_holder.
Return_Type * get() const noexcept
Get a pointer to the message inside message_holder.
Return_Type * operator->() const noexcept
Get a pointer to the message inside message_holder.
A part of implementation of message_holder to be used for shared ownership of message instances.
intrusive_ptr_t< Envelope > make_reference() const noexcept
Make an another reference to the message.
A part of implementation of message_holder to be used for unique ownership of message instances.
unique_message_holder_impl_t(const unique_message_holder_impl_t &)=delete
unique_message_holder_impl_t & operator=(const unique_message_holder_impl_t &)=delete
intrusive_ptr_t< Envelope > make_reference() noexcept
Extracts the smart pointer to the message.
unique_message_holder_impl_t & operator=(unique_message_holder_impl_t &&) noexcept=default
unique_message_holder_impl_t(unique_message_holder_impl_t &&)=default
message_holder_t< M, Ownership > make_holder() noexcept
Create a holder for this message.
Definition mhood.hpp:197
intrusive_ptr_t< envelope_type > make_reference() noexcept
Create a smart pointer for the message envelope.
Definition mhood.hpp:181
message_holder_t< M, Ownership > make_holder() const noexcept
Create a holder for this message.
Definition mhood.hpp:101
intrusive_ptr_t< envelope_type > make_reference() const noexcept
Create a smart pointer for the message envelope.
Definition mhood.hpp:87
const payload_type * operator->() const noexcept
Access to the message via pointer.
Definition mhood.hpp:112
intrusive_ptr_t< envelope_type > make_reference() noexcept
Create a smart pointer for the message envelope.
Definition mhood.hpp:380
message_holder_t< M, Ownership > make_holder() noexcept
Create a holder for this message.
Definition mhood.hpp:399
message_holder_t< M, Ownership > make_holder() const noexcept
Create a holder for this message.
Definition mhood.hpp:299
const payload_type * operator->() const noexcept
Access to the message via pointer.
Definition mhood.hpp:310
intrusive_ptr_t< envelope_type > make_reference() const noexcept
Create a smart pointer for the message envelope.
Definition mhood.hpp:285
A type to be used as a base for mhood_t implementation.
Definition mhood.hpp:52
Helper template class for do rollback actions automatically in the destructor.
Helper class for scope exit implementation.
virtual void access_hook(access_context_t context, handler_invoker_t &invoker) noexcept=0
An implementation of handler_invoker interface.
agent_demand_handler_invoker_t(current_thread_id_t work_thread_id, execution_demand_t &demand, const so_5::impl::event_handler_data_t &handler_data)
Initializing constructor.
Parameters for the SObjectizer Environment initialization.
SObjectizer Environment.
void deregister_coop(coop_handle_t coop, int reason) noexcept
Deregister the cooperation.
An interface for logging error messages.
error_logger_t & operator=(error_logger_t &)=delete
virtual ~error_logger_t() noexcept=default
error_logger_t(const error_logger_t &)=delete
error_logger_t()=default
virtual void log(const char *file_name, unsigned int line, const std::string &message)=0
A method for logging message.
Interface of event_queue_hook object.
An interface of event queue for agent.
virtual void push(execution_demand_t demand)=0
Enqueue new event to the queue.
virtual void push_evt_finish(execution_demand_t demand) noexcept=0
Enqueue a demand for evt_finish event.
virtual void push_evt_start(execution_demand_t demand)=0
Enqueue a demand for evt_start event.
The base class for all SObjectizer exceptions.
Definition exception.hpp:34
int error_code() const noexcept
Error code getter.
Definition exception.hpp:53
exception_t(const exception_t &)=default
exception_t(exception_t &&)=default
int m_error_code
Error code.
Definition exception.hpp:64
exception_t(const std::string &error_descr, int error_code)
Definition exception.hpp:36
exception_t & operator=(exception_t &&o) noexcept=default
exception_t & operator=(exception_t &o)=default
static void raise(const char *file_name, unsigned int line_number, std::string_view error_descr, int error_code)
Definition exception.cpp:17
A hint for a dispatcher for execution of event for the concrete execution_demand.
execution_hint_t(execution_demand_t &demand, direct_func_t direct_func, thread_safety_t thread_safety)
Initializing constructor.
static execution_hint_t create_empty_execution_hint(execution_demand_t &demand)
A special class for accessing private members of agent_coop.
static void decrement_usage_count(coop_t &coop)
static void increment_usage_count(coop_t &coop) noexcept
Storage for message delivery filters.
void drop_all() noexcept
Drop all defined filters.
void set_delivery_filter(const mbox_t &mbox, const std::type_index &msg_type, delivery_filter_unique_ptr_t filter, so_5::outliving_reference_t< abstract_message_sink_t > owner)
Set a delivery filter.
void drop_delivery_filter(const mbox_t &mbox, const std::type_index &msg_type) noexcept
Remove delivery filter.
A helper class for accessing the functionality of environment-class which is specific for SObjectizer...
event_queue_t * event_queue_on_bind(agent_t *agent, event_queue_t *original_queue) noexcept
Call the event_queue_hook when an agent is being bound to a particular event_queue.
subscription_storage_factory_t default_subscription_storage_factory() const noexcept(noexcept(subscription_storage_factory_t{}=subscription_storage_factory_t{}))
Get the default storage subscription factory.
void event_queue_on_unbind(agent_t *agent, event_queue_t *queue) noexcept
Call the event_queue_hook when an agent is being unbound from its event_queue.
mbox_t create_ordinary_mpsc_mbox(agent_t &single_consumer)
Create multi-producer/single-consumer mbox that handles message limits.
bool is_msg_tracing_enabled() const
Is message delivery tracing enabled?
internal_env_iface_t(environment_t &env)
Initializing constructor.
mbox_t create_limitless_mpsc_mbox(agent_t &single_consumer)
Create multi-producer/single-consumer mbox that ignores message limits.
An utility class for working with layers.
Helper class for accessing protected members from mbox interface.
An interface for storage of message_sinks for one agent.
virtual abstract_message_sink_t * find_or_create(const std::type_index &msg_type)=0
void add(internal_state_listener_unique_ptr_t listener)
Add a new listener.
static auto wrap_nondestroyable(agent_state_listener_t &listener)
void changed(agent_t &agent, const state_t &state) noexcept
Handle state change.
static auto wrap_destroyable(agent_state_listener_unique_ptr_t listener)
agent_t::agent_status_t m_previous_status
Definition agent.cpp:785
state_switch_guard_t(agent_t &agent)
Definition agent.cpp:788
An interface of subscription storage.
virtual const event_handler_data_t * find_handler(mbox_id_t mbox_id, const std::type_index &msg_type, const state_t &current_state) const noexcept=0
virtual void drop_subscription(const mbox_t &mbox, const std::type_index &msg_type, const state_t &target_state) noexcept=0
virtual void drop_subscription_for_all_states(const mbox_t &mbox, const std::type_index &msg_type) noexcept=0
virtual void create_event_subscription(const mbox_t &mbox, const std::type_index &msg_type, abstract_message_sink_t &message_sink, const state_t &target_state, const event_handler_method_t &method, thread_safety_t thread_safety, event_handler_kind_t handler_kind)=0
virtual void drop_all_subscriptions() noexcept=0
Drop all subscriptions.
Template class for smart reference wrapper on the atomic_refcounted_t.
bool operator==(const intrusive_ptr_t &o) const
intrusive_ptr_t(T *obj) noexcept
Constructor for a raw pointer.
T * m_obj
Object controlled by a smart reference.
void dismiss_object() noexcept
Decrement reference count to object and delete it if needed.
void reset() noexcept
Drop controlled object.
intrusive_ptr_t(const intrusive_ptr_t< Y > &o) noexcept
Constructor from another smart reference.
intrusive_ptr_t(std::unique_ptr< Y > o) noexcept
Constructor from unique_ptr instance.
intrusive_ptr_t(intrusive_ptr_t &&o) noexcept
Move constructor.
bool operator<(const intrusive_ptr_t &o) const
T * operator->() const noexcept
intrusive_ptr_t(const intrusive_ptr_t &o) noexcept
Copy constructor.
intrusive_ptr_t & operator=(const intrusive_ptr_t &o) noexcept
Copy operator.
intrusive_ptr_t & operator=(intrusive_ptr_t &&o) noexcept
Move operator.
intrusive_ptr_t< Y > make_reference() const noexcept
Make reference with casing to different type.
T & operator*() const noexcept
void take_object() noexcept
Increment reference count to object if it's not null.
friend void swap(intrusive_ptr_t &a, intrusive_ptr_t &b) noexcept
Swap values.
intrusive_ptr_t() noexcept
Default constructor.
T * get() const noexcept
~intrusive_ptr_t() noexcept
Destructor.
operator bool() const noexcept
Is this a null reference?
conductor_t(const Env &env, const char *file, unsigned int line)
conductor_t(error_logger_t &logger, const char *file, unsigned int line)
An implementation of delivery filter represented by lambda-function like object.
Definition mbox.hpp:126
bool check(const abstract_message_sink_t &, message_t &msg) const noexcept override
Checker for a message instance.
Definition mbox.hpp:135
A class for holding an instance of a message.
static message_holder_t make(Args &&...args)
Create a new instance of message_holder with a new message inside.
friend void swap(message_holder_t &a, message_holder_t &b) noexcept
message_holder_t(std::piecewise_construct_t, Args &&...args)
static intrusive_ptr_t< envelope_type > make_msg_instance(Args &&...args)
Create a new instance of message.
An interface of tracer for message delivery tracing.
A base class for agent messages.
Definition message.hpp:47
message_t(const message_t &other)
Definition message.cpp:19
virtual void so5_change_mutability(message_mutability_t mutability)
Change message mutabilty flag.
Definition message.hpp:228
message_t & operator=(message_t &&other) noexcept
Definition message.cpp:39
friend message_mutability_t message_mutability(const message_t &what) noexcept
Helper method for get message mutability flag.
Definition message.hpp:86
virtual kind_t so5_message_kind() const noexcept
Detect the kind of the message.
Definition message.hpp:248
virtual ~message_t() noexcept=default
friend message_kind_t message_kind(const message_t &what)
Helper method for quering kind of the message.
Definition message.hpp:174
message_t & operator=(const message_t &other)
Definition message.cpp:32
message_mutability_t m_mutability
Is message mutable or immutable?
Definition message.hpp:188
friend message_mutability_t message_mutability(const intrusive_ptr_t< message_t > &what) noexcept
Helper method for safe get of message mutability flag.
Definition message.hpp:74
virtual message_mutability_t so5_message_mutability() const noexcept
Get message mutability flag.
Definition message.hpp:203
message_t(message_t &&other)
Definition message.cpp:25
friend void change_message_mutability(message_t &what, message_mutability_t mutability)
Helper method for change message mutability flag.
Definition message.hpp:130
friend message_kind_t message_kind(const so_5::intrusive_ptr_t< message_t > &what)
Helper method for quering kind of the message.
Definition message.hpp:154
friend void change_message_mutability(intrusive_ptr_t< message_t > &what, message_mutability_t mutability)
Helper method for safe change message mutability flag.
Definition message.hpp:107
A message wrapped to be used as type of argument for event handlers.
Definition mhood.hpp:570
mhood_t(message_ref_t &mf)
Definition mhood.hpp:574
Type for holding agent name.
unsigned int m_length
Name length.
name_for_agent_t & operator=(name_for_agent_t &&other) noexcept
Definition agent.cpp:142
name_for_agent_t(const name_for_agent_t &)
Definition agent.cpp:115
name_for_agent_t(name_for_agent_t &&other) noexcept
Definition agent.cpp:136
std::unique_ptr< char[] > m_value
Name storage.
bool has_value() const noexcept
Does this object have a value?
Definition agent.cpp:169
name_for_agent_t & operator=(const name_for_agent_t &)
Definition agent.cpp:129
std::string_view as_string_view() const
Get the value as a string_view.
Definition agent.cpp:160
name_for_agent_t()
Default constructor makes an null value.
Definition agent.cpp:104
operator bool() const noexcept
Does this object have a value?
name_for_agent_t(std::string_view value)
Initializing constructor.
Definition agent.cpp:108
Helper class for indication of long-lived reference via its type.
Definition outliving.hpp:98
outliving_reference_t(T &r) noexcept
outliving_reference_t & operator=(outliving_reference_t const &o)=delete
T & get() const noexcept
outliving_reference_t(outliving_reference_t< U > const &o) noexcept
outliving_reference_t(T &&)=delete
outliving_reference_t(outliving_reference_t const &o) noexcept
Wrapper around a pointer to partially constructed agent.
An implementation of backoff object using assembly instruction.
Definition spinlocks.hpp:60
Scoped guard for shared locks.
read_lock_guard_t(const read_lock_guard_t &)=delete
read_lock_guard_t & operator=(const read_lock_guard_t &)=delete
A simple multi-readers/single-writer spinlock (analog of std::shared_mutex).
void lock()
Lock object in exclusive mode.
static constexpr const std::uint_fast32_t unlocked
void unlock()
Unlock object locked in exclusive mode.
void unlock_shared()
Unlock object locked in shared mode.
std::atomic_uint_fast32_t m_counters
void lock_shared()
Lock object in shared mode.
static constexpr const std::uint_fast32_t write_lock
static constexpr const std::uint_fast32_t read_lock
rw_spinlock_t & operator=(const rw_spinlock_t &)=delete
rw_spinlock_t(const rw_spinlock_t &)=delete
A base class for agent signals.
Definition message.hpp:275
signal_t(const signal_t &)=delete
signal_t(signal_t &&)=delete
signal_t & operator=(signal_t &&)=delete
kind_t so5_message_kind() const noexcept override
Detect the kind of the message.
Definition message.hpp:293
signal_t & operator=(const signal_t &)=delete
~signal_t() noexcept override=default
signal_t()=default
abstract_message_sink_t & sink() noexcept override
Get a reference to the underlying message sink.
simple_sink_owner_t(Args &&...args)
Initializing constructor.
const abstract_message_sink_t & sink() const noexcept override
Get a const reference to the underlying message sink.
A simple spinlock (analog of std::mutex).
Definition spinlocks.hpp:93
void lock()
Lock object.
void unlock()
Unlock object.
spinlock_t(const spinlock_t &)=delete
std::atomic_bool m_flag
Atomic flag which is used as actual lock.
spinlock_t & operator=(spinlock_t &&)=delete
spinlock_t & operator=(const spinlock_t &)=delete
spinlock_t(spinlock_t &&)=delete
bool is_target(const agent_t *agent) const noexcept
Is agent owner of this state?
Definition agent.cpp:463
state_t & time_limit(duration_t timeout, const state_t &state_to_switch)
Set up a time limit for the state.
Definition agent.cpp:480
std::enable_if< details::is_agent_method_pointer< details::method_arity::nullary, Method_Pointer >::value, state_t & >::type on_enter(Method_Pointer pfn)
Set on enter handler.
Definition agent.hpp:3875
bool has_subscription(const mbox_t &from, Method_Pointer &&pfn) const
Check the presence of a subscription.
Definition agent.hpp:3782
const state_t & just_switch_to(mbox_t from, const state_t &target_state) const
Define handler which only switches agent to the specified state.
Definition agent.hpp:3833
state_t & drop_time_limit()
Drop time limit for the state if defined.
Definition agent.cpp:514
on_exit_handler_t m_on_exit
Handler for the exit from the state.
Definition state.hpp:1713
const state_t & suppress(mbox_t from) const
Suppress processing of event in this state.
Definition agent.hpp:3860
history_t m_state_history
Type of state history.
Definition state.hpp:1664
const state_t * parent_state() const noexcept
Get a parent state if exists.
Definition state.hpp:1748
void fill_path(path_t &path) const noexcept
A helper method for building a path from top-level state to this state.
Definition state.hpp:1793
state_t(initial_substate_of parent, std::string state_name, history_t state_history)
Constructor for the case when state is the initial substate of some parent state.
Definition agent.cpp:338
state_t(substate_of parent)
Constructor for the case when state is a substate of some parent state.
Definition agent.cpp:358
std::size_t nested_level() const noexcept
Query nested level for the state.
Definition state.hpp:1780
bool is_active() const noexcept
Is this state or any of its substates activated?
Definition agent.hpp:3751
state_t(state_t &&other)
Move constructor.
Definition agent.cpp:381
state_t(agent_t *target_agent, std::string state_name, state_t *parent_state, std::size_t nested_level, history_t state_history)
Fully initialized constructor.
Definition agent.cpp:273
const state_t & subscribe_message_handler(const mbox_t &from, Args &&... args) const
A helper for handle-methods implementation.
Definition agent.hpp:3915
const state_t & event(Args &&... args) const
Helper for subscription of event handler in this state.
Definition agent.hpp:3758
std::enable_if< details::is_agent_method_pointer< details::method_arity::nullary, Method_Pointer >::value, state_t & >::type on_exit(Method_Pointer pfn)
Set on exit handler.
Definition agent.hpp:3897
const state_t & suppress() const
Suppress processing of event in this state.
Definition agent.hpp:3853
std::string m_state_name
State name.
Definition state.hpp:1629
state_t(agent_t *agent, std::string state_name, history_t state_history)
Definition agent.cpp:320
bool has_subscription(const mbox_t &from) const
Check the presence of a subscription.
Definition agent.hpp:3775
state_t * m_parent_state
Parent state.
Definition state.hpp:1643
state_t(substate_of parent, std::string state_name, history_t state_history)
Constructor for the case when state is a substate of some parent state.
Definition agent.cpp:369
const state_t * actual_state_to_enter() const
Find actual state to be activated for agent.
Definition agent.cpp:526
void drop_subscription(const mbox_t &from, Method_Pointer &&pfn) const
Drop subscription.
Definition agent.hpp:3801
state_t(initial_substate_of parent)
Constructor for the case when state is the initial substate of some parent state.
Definition agent.cpp:327
const state_t * m_initial_substate
The initial substate.
Definition state.hpp:1656
bool operator==(const state_t &state) const noexcept
Definition agent.cpp:403
state_t(initial_substate_of parent, std::string state_name)
Constructor for the case when state is the initial substate of some parent state.
Definition agent.cpp:332
const state_t & just_switch_to(const state_t &target_state) const
Define handler which only switches agent to the specified state.
Definition agent.hpp:3844
size_t m_substate_count
Number of substates.
Definition state.hpp:1697
state_t(agent_t *agent, history_t state_history)
Definition agent.cpp:307
void call_on_enter() const noexcept
Call for on enter handler if defined.
Definition state.hpp:1837
bool operator!=(const state_t &state) const noexcept
Definition state.hpp:372
void call_on_exit() const noexcept
Call for on exit handler if defined.
Definition state.hpp:1850
agent_t *const m_target_agent
Owner of this state.
Definition state.hpp:1623
const state_t & transfer_to_state(mbox_t from, const state_t &target_state) const
An instruction for switching agent to the specified state and transfering event proceessing to new st...
Definition agent.hpp:3813
std::string query_name() const
Get textual name of the state.
Definition agent.cpp:409
const state_t & transfer_to_state(const state_t &target_state) const
An instruction for switching agent to the specified state and transfering event proceessing to new st...
Definition agent.hpp:3824
static constexpr const std::size_t max_deep
Max deep of nested states.
Definition state.hpp:163
state_t(substate_of parent, std::string state_name)
Constructor for the case when state is a substate of some parent state.
Definition agent.cpp:363
const state_t * m_last_active_substate
Last active substate.
Definition state.hpp:1676
void handle_time_limit_on_enter() const
A special handler of time limit to be used on entering into state.
Definition agent.cpp:570
state_t(agent_t *agent, std::string state_name)
Definition agent.cpp:314
const state_t & event(mbox_t from, Args &&... args) const
Helper for subscription of event handler in this state.
Definition agent.hpp:3767
void activate() const
Switch agent to that state.
Definition agent.cpp:474
void drop_subscription(const mbox_t &from) const
Drop subscription.
Definition agent.hpp:3794
history_t
Type of history for state.
Definition state.hpp:172
@ none
State has no history.
@ deep
State has deep history.
@ shallow
State has shallow history.
on_enter_handler_t m_on_enter
Handler for the enter to the state.
Definition state.hpp:1705
std::unique_ptr< time_limit_t > m_time_limit
A definition of time limit for the state.
Definition state.hpp:1723
std::size_t m_nested_level
Nesting level for state.
Definition state.hpp:1686
void update_history_in_parent_states() const
A helper method which is used during state change for update state with history.
Definition agent.cpp:549
void handle_time_limit_on_exit() const
A special handler of time limit to be used on exiting from state.
Definition agent.cpp:576
state_t(agent_t *agent)
Definition agent.cpp:301
A class for creating a subscription to messages from the mbox.
Definition agent.hpp:174
std::enable_if< details::lambda_traits::is_lambda< Lambda >::value, subscription_bind_t & >::type event(Lambda &&lambda, thread_safety_t thread_safety=not_thread_safe)
Make subscription to the message by lambda-function.
Definition agent.hpp:3510
std::enable_if< details::is_agent_method_pointer< details::method_arity::unary, Method_Pointer >::value, subscription_bind_t & >::type event(Method_Pointer pfn, thread_safety_t thread_safety=not_thread_safe)
Make subscription to the message.
Definition agent.hpp:3490
std::vector< const state_t * > state_vector_t
Type of vector of states.
Definition agent.hpp:414
mbox_t m_mbox_ref
Mbox for messages to subscribe.
Definition agent.hpp:407
subscription_bind_t & just_switch_to(const state_t &target_state)
Define handler which only switches agent to the specified state.
Definition agent.hpp:3689
void create_subscription_for_states(const std::type_index &msg_type, const event_handler_method_t &method, thread_safety_t thread_safety, event_handler_kind_t handler_kind) const
Create subscription of event for all states.
Definition agent.hpp:3712
subscription_bind_t(agent_t &agent, const mbox_t &mbox_ref)
Definition agent.hpp:3460
subscription_bind_t & in(const state_t &state)
Set up a state in which events are allowed be processed.
Definition agent.hpp:3469
subscription_bind_t & suppress()
Suppress processing of event in this state.
Definition agent.hpp:3665
subscription_bind_t & transfer_to_state(const state_t &target_state)
An instruction for switching agent to the specified state and transfering event proceessing to new st...
Definition agent.hpp:3532
state_vector_t m_states
States of agents the event to be subscribed in.
Definition agent.hpp:421
void ensure_handler_can_be_used_with_mbox(const so_5::details::msg_type_and_handler_pair_t &handler) const
Additional check for subscription to a mutable message from MPMC mbox.
Definition agent.hpp:3739
agent_t * m_agent
Agent to which we are subscribing.
Definition agent.hpp:405
An indentificator for the timer.
Definition timers.hpp:73
void release() noexcept
Release the timer event.
Definition timers.hpp:99
A result of message transformation.
An implementation of backoff object with usage of std::yield.
Definition spinlocks.hpp:38
#define SO_5_EXPORT
Definition declspec.hpp:26
#define SO_5_TYPE
Definition declspec.hpp:46
#define SO_5_IMPORT
Definition declspec.hpp:27
#define SO_5_FUNC
Definition declspec.hpp:48
#define SO_5_LOG_ERROR(logger, var_name)
A special macro for helping error logging.
#define SO_5_LOG_ERROR_IMPL(logger, file, line, var_name)
An implementation for SO_5_LOG_ERROR macro.
#define SO_5_THROW_EXCEPTION_IMPL(file, line, error_code, desc)
Definition exception.hpp:71
#define SO_5_THROW_EXCEPTION(error_code, desc)
Definition exception.hpp:74
demand_handler_pfn_t select_demand_handler_for_message(const agent_t &agent, const message_ref_t &msg)
A helper function to select actual demand handler in dependency of message kind.
Definition agent.cpp:1227
mbox_t make_direct_mbox_with_respect_to_custom_factory(partially_constructed_agent_ptr_t agent_ptr, const agent_tuning_options_t &tuning_options, mbox_t standard_mbox)
Helper for creation of the direct mbox for an agent.
Definition agent.cpp:593
unsigned int ensure_valid_agent_name_length(std::size_t length)
Definition agent.cpp:83
std::string create_anonymous_state_name(const agent_t *agent, const state_t *st)
Definition agent.cpp:183
const state_t deadletter_state(nullptr, "<DEADLETTER_STATE>")
A special object to be used as state for make subscriptions for deadletter handlers.
subscription_storage_factory_t detect_subscription_storage_factory_to_use(environment_t &env, const agent_tuning_options_t &tuning_options)
Helper for selection of subscription storage factory.
Definition agent.cpp:630
const state_t awaiting_deregistration_state(nullptr, "<AWAITING_DEREGISTRATION_AFTER_UNHANDLED_EXCEPTION>")
A special object for the state in which agent is awaiting for deregistration after unhandled exceptio...
Enumeration of cooperation deregistration reasons.
Definition coop.hpp:39
const int normal
Normal deregistration.
Definition coop.hpp:46
Various helpers for event subscription.
void ensure_handler_can_be_used_with_mbox(const ::so_5::details::msg_type_and_handler_pair_t &handler, const ::so_5::mbox_t &target_mbox)
Ensure that mutability of message is compatible with mutability of target mbox.
Helper templates for detection of lambda-type traits.
M * get_ptr(const intrusive_ptr_t< user_type_message_t< M > > &msg) noexcept
A helper function to get a const raw pointer from smart pointer.
M * get_ptr(const intrusive_ptr_t< M > &msg) noexcept
A helper function to get a const raw pointer from smart pointer.
Implementation details for implementation of rollback on exception helper.
Some reusable and low-level classes/functions which can be used in public header files.
auto make_message_instance(Args &&... args) -> std::unique_ptr< typename message_payload_type< Msg >::envelope_type >
A helper for allocate instance of a message.
Definition message.hpp:841
mhood_type_t
A special selector for mhood_t implementations.
Definition mhood.hpp:35
@ classical_signal
Message type is a classical signal derived from so_5::signal_t.
@ classical_message
Message type is a classical message derived from so_5::message_t.
@ user_type_message
Message type is not related to so_5::message_t.
void abort_on_fatal_error(L logging_lambda) noexcept
auto do_with_rollback_on_exception(Main_Action main_action, Rollback_Action rollback_action) -> decltype(main_action())
Helper function for do some action with rollback in the case of an exception.
auto invoke_noexcept_code(L lambda) noexcept -> decltype(lambda())
method_arity
A special enumeration to specify arity of lambda-function or method.
@ nullary
Method or function has no arguments.
@ unary
Method or function has just one argument.
scope_exit_details::at_exit_t< L > at_scope_exit(L &&l)
Helper function for creation action to be performed at scope exit.
envelope_t & message_to_envelope(const message_ref_t &src_msg)
A helper function for casting message instance to envelope instance.
access_context_t
Information about context on that enveloped message is handled.
Internal namespace with details of agent_t implementation.
Definition agent.hpp:462
Various helpers for message delivery tracing mechanism.
void safe_trace_state_leaving(const agent_t &state_owner, const state_t &state)
Helper for tracing the fact of leaving a state.
void safe_trace_state_entering(const agent_t &state_owner, const state_t &state)
Helper for tracing the fact of entering into a state.
void trace_deadletter_handler_search_result(const execution_demand_t &demand, const char *context_marker, const event_handler_data_t *search_result)
Helper for tracing the result of search of deadletter handler.
void trace_event_handler_search_result(const execution_demand_t &demand, const char *context_marker, const event_handler_data_t *search_result)
Helper for tracing the result of event handler search.
Details of SObjectizer run-time implementations.
Definition agent.cpp:780
void process_unhandled_unknown_exception(current_thread_id_t working_thread_id, agent_t &a_exception_producer) noexcept
Processor of unhandled exception of unknown type from agent's event handler.
void process_unhandled_exception(current_thread_id_t working_thread_id, const std::exception &ex, agent_t &a_exception_producer) noexcept
Processor of unhandled exception from agent's event handler.
static std::unique_ptr< sinks_storage_t > create_sinks_storage_if_necessary(partially_constructed_agent_ptr_t owner_ptr, so_5::message_limit::description_container_t &&descriptions)
Create info_storage object if there are some message limits.
Implementation details of error_logging facility.
void ensure_not_null(const delivery_filter_unique_ptr_t &ptr)
Helper function that throws if a pointer to delivery_filter is null.
Definition mbox.hpp:107
void deliver_message(message_delivery_mode_t delivery_mode, abstract_message_box_t &target, std::type_index subscription_type, message_ref_t msg)
Deliver message.
Definition mbox.hpp:413
void deliver_signal(message_delivery_mode_t delivery_mode, abstract_message_box_t &target)
Deliver signal.
Definition mbox.hpp:445
void deliver_message(message_delivery_mode_t delivery_mode, abstract_message_box_t &target, std::type_index subscription_type, std::unique_ptr< Message > msg)
Deliver message.
Definition mbox.hpp:379
Internal implementation of message limits related stuff.
Definition message.hpp:883
action_t make_action_for_message_transformer(Lambda &&transformator)
Helper function to make an action that performs message transformation.
SO_5_FUNC void redirect_reaction(const overlimit_context_t &ctx, const mbox_t &to)
Actual implementation of redirect message reaction.
SO_5_FUNC void abort_app_reaction(const overlimit_context_t &ctx)
Actual implementation of abort application reaction.
SO_5_FUNC void drop_message_reaction(const overlimit_context_t &ctx)
Actual implementation of drop message reaction.
action_t make_action_for_signal_transformer(Lambda &&transformator)
Helper function to make an action that performs signal transformation.
SO_5_FUNC void transform_reaction(const overlimit_context_t &ctx, const mbox_t &to, const std::type_index &msg_type, const message_ref_t &message)
Actual implementation of transform reaction.
All stuff related to message limits.
Definition message.hpp:862
void accept_one_indicator(description_container_t &to, const log_then_abort_app_indicator_t< M, L > &indicator)
Helper function for accepting log_then_abort_app_indicator and storing the corresponding description ...
void accept_indicators(description_container_t &)
void accept_indicators(description_container_t &to, I &&indicator, Args &&... others)
Helper function for constructing limits description from a series of limit indicators.
void accept_one_indicator(description_container_t &to, const drop_indicator_t< M > &indicator)
Helper function for accepting drop_indicator and storing the corresponding description into the limit...
void accept_one_indicator(description_container_t &to, transform_indicator_t< M > indicator)
Helper function for accepting transform_indicator and storing the corresponding description into the ...
void accept_one_indicator(description_container_t &to, const abort_app_indicator_t< M > &indicator)
Helper function for accepting abort_app_indicator and storing the corresponding description into the ...
void accept_one_indicator(description_container_t &to, redirect_indicator_t< Msg, Lambda > indicator)
Helper function for accepting redirect_indicator and storing the corresponding description into the l...
Helpers for working with priorities.
Definition priority.hpp:73
const priority_t p0
Definition priority.hpp:79
const priority_t p5
Definition priority.hpp:84
void for_each_priority(Lambda l)
Does enumeration of all priorities.
Definition priority.hpp:193
const priority_t p7
Definition priority.hpp:86
const priority_t p3
Definition priority.hpp:82
const priority_t p6
Definition priority.hpp:85
const priority_t p1
Definition priority.hpp:80
const priority_t p2
Definition priority.hpp:81
priority_t prev(priority_t p)
Get the previous priority value.
Definition priority.hpp:155
bool has_prev(priority_t p)
Is there lower priority?
Definition priority.hpp:143
const priority_t default_priority
Default priority value.
Definition priority.hpp:97
priority_t next(priority_t p)
Get the next priority value.
Definition priority.hpp:128
const priority_t p4
Definition priority.hpp:83
bool has_next(priority_t p)
Is there higher priority?
Definition priority.hpp:116
const unsigned int total_priorities_count
Total count of priorities.
Definition priority.hpp:105
Private part of message limit implementation.
Definition agent.cpp:33
std::size_t to_size_t(priority_t priority)
Helper function for conversion from priority to size_t.
Definition priority.hpp:48
const int rc_nullptr_as_result_of_user_mbox_factory
nullptr returned by user-provided mbox factory.
Definition ret_code.hpp:468
SO_5_FUNC subscription_storage_factory_t flat_set_based_subscription_storage_factory(std::size_t initial_capacity)
Factory for subscription storage based on sorted std::vector.
const int rc_disp_create_failed
Unable to create a dispatcher.
Definition ret_code.hpp:97
const int rc_layer_not_binded_to_so_env
The layer is not bound to the SObjectizer Environment.
Definition ret_code.hpp:152
message_delivery_mode_t
Possible modes of message/signal delivery.
Definition types.hpp:172
const int rc_coop_define_agent_failed
Cooperation couldn't be registered.
Definition ret_code.hpp:74
priority_t to_priority_t(std::size_t v)
Helper function for conversion from size_t to priority.
Definition priority.hpp:62
void ensure_message_with_actual_data(const Msg *m)
A special checker to guarantee that the message is an instance of the message_t (not signal_t) and ha...
Definition message.hpp:539
agent_context_t operator+(agent_context_t ctx, custom_direct_mbox_factory_t factory)
const int rc_state_nesting_is_too_deep
Nesting of agent states is too deep.
Definition ret_code.hpp:59
const int rc_agent_incompatible_type_conversion
It is impossible to make a cast to that type.
Definition ret_code.hpp:36
const int rc_initial_substate_already_defined
Initial substate for a composite state is already defined.
Definition ret_code.hpp:66
const int rc_unable_to_start_extra_layer
Layer initialization is failed.
Definition ret_code.hpp:164
SO_5_FUNC subscription_storage_factory_t default_subscription_storage_factory()
Factory for default subscription storage object.
mbox_type_t
Type of the message box.
Definition mbox.hpp:163
const int rc_negative_value_for_pause
An attempt to use negative value for pause argument for delayed or periodic message/signal.
Definition ret_code.hpp:270
const int rc_prepared_select_is_active_now
An attempt to activate prepared-select when an operation on that prepared-select object is already ac...
Definition ret_code.hpp:418
void ensure_not_signal()
A special compile-time checker to guarantee that the message class is not a signal class.
Definition message.hpp:517
const int rc_msg_chain_overflow
Definition ret_code.hpp:203
const int rc_coop_is_not_in_registered_state
An attempt to do something with coop that is not in registered state.
Definition ret_code.hpp:395
agent_context_t operator+(agent_context_t ctx, message_limit::abort_app_indicator_t< M > limit)
const int rc_mutable_msg_cannot_be_periodic
An attempt to send mutable message as a periodic message.
Definition ret_code.hpp:241
const int rc_cannot_set_stop_guard_when_stop_is_started
An attempt to set up a new stop_guard when the stop operation is already in progress.
Definition ret_code.hpp:259
void operator>>=(agent_t *agent, const state_t &new_state)
A shortcat for switching the agent state.
Definition agent.hpp:3953
constexpr unsigned int max_redirection_deep
Maximum deep of message redirections.
const int rc_no_preallocated_resources_for_agent
There are no resources that must have been in place for an agent in advance.
Definition ret_code.hpp:481
const int rc_transfer_to_state_loop
A loop in transfer_to_state detected.
Definition ret_code.hpp:337
exception_reaction_t
A reaction of SObjectizer to an exception from agent event.
Definition agent.hpp:65
@ abort_on_exception
Execution of application must be aborted immediatelly.
Definition agent.hpp:67
@ inherit_exception_reaction
Exception reaction should be inherited from SO Environment.
Definition agent.hpp:81
@ ignore_exception
Exception should be ignored and agent should continue its work.
Definition agent.hpp:75
@ deregister_coop_on_exception
Definition agent.hpp:73
@ shutdown_sobjectizer_on_exception
Definition agent.hpp:70
SO_5_FUNC error_logger_shptr_t create_stderr_logger()
A factory for creating error_logger implemenation which uses std::stderr as log stream.
void ensure_not_mutable_signal()
A special compile-time checker to guarantee that S is not a mutable signal.
Definition message.hpp:563
const int rc_coop_already_destroyed
An attempt to get a pointer to already destroyed cooperation.
Definition ret_code.hpp:384
agent_context_t operator+(agent_context_t ctx, so_5::priority_t agent_priority)
const int rc_agent_name_too_long
Length of an agent name is too large.
Definition ret_code.hpp:519
current_thread_id_t null_current_thread_id()
Get NULL thread id.
const thread_safety_t not_thread_safe
Shorthand for thread unsafety indicator.
Definition types.hpp:62
const int rc_msg_chain_is_full
Attempt to push a message to full message queue.
Definition ret_code.hpp:193
priority_t
Definition of supported priorities.
Definition priority.hpp:28
const thread_safety_t thread_safe
Shorthand for thread safety indicator.
Definition types.hpp:69
const int rc_operation_enabled_only_on_agent_working_thread
An attempt to perform an operation which is enabled only on agent's working thread.
Definition ret_code.hpp:44
const int rc_autoshutdown_must_be_enabled
An attempt to launch environment with autoshutdown disabled in conditions where autoshutdown must be ...
Definition ret_code.hpp:227
const int rc_agent_is_not_the_state_owner
Agent doesn't own this state.
Definition ret_code.hpp:108
const int rc_scenario_must_be_completed
Testing scenario must be completed before an attempt to do the current operation.
Definition ret_code.hpp:367
const int rc_extensible_select_is_active_now
An attempt to modify or activate extensible-select when an operation on that extensible-select object...
Definition ret_code.hpp:410
const int rc_agent_unknown_state
Trying to switch to the unknown state.
Definition ret_code.hpp:30
message_mutability_t
A enum with variants of message mutability or immutability.
Definition types.hpp:94
std::thread::id raw_id_from_current_thread_id(const current_thread_id_t &w)
Get the raw thread id from current_thread_id.
infinite_wait_indication
A type for special marker for infitite waiting on service request or on receive from mchain.
const int rc_trying_to_add_extra_layer_that_already_exists_in_extra_list
The layer is already bound to the SObjectizer Environment as an extra layer.
Definition ret_code.hpp:161
const int rc_several_limits_for_one_message_type
An attempt to define several limits for one message type.
Definition ret_code.hpp:130
const int rc_layer_does_not_exist
A layer with the specified type doesn't exist.
Definition ret_code.hpp:167
const int rc_invalid_time_limit_for_state
Invalid value of time limit for an agent's state.
Definition ret_code.hpp:539
const int rc_agent_to_disp_binding_failed
Binding of agent to dispatcher failed.
Definition ret_code.hpp:81
thread_safety_t
Thread safety indicator.
Definition types.hpp:50
@ unsafe
Not thread safe.
@ safe
Thread safe.
const int rc_priority_quote_illegal_value
Illegal value of quote for a priority.
Definition ret_code.hpp:174
const int rc_several_handlers_for_one_message_type
Attempt to define several handlers for one msg_type.
Definition ret_code.hpp:206
SO_5_FUNC subscription_storage_factory_t hash_table_based_subscription_storage_factory()
Factory for default subscription storage based on std::unordered_map.
const int rc_msg_chain_doesnt_support_subscriptions
Attempt to make subscription for message chain.
Definition ret_code.hpp:196
intrusive_ptr_t< Derived > make_agent_ref(Derived *agent)
Helper function template for the creation of smart pointer to an agent.
Definition agent.hpp:3400
const infinite_wait_indication infinite_wait
A special indicator for infinite waiting on service request or on receive from mchain.
const int rc_stored_msg_inspection_result_not_found
There is no stored msg inspection result in the testing scenario.
Definition ret_code.hpp:526
message_kind_t
A enum with variants of message kinds.
Definition types.hpp:109
@ user_type_message
Message is an user type message.
@ enveloped_msg
Message is an envelope with some other message inside.
agent_context_t operator+(agent_context_t ctx, message_limit::drop_indicator_t< M > limit)
const int rc_empty_agent_name
Name for an agent can't be empty.
Definition ret_code.hpp:512
const int rc_agent_deactivated
Agent can't change state because the agent is already deactivated.
Definition ret_code.hpp:432
no_wait_indication
A type for special marker for no waiting on service request or on receive from mchain.
SO_5_FUNC void swap(name_for_agent_t &a, name_for_agent_t &b) noexcept
Definition agent.cpp:150
timer_id_t send_periodic(Target &&target, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period, Args &&... args)
A utility function for creating and delivering a periodic message to the specified destination.
std::enable_if< is_signal< M >::value, mhood_t< immutable_msg< M > > >::type to_immutable(mhood_t< mutable_msg< M > >)
Definition mhood.hpp:607
const int rc_stored_state_name_not_found
There is no stored state name in the testing scenario.
Definition ret_code.hpp:374
mbox_id_t null_mbox_id()
Default value for null mbox_id.
Definition types.hpp:39
std::enable_if<!is_signal< M >::value, mhood_t< immutable_msg< M > > >::type to_immutable(mhood_t< mutable_msg< M > > msg)
Transform mutable message instance into immutable.
Definition mhood.hpp:597
const int rc_another_state_switch_in_progress
An attempt to switch agent state when another switch operation is in progress.
Definition ret_code.hpp:216
work_thread_activity_tracking_t
Values for dispatcher's work thread activity tracking.
Definition types.hpp:75
@ unspecified
Tracking mode is specified elsewhere.
const no_wait_indication no_wait
A special indicator for no waiting on service request or on receive from mchain.
const int rc_unable_to_define_new_step
New step can't be defined if testing scenario is already started or finished.
Definition ret_code.hpp:359
const int rc_msg_tracing_disabled
Message delivery tracing is disabled and cannot be used.
Definition ret_code.hpp:182
message_ownership_t
Type of ownership of a message instance inside message_holder.
const int rc_unable_to_register_coop_during_shutdown
It is impossible to register cooperation during SObjectizer Environment shutdown.
Definition ret_code.hpp:89
intrusive_ptr_t(std::unique_ptr< T >) -> intrusive_ptr_t< T >
msink_t SO_5_FUNC wrap_to_msink(const mbox_t &mbox, priority_t sink_priority=prio::p0)
Helper for wrapping an existing mbox into message_sink.
Definition mbox.cpp:109
delivery_possibility_t
Result of checking delivery posibility.
Definition mbox.hpp:39
const int rc_no_initial_substate
An attempt to change agent state to a new composite state which have no initial state defined.
Definition ret_code.hpp:52
const int rc_unable_to_join_thread_by_itself
An attempt to call join() from the joinable thread itself.
Definition ret_code.hpp:402
SO_5_FUNC subscription_storage_factory_t adaptive_subscription_storage_factory(std::size_t threshold, const subscription_storage_factory_t &small_storage_factory, const subscription_storage_factory_t &large_storage_factory)
Factory for adaptive subscription storage.
const int rc_agent_has_no_cooperation
Agent is not bound to a cooperation.
Definition ret_code.hpp:33
const int rc_null_message_data
Null message data.
Definition ret_code.hpp:144
const int rc_illegal_subscriber_for_mpsc_mbox
An attempt to create illegal subscription to mpsc_mbox.
Definition ret_code.hpp:115
const int rc_msg_chain_is_empty
Attempt to get message from empty message queue.
Definition ret_code.hpp:190
outliving_reference_t< const T > outliving_const(T const &r)
Make outliving_reference wrapper for const reference.
const int rc_unknown_exception_type
An exception of unknown type is caught.
Definition ret_code.hpp:556
void ensure_signal()
A special compile-time checker to guarantee that the Msg is derived from the signal_t.
Definition message.hpp:584
void ensure_classical_message()
A special compile-time checker to guarantee that Msg is derived from message_t.
Definition message.hpp:607
SO_5_FUNC subscription_storage_factory_t vector_based_subscription_storage_factory(std::size_t initial_capacity)
Factory for subscription storage based on unsorted std::vector.
const int rc_msg_chain_doesnt_support_delivery_filters
Attempt to set delivery_filter for message chain.
Definition ret_code.hpp:199
const int rc_environment_error
so_environment launch is failed.
Definition ret_code.hpp:24
outliving_reference_t< const T > outliving_const(outliving_reference_t< T > r)
Make outliving_reference wrapper for const reference.
SO_5_FUNC subscription_storage_factory_t map_based_subscription_storage_factory()
Factory for subscription storage based on std::map.
const int rc_empty_name
The empty name doesn't allowed.
Definition ret_code.hpp:532
const int rc_unexpected_error
Unclassified error.
Definition ret_code.hpp:559
SO_5_FUNC subscription_storage_factory_t adaptive_subscription_storage_factory(std::size_t threshold)
Factory for adaptive subscription storage.
agent_context_t operator+(environment_t &env, Option arg)
A plus operator for creating agent_context object from a reference to Environment and single agent tu...
agent_context_t operator+(agent_context_t ctx, message_limit::redirect_indicator_t< M, L > limit)
agent_context_t operator+(agent_context_t ctx, message_limit::log_then_abort_app_indicator_t< M, L > limit)
agent_context_t operator+(agent_context_t ctx, subscription_storage_factory_t factory)
const int rc_attempt_to_cast_to_envelope_on_nullptr
An attempt to cast message to message envelope when a pointer to message is NULL.
Definition ret_code.hpp:351
const int rc_evt_handler_already_provided
A handler for that event/mbox/state is already registered.
Definition ret_code.hpp:105
agent_context_t operator+(agent_context_t ctx, name_for_agent_t agent_name)
const int rc_mutable_msg_cannot_be_delivered_via_mpmc_mbox
An attempt to deliver mutable message via MPMC mbox.
Definition ret_code.hpp:234
const int rc_trying_to_add_extra_layer_that_already_exists_in_default_list
The layer is already bound to the SObjectizer Environment as a default layer.
Definition ret_code.hpp:158
event_handler_kind_t
Kind of an event handler.
Definition types.hpp:154
const int rc_disp_binder_already_set_for_agent
The dispatcher binder is already set for the agent.
Definition ret_code.hpp:492
current_thread_id_t query_current_thread_id()
Get the ID of the current thread.
const int rc_nullptr_as_delivery_filter_pointer
nullptr can't be passed as delivery_filter.
Definition ret_code.hpp:454
const int rc_not_implemented
Feature or method has no implementation yet.
Definition ret_code.hpp:546
const int rc_message_has_no_limit_defined
An attempt to create subscription to message without predefined limit for that message type.
Definition ret_code.hpp:123
const int rc_negative_value_for_period
An attempt to use negative value for period argument for periodic message/signal.
Definition ret_code.hpp:280
outliving_reference_t< T > outliving_mutable(T &r)
Make outliving_reference wrapper for mutable reference.
const int rc_mpsc_mbox_expected
An instance of MPSC mbox is expected as custom direct mbox.
Definition ret_code.hpp:443
const int rc_subscription_to_mutable_msg_from_mpmc_mbox
An attempt to make subscription on mutable message from MPMC mbox.
Definition ret_code.hpp:251
const int rc_trying_to_add_nullptr_extra_layer
Unable to bind a layer by the null pointer to it.
Definition ret_code.hpp:155
agent_context_t operator+(agent_context_t ctx, message_limit::transform_indicator_t< M > limit)
const int rc_no_disp_binder_for_agent
The dispatcher binder is not set for the agent yet.
Definition ret_code.hpp:505
Type for case when agent has no user-provided name.
SO_5_FUNC std::array< char, c_string_size > make_c_string() const noexcept
Make a c-string with text representation of a value.
Definition agent.cpp:39
static constexpr std::string_view c_string_prefix
Prefix to be used for string representation.
static constexpr std::size_t c_string_size
static constexpr std::string_view c_string_suffix
Suffix to be used for string representation.
Check whether T is a non-static member function pointer.
A detector that type is a lambda or functional object.
static std::unique_ptr< E > make(Args &&... args)
Definition message.hpp:803
A meta-function for selection of type of accessors mixin.
A meta-function for selection a base of message_holder implementation in compile-time.
static const constexpr message_mutability_t mutability
Definition message.hpp:414
static const constexpr message_mutability_t mutability
Definition message.hpp:425
Detector of message type traits in dependency of message immutability or mutability.
Definition message.hpp:398
static const constexpr message_mutability_t mutability
Definition message.hpp:403
A special detector of message immutability/mutability.
Definition mhood.hpp:442
static constexpr const message_mutability_t mutability
Definition mhood.hpp:443
A special selector of message hood type.
Definition mhood.hpp:425
static constexpr const mhood_type_t mhood_type
Definition mhood.hpp:426
static void exec(Main_Action main_action, rollbacker_t< Rollback_Action > &rollback)
static Result exec(Main_Action main_action, rollbacker_t< Rollback_Action > &rollback)
A description of event execution demand.
mbox_id_t m_mbox_id
ID of mbox.
void call_handler(current_thread_id_t thread_id)
Helper method to simplify demand execution.
demand_handler_pfn_t m_demand_handler
Demand handler.
agent_t * m_receiver
Receiver of demand.
message_ref_t m_message_ref
Event incident.
const message_limit::control_block_t * m_limit
Optional message limit for that message.
execution_demand_t(agent_t *receiver, const message_limit::control_block_t *limit, mbox_id_t mbox_id, std::type_index msg_type, message_ref_t message_ref, demand_handler_pfn_t demand_handler) noexcept
std::type_index m_msg_type
Type of the message.
A helper class for temporary setting and then dropping the ID of the current working thread.
Definition agent.hpp:474
working_thread_id_sentinel_t(so_5::current_thread_id_t &id_var, so_5::current_thread_id_t value_to_set)
Definition agent.hpp:477
Information about event_handler and its properties.
thread_safety_t m_thread_safety
Is event handler thread safe or not.
event_handler_method_t m_method
Method for handling event.
event_handler_kind_t m_kind
Kind of this event handler.
Helper class to be used as a comparator for msinks.
bool operator()(const msink_t &a, const msink_t &b) const noexcept
static std::pair< const abstract_sink_owner_t *, so_5::priority_t > safe_get_pair(const msink_t &from) noexcept
Helper for marking initial substate of composite state.
Definition state.hpp:57
A helper class for checking that message is a classical message derived from message_t class.
Definition message.hpp:480
A helper class for checking that message is a mutable message.
Definition message.hpp:496
A helper class for checking that message is a signal.
Definition message.hpp:463
A helper for detection presence of message of user type.
Definition message.hpp:443
Message limit with reaction 'abort the application'.
const unsigned int m_limit
Max count of waiting messages.
abort_app_indicator_t(unsigned int limit)
Initializing constructor.
A control block for one message limit.
Definition message.hpp:976
action_t m_action
Limit overflow reaction.
Definition message.hpp:984
std::atomic_uint m_count
The current count of the messages of that type.
Definition message.hpp:981
control_block_t(unsigned int limit, action_t action)
Initializing constructor.
Definition message.hpp:987
unsigned int m_limit
Limit value.
Definition message.hpp:978
static const control_block_t * none()
A special indicator about absence of control_block.
Definition message.hpp:1023
control_block_t & operator=(const control_block_t &o)
Copy operator.
Definition message.hpp:1009
static void decrement(const control_block_t *limit)
Definition message.hpp:1028
control_block_t(const control_block_t &o)
Copy constructor.
Definition message.hpp:997
A description of one message limit.
std::type_index m_msg_type
Type of message.
description_t(std::type_index msg_type, unsigned int limit, action_t action)
Initializing constructor.
unsigned int m_limit
Max count of waiting messages.
action_t m_action
Reaction to overload.
Message limit with reaction 'drop new message'.
drop_indicator_t(unsigned int limit)
Initializing constructor.
const unsigned int m_limit
Max count of waiting messages.
static void call(const overlimit_context_t &ctx, L action)
Helper class for calling pre-abort action.
static void call(const overlimit_context_t &ctx, L action)
Helper class for calling pre-abort action.
Message limit with reaction 'abort the application' and the possibility to call additional lambda bef...
const L m_lambda
Lambda for some last actions.
const unsigned int m_limit
Max count of waiting messages.
log_then_abort_app_indicator_t(unsigned int limit, L lambda)
Initializing constructor.
A mixin with message limit definition methods.
static drop_indicator_t< Msg > limit_then_drop(unsigned int limit)
A helper function for creating drop_indicator.
static redirect_indicator_t< Msg, Lambda > limit_then_redirect(unsigned int limit, Lambda dest_getter)
A helper function for creating redirect_indicator.
static transform_indicator_t< Source > limit_then_transform(unsigned int limit, Lambda &&transformator)
A helper function for creating transform_indicator.
static log_then_abort_app_indicator_t< M, L > limit_then_abort(unsigned int limit, L lambda)
A helper function for creating log_then_abort_app_indicator.
static abort_app_indicator_t< Msg > limit_then_abort(unsigned int limit)
A helper function for creating abort_app_indicator.
static auto limit_then_redirect(unsigned int limit, mbox_t destination)
A helper function for creating redirect_indicator.
static transformed_message_t< Msg > make_transformed(mbox_t mbox, Args &&... args)
Helper method for creating message transformation result.
static auto limit_then_transform(unsigned int limit, Lambda &&transformator)
A helper function for creating transform_indicator.
Description of context for overlimit action.
Definition message.hpp:895
const message_delivery_mode_t m_delivery_mode
Delivery mode for message delivery attempt.
Definition message.hpp:907
overlimit_context_t(mbox_id_t mbox_id, message_delivery_mode_t delivery_mode, const agent_t &receiver, const control_block_t &limit, unsigned int reaction_deep, const std::type_index &msg_type, const message_ref_t &message, const impl::action_msg_tracer_t *msg_tracer)
Initializing constructor.
Definition message.hpp:937
const mbox_id_t m_mbox_id
ID of mbox which is used for message delivery.
Definition message.hpp:901
const control_block_t & m_limit
Control block for message limit.
Definition message.hpp:913
const unsigned int m_reaction_deep
The current deep of overlimit reaction recursion.
Definition message.hpp:916
const agent_t & m_receiver
Receiver of the message (or enveloped message).
Definition message.hpp:910
const std::type_index & m_msg_type
Type of message to be delivered.
Definition message.hpp:919
const message_ref_t & m_message
A message (or enveloped message) to be delivered.
Definition message.hpp:922
const impl::action_msg_tracer_t * m_msg_tracer
An optional pointer to tracer object for message delivery tracing.
Definition message.hpp:933
Indication that a message must be redirected on overlimit.
Lambda m_destination_getter
A lambda/functional object which returns mbox for redirection.
const unsigned int m_limit
Max count of waiting messages.
redirect_indicator_t(unsigned int limit, Lambda destination_getter)
Initializing constructor.
An indicator of transform reaction on message overlimit.
transform_indicator_t(unsigned int limit, action_t action)
Initializing constructor.
static constexpr message_mutability_t mutability()
Helper for getting message mutability flag.
Definition message.hpp:762
static payload_type & payload_reference(message_t &msg)
Helper for getting a const reference to payload part.
Definition message.hpp:753
static constexpr const bool is_signal
Is it a signal type or message type.
Definition message.hpp:716
static payload_type * extract_payload_ptr(message_ref_t &msg)
Helper for extraction of pointer to payload part.
Definition message.hpp:732
static envelope_type * extract_envelope_ptr(message_ref_t &msg)
Helper for extraction of pointer to envelope part.
Definition message.hpp:745
static std::type_index subscription_type_index()
Type ID for subscription.
Definition message.hpp:720
Implementation details for message_payload_type.
Definition message.hpp:626
static constexpr message_mutability_t mutability()
Helper for getting message mutability flag.
Definition message.hpp:684
static payload_type & payload_reference(message_t &msg)
Helper for getting a const reference to payload part.
Definition message.hpp:676
static envelope_type * extract_envelope_ptr(message_ref_t &msg)
Helper for extraction of pointer to envelope part.
Definition message.hpp:668
static std::type_index subscription_type_index()
Type ID for subscription.
Definition message.hpp:642
static constexpr const bool is_signal
Is it a signal type or message type.
Definition message.hpp:638
static payload_type * extract_payload_ptr(message_ref_t &msg)
Helper for extraction of pointer to payload part.
Definition message.hpp:657
A helper class for detection of payload type of message.
Definition message.hpp:783
Helper type with method to be mixed into agent class.
static name_for_agent_t name_for_agent(std::string_view name)
A helper factory for making name_for_agent_t instance.
time_limit_t(duration_t limit, const state_t &state_to_switch)
Definition agent.cpp:207
void set_up_limit_for_agent(agent_t &agent, const state_t &current_state) noexcept
Definition agent.cpp:215
const state_t & m_state_to_switch
Definition agent.cpp:202
void drop_limit_for_agent(agent_t &agent, const state_t &current_state) noexcept
Definition agent.cpp:247
Helper for marking a substate of composite state.
Definition state.hpp:89
state_t * m_parent_state
Definition state.hpp:90
Template class for representing object of user type as a message.
Definition message.hpp:315
user_type_message_t(T &&o)
Initialization from temporary T object.
Definition message.hpp:340
kind_t so5_message_kind() const noexcept override
Detect the kind of the message.
Definition message.hpp:346
user_type_message_t(T &o)
Initialization from non-const T object.
Definition message.hpp:335
T m_payload
Instance of user message.
Definition message.hpp:321
user_type_message_t(const T &o)
Initialization from const T object.
Definition message.hpp:330
user_type_message_t(Args &&... args)
Initializing constructor.
Definition message.hpp:325
#define SO_5_VERSION_PATCH
Definition version.hpp:45
#define SO_5_VERSION_MAJOR
Definition version.hpp:24
#define SO_5_VERSION_MAKE(major, minor, patch)
Definition version.hpp:58
#define SO_5_VERSION_MINOR
Definition version.hpp:34