ANNA Suite  2020b
Multipurpose development suite for Telco applications
Control.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_test_Control_hpp
10 #define anna_test_Control_hpp
11 
12 #include <anna/core/mt/Mutex.hpp>
16 
17 namespace anna {
18  namespace xml {
19  class Node;
20  }
21  namespace comm {
22  class Communicator;
23  namespace socket {
24  class Client;
25  }
26  }
27 }
28 
29 namespace test {
30 
31 using namespace anna;
32 
33 class Control : public Mutex {
34 public:
35  Control (comm::Communicator* engine);
36 
37  void setDelay (const Millisecond delay) { a_delay = delay; }
38  void setMaxMessage (const int maxMessage) { a_maxMessage = maxMessage; }
39 
40  int getMaxMessage () const { return a_maxMessage; }
41 
42  bool canContinue (const comm::socket::Client& clientSocket) noexcept(false);
43  void delay () noexcept(false);
44  Millisecond latency (const Millisecond& init) noexcept(false);
45 
46  void report () ;
47  void stop () noexcept(false);
48 
49  xml::Node* asXML (xml::Node* parent) ;
50 
51 private:
52  comm::Communicator& a_engine;
53  Millisecond a_delay;
54  Millisecond a_initTime;
55  int a_maxMessage;
56  Average <Microsecond> a_avgDelay;
57  Average <Millisecond> a_avgLatency;
58 };
59 
60 }
61 
62 #endif
Definition: Communicator.hpp:79
Definition: Millisecond.hpp:24
Definition: Communicator.hpp:14
Definition: Average.hpp:24
Definition: Node.hpp:56
void setMaxMessage(const int maxMessage)
Definition: Control.hpp:38
int getMaxMessage() const
Definition: Control.hpp:40
Definition: Control.hpp:33
void setDelay(const Millisecond delay)
Definition: Control.hpp:37
xml::Node Node
Definition: Node.hpp:21
Definition: app.hpp:12
Definition: Mutex.hpp:41