yasmine
recipe_callback_impl.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 #ifndef RECIPE_CALLBACK_IMPL_A5F81CB3_58BB_4506_908B_49FCBF0C519C
12 #define RECIPE_CALLBACK_IMPL_A5F81CB3_58BB_4506_908B_49FCBF0C519C
13 
14 
15 #include <map>
16 #include <stack>
17 #include <vector>
18 
19 #include "recipe_callback.hpp"
20 #include "behavior_struct.hpp"
21 
22 
23 namespace sxy
24 {
25 
26 
27 namespace model
28 {
29 
30 
31  class state_machine_model;
33  class region_model;
34  class state_model;
35 
36 
37 }
38 
39 
40 class recipe_callback_impl SX_FINAL:
41  public sx::genesis::recipe_callback
42 {
43 public:
44  explicit recipe_callback_impl( const sxy::model::state_machine_model& _state_machine_model,
45  std::vector<std::string> _namespaces, std::vector<std::string> _behavior_classes,
46  std::string _state_machine_name, std::string _state_machine_type );
47  virtual ~recipe_callback_impl() SX_NOEXCEPT SX_OVERRIDE;
48  SX_NO_COPY( recipe_callback_impl )
49  virtual std::string get_variable_content( const std::string& _variable_name ) SX_OVERRIDE;
50  virtual void before_loop( const std::string& _loop_name ) SX_OVERRIDE;
51  virtual void before_loop_iteration( const std::string& _loop_name ) SX_OVERRIDE;
52  virtual void after_loop_iteration( const std::string& _loop_name ) SX_OVERRIDE;
53  virtual bool check_loop_condition( const std::string& _loop_name ) const SX_OVERRIDE;
54  virtual void after_loop( const std::string& _loop_name ) SX_OVERRIDE;
55  virtual bool check_condition( const std::string& _condition_name ) const SX_OVERRIDE;
56  virtual void condition_begin( const std::string& _condition_name ) SX_OVERRIDE;
57  virtual void condition_end( const std::string& _condition_name ) SX_OVERRIDE;
58  virtual int get_switch_case( const std::string& _switch_name ) SX_OVERRIDE;
59 
60 
61 private:
62  std::string get_state_property( const std::string& _property ) const;
63  std::string get_pseudostate_property( const std::string& _property ) const;
64  std::string get_state_pseudostate_property( const std::string& _property ) const;
65  std::string get_event_property( const std::string& _property ) const;
66  std::string get_date_time_string() const;
67  std::string get_transition_events() const;
68  void fill_struct( const std::string& _loop_name );
69  void fill_one_behavior_struct( behavior_struct& _behavior, const std::string& _behavior_string );
70  static int get_index( const behavior_struct& _behavior_struct );
71 
72 
73  const sxy::model::state_machine_model& state_machine_model_;
74  std::map<const std::string, const std::string> map_of_values_;
75  std::vector<std::string> namespaces_;
76  std::vector<std::string> behavior_classes_;
77  std::size_t namespace_index_;
78  std::size_t base_class_index_;
79  std::size_t behavior_classes_index_;
80  std::size_t transition_index_;
81  std::size_t pseudostate_index_;
82  std::size_t state_pseudostate_index_;
83  std::stack<const sxy::model::state_model*> composite_states_stack_;
84  std::stack<const sxy::model::region_model*> regions_stack_;
85  std::stack<std::size_t> composite_states_index_stack_;
86  std::stack<std::size_t> regions_index_stack_;
87  std::size_t event_index_;
88  behavior_struct entry_behavior_;
89  behavior_struct do_behavior_;
90  behavior_struct exit_behavior_;
91  behavior_struct transition_guard_;
92  std::string active_switch_;
93 };
94 
95 
96 }
97 
98 
99 #endif
Definition: behavior_struct.hpp:25
Interface for a region in the model.
Definition: region_model.hpp:31
Definition: algorithm_parameters.hpp:16
Class representing a model of a complete state machine.
Definition: state_machine_model.hpp:33
Interface for a state in the model.
Definition: state_model.hpp:34
Interface for a composite state in the model.
Definition: composite_state_model.hpp:31