1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
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 //
9 #ifndef anna_test_Control_hpp
10 #define anna_test_Control_hpp
12 #include <anna/core/mt/Mutex.hpp>
13 #include <anna/core/util/Average.hpp>
14 #include <anna/core/util/Millisecond.hpp>
15 #include <anna/core/util/Microsecond.hpp>
33 class Control : public Mutex {
35 Control (comm::Communicator* engine);
37 void setDelay (const Millisecond delay) throw () { a_delay = delay; }
38 void setMaxMessage (const int maxMessage) throw () { a_maxMessage = maxMessage; }
40 int getMaxMessage () const throw () { return a_maxMessage; }
42 bool canContinue (const comm::socket::Client& clientSocket) throw (RuntimeException);
43 void delay () throw (RuntimeException);
44 Millisecond latency (const Millisecond& init) throw (RuntimeException);
46 void report () throw ();
47 void stop () throw (RuntimeException);
49 xml::Node* asXML (xml::Node* parent) throw ();
52 comm::Communicator& a_engine;
54 Millisecond a_initTime;
56 Average <Microsecond> a_avgDelay;
57 Average <Millisecond> a_avgLatency;