| C++ Actor Framework 0.18
    | 
A schedule coordinator for testing purposes. More...
#include <test_coordinator.hpp>
 
  
| Public Types | |
| using | super = abstract_coordinator | 
| using | bool_predicate = std::function< bool()> | 
| A type-erased boolean predicate. | |
|  Public Types inherited from caf::scheduler::abstract_coordinator | |
| enum | utility_actor_id : size_t { printer_id , max_id } | 
|  Public Types inherited from caf::actor_system::module | |
| enum | id_t { scheduler , middleman , openssl_manager , network_manager , num_ids } | 
| Public Member Functions | |
| test_coordinator (actor_system &sys) | |
| bool | has_job () const | 
| Returns whether at least one job is in the queue. | |
| template<class T = resumable> | |
| T & | next_job () | 
| Returns the next element from the job queue as type T. | |
| template<class... Ts> | |
| decltype(auto) | peek () | 
| Peeks into the mailbox of next_job<scheduled_actor>(). | |
| template<class Handle > | |
| bool | prioritize (const Handle &x) | 
| Puts xat the front of the queue unless it cannot be found in the queue. | |
| template<class Predicate > | |
| size_t | run_jobs_filtered (Predicate predicate) | 
| Runs all jobs that satisfy the predicate. | |
| bool | try_run_once () | 
| Tries to execute a single event in FIFO order. | |
| bool | try_run_once_lifo () | 
| Tries to execute a single event in LIFO order. | |
| void | run_once () | 
| Executes a single event in FIFO order or fails if no event is available. | |
| void | run_once_lifo () | 
| Executes a single event in LIFO order or fails if no event is available. | |
| size_t | run (size_t max_count=std::numeric_limits< size_t >::max()) | 
| Executes events until the job queue is empty and no pending timeouts are left. | |
| bool | has_pending_timeout () const | 
| Returns whether at least one pending timeout exists. | |
| bool | trigger_timeout () | 
| Tries to trigger a single timeout. | |
| size_t | trigger_timeouts () | 
| Triggers all pending timeouts. | |
| size_t | advance_time (timespan x) | 
| Advances simulation time and returns the number of triggered timeouts. | |
| template<class F > | |
| void | after_next_enqueue (F f) | 
| void | inline_next_enqueue () | 
| Executes the next enqueued job immediately by using the after_next_enqueuehook. | |
| void | inline_all_enqueues () | 
| Executes all enqueued jobs immediately by using the after_next_enqueuehook. | |
| bool | detaches_utility_actors () const override | 
| Returns trueif this scheduler detaches its utility actors. | |
| detail::test_actor_clock & | clock () noexcept override | 
|  Public Member Functions inherited from caf::scheduler::abstract_coordinator | |
| abstract_coordinator (actor_system &sys) | |
| actor | printer () const | 
| Returns a handle to the central printing actor. | |
| size_t | num_utility_actors () const | 
| Returns the number of utility actors. | |
| virtual void | enqueue (resumable *what)=0 | 
| Puts whatinto the queue of a randomly chosen worker. | |
| actor_system & | system () | 
| const actor_system_config & | config () const | 
| size_t | max_throughput () const | 
| size_t | num_workers () const | 
| virtual bool | detaches_utility_actors () const | 
| Returns trueif this scheduler detaches its utility actors. | |
| void | start () override | 
| Starts any background threads needed by the module. | |
| void | init (actor_system_config &cfg) override | 
| Allows the module to change the configuration of the actor system during startup. | |
| id_t | id () const override | 
| Returns the identifier of this module. | |
| void * | subtype_ptr () override | 
| Returns a pointer to the subtype. | |
| virtual actor_clock & | clock () noexcept=0 | 
|  Public Member Functions inherited from caf::actor_system::module | |
| const char * | name () const noexcept | 
| Returns the human-redable name of the module. | |
| virtual void | start ()=0 | 
| Starts any background threads needed by the module. | |
| virtual void | stop ()=0 | 
| Stops all background threads of the module. | |
| virtual void | init (actor_system_config &)=0 | 
| Allows the module to change the configuration of the actor system during startup. | |
| virtual id_t | id () const =0 | 
| Returns the identifier of this module. | |
| virtual void * | subtype_ptr ()=0 | 
| Returns a pointer to the subtype. | |
| Public Attributes | |
| std::deque< resumable * > | jobs | 
| A double-ended queue representing our current job queue. | |
| Protected Member Functions | |
| void | start () override | 
| Starts any background threads needed by the module. | |
| void | stop () override | 
| Stops all background threads of the module. | |
| void | enqueue (resumable *ptr) override | 
| Puts whatinto the queue of a randomly chosen worker. | |
|  Protected Member Functions inherited from caf::scheduler::abstract_coordinator | |
| void | stop_actors () | 
| Additional Inherited Members | |
|  Static Public Member Functions inherited from caf::scheduler::abstract_coordinator | |
| static void | cleanup_and_release (resumable *) | 
| static size_t | default_thread_count () noexcept | 
|  Protected Attributes inherited from caf::scheduler::abstract_coordinator | |
| std::atomic< size_t > | next_worker_ | 
| ID of the worker receiving the next enqueue (round-robin dispatch). | |
| size_t | max_throughput_ | 
| Number of messages each actor is allowed to consume per resume. | |
| size_t | num_workers_ | 
| Configured number of workers. | |
| std::array< actor, max_id > | utility_actors_ | 
| Background workers, e.g., printer. | |
| actor_system & | system_ | 
| Reference to the host system. | |
A schedule coordinator for testing purposes.
| 
 | overridevirtualnoexcept | 
Implements caf::scheduler::abstract_coordinator.
| 
 | overridevirtual | 
Returns true if this scheduler detaches its utility actors. 
Reimplemented from caf::scheduler::abstract_coordinator.
| 
 | overrideprotectedvirtual | 
Puts what into the queue of a randomly chosen worker. 
Implements caf::scheduler::abstract_coordinator.
| bool caf::scheduler::test_coordinator::prioritize | ( | const Handle & | x | ) | 
Puts x at the front of the queue unless it cannot be found in the queue. 
Returns true if x exists in the queue and was put in front, false otherwise. 
| size_t caf::scheduler::test_coordinator::run | ( | size_t | max_count = std::numeric_limits< size_t >::max() | ) | 
Executes events until the job queue is empty and no pending timeouts are left.
Returns the number of processed events.
| 
 | overrideprotectedvirtual | 
Starts any background threads needed by the module.
Reimplemented from caf::scheduler::abstract_coordinator.
| 
 | overrideprotectedvirtual | 
Stops all background threads of the module.
Implements caf::actor_system::module.