yasmine
sync_state_machine.hpp
Go to the documentation of this file.
1 // //
3 // This file is part of the Seadex yasmine ecosystem (http://yasmine.seadex.de). //
4 // Copyright (C) 2016-2017 Seadex GmbH //
5 // //
6 // Licensing information is available in the folder "license" which is part of this distribution. //
7 // The same information is available on the www @ http://yasmine.seadex.de/Licenses.html. //
8 // //
10 
11 
12 #ifndef SYNC_STATE_MACHINE_5352FE73_987B_4ECB_9320_685740A30EAA
13 #define SYNC_STATE_MACHINE_5352FE73_987B_4ECB_9320_685740A30EAA
14 
15 
16 #include <list>
17 #include "state_machine_base.hpp"
18 
19 
20 namespace sxy
21 {
22 
23 
28  public state_machine_base
29 {
30 public:
35  explicit sync_state_machine( const std::string& _name,
36  event_processing_callback* const _event_processing_callback = SX_NULLPTR );
37  virtual ~sync_state_machine() SX_NOEXCEPT SX_OVERRIDE;
38  SX_NO_COPY( sync_state_machine )
39 
40  virtual bool push( const event_sptr& _event ) SX_OVERRIDE;
41 
46  virtual bool fire_event( const event_sptr& _event ) SX_OVERRIDE;
47 
51  virtual bool run() SX_OVERRIDE;
52 
53 
54 private:
55  bool process_events_from_queue();
56 
57  std::list<event_sptr> event_list_;
58 };
59 
60 
63 
64 
65 }
66 
67 
68 #endif
sync_state_machine(const std::string &_name, event_processing_callback *const _event_processing_callback=SX_NULLPTR)
Constructor.
Definition: sync_state_machine.cpp:21
sync_state_machine state_machine
Definition: sync_state_machine.hpp:62
Class for the "single-threaded version" of the state machine. It provides the methods to start the st...
Definition: sync_state_machine.hpp:27
virtual bool push(const event_sptr &_event) SX_OVERRIDE
Definition: sync_state_machine.cpp:34
virtual bool fire_event(const event_sptr &_event) SX_OVERRIDE
Fire the given event.
Definition: sync_state_machine.cpp:41
Definition: adapter_cpp11.hpp:21
Callback interface that is called by a state machine during event processing. See the different metho...
Definition: event_processing_callback.hpp:37
sxe::shared_ptr< event > event_sptr
Definition: event_fwd.hpp:25
virtual ~sync_state_machine() SX_NOEXCEPT SX_OVERRIDE
Definition: sync_state_machine.cpp:28
virtual bool run() SX_OVERRIDE
Starts the state machine.
Definition: sync_state_machine.cpp:63
Definition: state_machine_base.hpp:45