Remove dynamic exceptions
[anna.git] / source / timex / TimeEvent.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/core/functions.hpp>
10
11 #include <anna/timex/TimeEvent.hpp>
12 #include <anna/timex/Engine.hpp>
13 #include <anna/timex/TimeEventObserver.hpp>
14
15 using namespace anna;
16
17 anna::timex::TimeEvent::~TimeEvent() {
18   if(a_controller != NULL) {
19     try {
20       a_controller->cancel(this);
21     } catch(Exception& ex) {
22       ex.trace();
23     }
24   }
25 }
26
27 std::string anna::timex::TimeEvent::asString() const
28 {
29   std::string result("timex::TimeEvent { Id: ");
30   result += functions::asHexString(a_id);
31   result += " | Reference: ";
32   result += functions::asHexString(anna_ptrnumber_cast(this));
33   result += " | Timeout: ";
34   result += functions::asString(a_timeout);
35   result += " ms";
36
37   if(a_observer != NULL) {
38     result += " | ";
39     result += a_observer->asString();
40   }
41
42   return result += " }";
43 }
44
45