Remove dynamic exceptions
[anna.git] / include / anna / timex / internal / TickConsumer.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #ifndef anna_timex_internal_TickConsumer_hpp
10 #define anna_timex_internal_TickConsumer_hpp
11
12 #include <anna/comm/Handler.hpp>
13
14 namespace anna {
15
16 namespace comm {
17 class Communicator;
18 class SchedulerGuard;
19 }
20
21 namespace timex {
22
23 class Engine;
24
25 class TickConsumer : public comm::Handler {
26 public:
27   TickConsumer(Engine* timeController) :
28     comm::Handler(comm::Handler::Type::Custom, Support::None),
29     a_timeController(*timeController) {
30     a_pipe [0] = a_pipe [1] = -1;
31   }
32
33   int getfdWrite() const { return a_pipe [1]; }
34
35   std::string asString() const ;
36
37 private:
38   Engine& a_timeController;
39   int a_pipe [2];
40
41   void initialize() noexcept(false);
42   void apply() noexcept(false);
43   void finalize() ;
44   void clone() noexcept(false);
45 };
46
47 }
48 }
49
50 #endif
51
52
53