Main MRPT website > C++ reference
MRPT logo

mrpt::utils::CObserver Class Reference

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

#include <mrpt/utils/CObserver.h>

Inheritance diagram for mrpt::utils::CObserver:
Inheritance graph
[legend]
Collaboration diagram for mrpt::utils::CObserver:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

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.

Private Member Functions

void internal_on_event (const mrptEvent &e)

Private Attributes

std::set< CObservable * > m_subscribed

Friends

class CObservable

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 52 of file CObserver.h.


Constructor & Destructor Documentation

mrpt::utils::CObserver::CObserver (  ) 
virtual mrpt::utils::CObserver::~CObserver (  )  [virtual]

Member Function Documentation

void mrpt::utils::CObserver::internal_on_event ( const mrptEvent e  )  [private]
void mrpt::utils::CObserver::observeBegin ( CObservable obj  ) 

Starts the subscription of this observer to the given object.

See also:
observeEnd
void mrpt::utils::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
virtual void mrpt::utils::CObserver::OnEvent ( const mrptEvent e  )  [protected, pure virtual]

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

Implemented in mrpt::slam::COccupancyGridMapFeatureExtractor.


Friends And Related Function Documentation

friend class CObservable [friend]

Definition at line 54 of file CObserver.h.


Member Data Documentation

Definition at line 68 of file CObserver.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010