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