class mrpt::system::mrptEvent

Overview

The basic event type for the observer-observable pattern in MRPT.

You can sub-class this base class to create custom event types, then tell between them in runtime with isOfType<T>(), for example:

if (e.isOfType<mrptEventOnDestroy>())
{
  const mrptEventOnDestroy* ev = e.getAs<mrptEventOnDestroy>();
  ev-> ...
}

See also:

CObserver, CObservable

#include <mrpt/system/mrptEvent.h>

class mrptEvent
{
public:
    // fields

    mrpt::Clock::time_point timestamp {mrpt::Clock::now()};

    // construction

    mrptEvent();

    // methods

    template <class EVENTTYPE>
    bool isOfType() const;

    template <class EVENTTYPE>
    const EVENTTYPE* getAs() const;

    template <class EVENTTYPE>
    EVENTTYPE* getAsNonConst() const;
};

// direct descendants

class mrptEvent3DWindowGrabImageFile;
class mrptEventMouseDown;
class mrptEventMouseMove;
class mrptEventWindowChar;
class mrptEventWindowClosed;
class mrptEventWindowResize;
class mrptEventMetricMapClear;
class mrptEventMetricMapInsert;
class mrptEventOnDestroy;