Remove dynamic exceptions
[anna.git] / source / timex / Clock.cpp
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 #include <anna/timex/Clock.hpp>
10 #include <anna/timex/Engine.hpp>
11
12 using namespace anna;
13
14 anna::timex::Clock::Clock(const char* name, const Millisecond & timeout) :
15   TimeEvent(anna_ptrnumber_cast(this), timeout),
16   a_name(name) {
17 }
18
19 void anna::timex::Clock::expire(timex::Engine* timeController)
20 noexcept(false) {
21   bool moreTick = true;
22
23   try {
24     moreTick = tick();
25   } catch(RuntimeException& ex) {
26     ex.trace();
27   }
28
29   if(moreTick == true)
30     timeController->activate(this);
31 }
32