MRPT  1.9.9
mrpt::system::mrptEvent Class Reference

Detailed Description

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

Definition at line 32 of file mrptEvent.h.

#include <mrpt/system/mrptEvent.h>

Inheritance diagram for mrpt::system::mrptEvent:
Inheritance graph

Public Member Functions

 mrptEvent ()
 Default ctor. More...
 
template<class EVENTTYPE >
bool isOfType () const
 
template<class EVENTTYPE >
const EVENTTYPE * getAs () const
 
template<class EVENTTYPE >
EVENTTYPE * getAsNonConst () const
 

Public Attributes

mrpt::Clock::time_point timestamp
 

Protected Member Functions

virtual void do_nothing ()
 Just to allow this class to be polymorphic. More...
 

Constructor & Destructor Documentation

◆ mrptEvent()

mrpt::system::mrptEvent::mrptEvent ( )
inline

Default ctor.

Definition at line 39 of file mrptEvent.h.

Member Function Documentation

◆ do_nothing()

◆ getAs()

template<class EVENTTYPE >
const EVENTTYPE* mrpt::system::mrptEvent::getAs ( ) const
inline

Definition at line 47 of file mrptEvent.h.

◆ getAsNonConst()

template<class EVENTTYPE >
EVENTTYPE* mrpt::system::mrptEvent::getAsNonConst ( ) const
inline

Definition at line 53 of file mrptEvent.h.

◆ isOfType()

template<class EVENTTYPE >
bool mrpt::system::mrptEvent::isOfType ( ) const
inline

Member Data Documentation

◆ timestamp

mrpt::Clock::time_point mrpt::system::mrptEvent::timestamp

Definition at line 58 of file mrptEvent.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020