yasmine
specialized_event.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 SPECIALIZED_EVENT_CA823D7C_65A6_4094_8641_FA9496F11C1F
13 #define SPECIALIZED_EVENT_CA823D7C_65A6_4094_8641_FA9496F11C1F
14 
15 
16 #include "event_impl.hpp"
17 
18 
19 namespace sxy
20 {
21 
25 template<class _concrete_event, sxy::event_id _event_id, sxy::event_priority _event_priority = DEFAULT_EVENT_PRIORITY>
27 {
28 public:
30  explicit specialized_event(const std::string _name = std::string())
31  : event_impl( _event_id, _event_priority ),
32  name_( _name )
33  {
34  // Nothing to do.
35  }
36 
37 
38  virtual ~specialized_event() SX_NOEXCEPT SX_OVERRIDE
39  {
40  // Nothing to do.
41  }
42 
43 
44  SX_NO_COPY(specialized_event)
45 
46 
47  virtual std::string get_name() const SX_OVERRIDE
49  {
50  const std::string name = name_.empty() ? event_impl::get_name() : name_;
51  return(name);
52  }
53 
54 
57  virtual sxy::event_id get_id() const SX_OVERRIDE
58  {
59  return( _event_id );
60  }
61 
62 
65  static
66 #ifndef SX_CPP03_BOOST
67  constexpr
68 #endif
70  {
71  return( _event_id );
72  }
73 
74 
75 #ifdef SX_CPP03_BOOST
76 
77 
80  static sxe::shared_ptr< _concrete_event > create()
81  {
82  return( SX_MAKE_SHARED< _concrete_event >() );
83  }
84 
85 
88  template<typename _param_type1>
89  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1 )
90  {
91  return( SX_MAKE_SHARED< _concrete_event >( _p1 ) );
92  }
93 
94 
97  template<typename _param_type1, typename _param_type2>
98  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2 )
99  {
100  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2 ) );
101  }
102 
103 
106  template<typename _param_type1, typename _param_type2, typename _param_type3>
107  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3 )
108  {
109  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3 ) );
110  }
111 
112 
115  template<typename _param_type1, typename _param_type2, typename _param_type3, typename _param_type4>
116  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3,
117  const _param_type4& _p4 )
118  {
119  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3, _p4 ) );
120  }
121 
122 
125  template<typename _param_type1, typename _param_type2, typename _param_type3, typename _param_type4,
126  typename _param_type5>
127  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3,
128  const _param_type4& _p4, const _param_type5& _p5 )
129  {
130  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3, _p4, _p5 ) );
131  }
132 
133 
136  template<typename _param_type1, typename _param_type2, typename _param_type3, typename _param_type4,
137  typename _param_type5, typename _param_type6>
138  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3,
139  const _param_type4& _p4, const _param_type5& _p5, const _param_type6& _p6 )
140  {
141  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3, _p4, _p5, _p6 ) );
142  }
143 
144 
147  template<typename _param_type1, typename _param_type2, typename _param_type3, typename _param_type4,
148  typename _param_type5, typename _param_type6, typename _param_type7>
149  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3,
150  const _param_type4& _p4, const _param_type5& _p5, const _param_type6& _p6, const _param_type7& _p7 )
151  {
152  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3, _p4, _p5, _p6, _p7 ) );
153  }
154 
155 
158  template<typename _param_type1, typename _param_type2, typename _param_type3, typename _param_type4,
159  typename _param_type5, typename _param_type6, typename _param_type7, typename _param_type8>
160  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3,
161  const _param_type4& _p4, const _param_type5& _p5, const _param_type6& _p6, const _param_type7& _p7,
162  const _param_type8& _p8 )
163  {
164  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8 ) );
165  }
166 
167 
170  template<typename _param_type1, typename _param_type2, typename _param_type3, typename _param_type4,
171  typename _param_type5, typename _param_type6, typename _param_type7, typename _param_type8, typename _param_type9>
172  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3,
173  const _param_type4& _p4, const _param_type5& _p5, const _param_type6& _p6, const _param_type7& _p7,
174  const _param_type8& _p8, const _param_type9& _p9 )
175  {
176  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9 ) );
177  }
178 
179 
182  template<typename _param_type1, typename _param_type2, typename _param_type3, typename _param_type4,
183  typename _param_type5, typename _param_type6, typename _param_type7, typename _param_type8, typename _param_type9,
184  typename _param_type10>
185  static sxe::shared_ptr< _concrete_event > create( const _param_type1& _p1, const _param_type2& _p2, const _param_type3& _p3,
186  const _param_type4& _p4, const _param_type5& _p5, const _param_type6& _p6, const _param_type7& _p7,
187  const _param_type8& _p8, const _param_type9& _p9, const _param_type10& _p10 )
188  {
189  return( SX_MAKE_SHARED< _concrete_event >( _p1, _p2, _p3, _p4, _p5, _p6, _p7, _p8, _p9, _p10 ) );
190  }
191 
192 
193 #else
194  template<typename ... _param_types>
197  static sxe::shared_ptr< _concrete_event > create( _param_types... args )
198  {
199  return( SX_MAKE_SHARED< _concrete_event >( args... ) );
200  }
201 
202 
203 #endif
204 
205 
206 
207 private:
208  std::string name_;
209 };
210 
211 
212 }
213 
214 
215 #endif
specialized_event(const std::string _name=std::string())
Constructor.
Definition: specialized_event.hpp:30
virtual std::string get_name() const SX_OVERRIDE
Getter for event&#39;s name.
Definition: specialized_event.hpp:48
sxe::uint32_t event_id
The type alias for yasmine&#39;s event IDs.
Definition: event_id.hpp:26
static sxe::shared_ptr< _concrete_event > create(_param_types... args)
Method for creating an event with its parameters.
Definition: specialized_event.hpp:197
Definition: adapter_cpp11.hpp:21
Class that inherits event_impl and provides a fixed event ID and priority as well as create methods f...
Definition: specialized_event.hpp:26
virtual sxy::event_id get_id() const SX_OVERRIDE
Getter for event&#39;s ID.
Definition: specialized_event.hpp:57
Events that are processed by the state machine. An event can have an ID, a name and a priority (for p...
Definition: event_impl.hpp:25
static constexpr sxy::event_id get_event_id()
Static getter for event&#39;s ID.
Definition: specialized_event.hpp:69
virtual std::string get_name() const SX_OVERRIDE
Getter of event&#39;s name.
Definition: event_impl.cpp:45
virtual ~specialized_event() SX_NOEXCEPT SX_OVERRIDE
Definition: specialized_event.hpp:38