ANNA Suite  2020b
Multipurpose development suite for Telco applications
Timer.hpp
Go to the documentation of this file.
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_diameter_comm_Timer_hpp
10 #define anna_diameter_comm_Timer_hpp
11 
13 #include <anna/core/Allocator.hpp>
15 
16 
17 namespace anna {
18 
19 namespace diameter {
20 
21 namespace comm {
22 
23 
24 class Session;
25 class Response;
26 class LocalServer;
27 class TimerManager;
28 
29 
31 
32 public:
34 
35  // getters for responses
36  Response* getResponse() { return reinterpret_cast <Response*>(getContext()); }
37  const Response* getResponse() const { return reinterpret_cast <const Response*>(getContext()); }
38 
39  // getters for session (client-session at the moment)
40  Session* getSession() { return reinterpret_cast <Session*>(getContext()); }
41  const Session* getSession() const { return reinterpret_cast <const Session*>(getContext()); }
42 
43  // getters for local server
44  LocalServer* getLocalServer() { return reinterpret_cast <LocalServer*>(getContext()); }
45  const LocalServer* getLocalServer() const { return reinterpret_cast <const LocalServer*>(getContext()); }
46 
47  std::string asString() const ;
48 
49 private:
50  Timer() {;}
51 
52 
53  Type::_v a_type;
54 
55  void expire(anna::timex::Engine*) noexcept(false);
56 
57  Type::_v getType() const { return a_type; }
58  void setType(const Type::_v type) { a_type = type; }
59  static const char* asText(const Type::_v) ;
60 
61 
62  friend class TimerManager;
63  friend class anna::Allocator<Timer>;
64 };
65 
66 }
67 }
68 }
69 
70 #endif
71 
const LocalServer * getLocalServer() const
Definition: Timer.hpp:45
Definition: Transaction.hpp:34
const Response * getResponse() const
Definition: Timer.hpp:37
Response * getResponse()
Definition: Timer.hpp:36
Definition: TimerManager.hpp:45
Definition: Timer.hpp:30
Session * getSession()
Definition: Timer.hpp:40
_v
Definition: Timer.hpp:33
LocalServer * getLocalServer()
Definition: Timer.hpp:44
Definition: Allocator.hpp:19
Definition: Response.hpp:44
void * getContext()
Definition: Transaction.hpp:66
Definition: Timer.hpp:33
Definition: LocalServer.hpp:55
Definition: app.hpp:12
std::string asString() const
const Session * getSession() const
Definition: Timer.hpp:41
Definition: Engine.hpp:62
Definition: Session.hpp:55