All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Signals | Public Member Functions
QGpCoreTools::EventRestrictor Class Reference

Restricts the number of events per unit of time. More...

#include <EventRestrictor.h>

List of all members.

Signals

void flushAll ()

Public Member Functions

 EventRestrictor (QObject *parent=0)
bool newEvent ()
void setInterval (int ms)
 ~EventRestrictor ()

Detailed Description

Restricts the number of events per unit of time.


Constructor & Destructor Documentation

References flushAll().

    : QObject(parent)
  {
    _chrono.start();
    _lastEvent.setSingleShot(true);
    connect(&_lastEvent, SIGNAL(timeout()), this, SIGNAL(flushAll()));
  }

References flushAll().

  {
    emit flushAll();
  }

Member Function Documentation

Referenced by Engine::signalDataChanged().

  {
    int delay=_chrono.elapsed();
    if(delay>=_lastEvent.interval()) {
      _chrono.start();
      return true;
    } else {
      _lastEvent.stop();
      _lastEvent.start(_lastEvent.interval()-delay);
      return false;
    }
  }
void QGpCoreTools::EventRestrictor::setInterval ( int  ms) [inline]

Referenced by AcquisitionWidget::AcquisitionWidget(), and Engine::Engine().

{_lastEvent.setInterval(ms);}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines