Remove dynamic exceptions
[anna.git] / include / anna / ldap / internal / Timer.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_ldap_internal_Timer_hpp
10 #define anna_ldap_internal_Timer_hpp
11
12 #include <anna/core/Allocator.hpp>
13
14 #include <anna/timex/Transaction.hpp>
15
16 namespace anna {
17
18 namespace ldap {
19
20 class Response;
21 class TimerManager;
22
23 class Timer : public timex::Transaction {
24 public:
25   Response* getResponse() { return reinterpret_cast <Response*>(getContext()); }
26   const Response* getResponse() const { return reinterpret_cast <const Response*>(getContext()); }
27
28   std::string asString() const ;
29
30 private:
31   Timer() {;}
32
33   void setResponse(Response* response) { setContext(response); }
34   void expire(timex::Engine*) noexcept(false);
35
36   friend class ldap::TimerManager;
37   friend class Allocator<Timer>;
38 };
39
40 }
41 }
42
43 #endif
44