class mrpt::system::CObserver


Inherit from this class to get notified about events from any CObservable object after subscribing to it.

The main methods in this class are:

  • observeBegin() : To be called to start listening at a given object.

  • OnEvent() : Virtual functions to be implemented in your child class to receive all the notifications.

Note that if custom (child) mrptEvent classes are used, you can tell between them in runtime with “dynamic_cast<>()”.

The pairs CObservable / CObserver automatically notify each other the destruction of any of them, effectively ending the subscription of events.

See also:

CObservable, mrptEvent

#include <mrpt/system/CObserver.h>

class CObserver
    // construction


    // methods

    void observeBegin(CObservable& obj);
    void observeEnd(CObservable& obj);

// direct descendants

class CWindowObserver;
class COccupancyGridMapFeatureExtractor;


void observeBegin(CObservable& obj)

Starts the subscription of this observer to the given object.

See also:


void observeEnd(CObservable& obj)

Ends the subscription of this observer to the given object (note that there is no need to call this method, since the destruction of the first of observer/observed will put an end to the process.

See also: