Dynamic lib selection and deployment
[anna.git] / example / diameter / launcher / testing / TestTimer.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 example_diameter_launcher_TestTimer_hpp
10 #define example_diameter_launcher_TestTimer_hpp
11
12 #include <anna/core/RuntimeException.hpp>
13 #include <anna/core/Allocator.hpp>
14 #include <anna/timex/Transaction.hpp>
15
16
17
18 class TestStep;
19
20
21 class TestTimer : public anna::timex::Transaction {
22
23 public:
24
25   struct Type { enum _v { TimeLeft, Delay }; };
26   static const char* asText(const Type::_v type) throw();
27
28
29   TestStep* getTestCaseStep() throw() { return reinterpret_cast <TestStep*>(getContext()); }
30   const TestStep* getTestCaseStep() const throw() { return reinterpret_cast <const TestStep*>(getContext()); }
31
32   void setType(const Type::_v type) throw() { a_type = type; }
33   const Type::_v &getType(const Type::_v type) const throw() { return a_type; }
34
35   std::string asString() const throw();
36
37 private:
38   Type::_v a_type;
39
40   TestTimer() {;}
41
42   void expire(anna::timex::Engine*) throw(anna::RuntimeException);
43
44   friend class anna::Allocator<TestTimer>;
45 };
46
47 #endif
48