Main MRPT website > C++ reference for MRPT 1.5.6
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
mrpt::utils::CObserver Class Referenceabstract

Detailed Description

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

The main methods in this class are:

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

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

Definition at line 34 of file CObserver.h.

#include <mrpt/utils/CObserver.h>

Inheritance diagram for mrpt::utils::CObserver:
Inheritance graph

Public Member Functions

 CObserver ()
 
virtual ~CObserver ()
 
void observeBegin (CObservable &obj)
 Starts the subscription of this observer to the given object. More...
 
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. More...
 

Protected Member Functions

virtual void OnEvent (const mrptEvent &e)=0
 This virtual function will be called upon receive of any event after starting listening at any CObservable object. More...
 

Private Member Functions

void internal_on_event (const mrptEvent &e)
 

Private Attributes

std::set< CObservable * > m_subscribed
 

Friends

class CObservable
 

Constructor & Destructor Documentation

CObserver::CObserver ( )

Definition at line 19 of file CObserver.cpp.

CObserver::~CObserver ( )
virtual

Definition at line 23 of file CObserver.cpp.

Member Function Documentation

void CObserver::internal_on_event ( const mrptEvent e)
private

Definition at line 49 of file CObserver.cpp.

void CObserver::observeBegin ( CObservable obj)

Starts the subscription of this observer to the given object.

See Also
observeEnd

Definition at line 30 of file CObserver.cpp.

References mrpt::utils::CObservable::internal_observer_begin().

Referenced by CGraphSlamHandler< GRAPH_T >::initVisualization().

void CObserver::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
observeBegin

Definition at line 38 of file CObserver.cpp.

virtual void mrpt::utils::CObserver::OnEvent ( const mrptEvent e)
protectedpure virtual

This virtual function will be called upon receive of any event after starting listening at any CObservable object.

Implemented in mrpt::slam::COccupancyGridMapFeatureExtractor, and mrpt::graphslam::CWindowObserver.

Friends And Related Function Documentation

friend class CObservable
friend

Definition at line 36 of file CObserver.h.

Member Data Documentation

std::set<CObservable*> mrpt::utils::CObserver::m_subscribed
private

Definition at line 50 of file CObserver.h.




Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018