knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::Observer Class Reference

#include <Observer.h>

Public Member Functions

 Observer (const std::shared_ptr< ObserverJob > &job)
 
 ~Observer ()
 
void stopObservation ()
 
auto & job () const
 
 Observer (const std::shared_ptr< ObserverJob > &job)
 
 ~Observer ()
 
void stopObservation ()
 
auto & job () const
 

Protected Attributes

std::shared_ptr< ObserverJobjob_
 

Detailed Description

An observer is a handle to an observation job.

Definition at line 18 of file Observer.h.

Constructor & Destructor Documentation

◆ Observer() [1/2]

Observer::Observer ( const std::shared_ptr< ObserverJob > &  job)
explicit

Create an observer.

Parameters
jobthe job to observe.

Definition at line 12 of file Observer.cpp.

13  : job_(job) {}
std::shared_ptr< ObserverJob > job_
Definition: Observer.h:39
auto & job() const
Definition: Observer.h:36

◆ ~Observer() [1/2]

Observer::~Observer ( )

Definition at line 15 of file Observer.cpp.

15  {
17  job_ = nullptr;
18 }
void stopObservation()
Definition: Observer.cpp:20

◆ Observer() [2/2]

knowrob::Observer::Observer ( const std::shared_ptr< ObserverJob > &  job)
explicit

Create an observer.

Parameters
jobthe job to observe.

◆ ~Observer() [2/2]

knowrob::Observer::~Observer ( )

Member Function Documentation

◆ job() [1/2]

auto& knowrob::Observer::job ( ) const
inline
Returns
the job being observed.

Definition at line 36 of file Observer.h.

36 { return job_; }

◆ job() [2/2]

auto& knowrob::Observer::job ( ) const
inline
Returns
the job being observed.

Definition at line 36 of file Observer.h.

36 { return job_; }

◆ stopObservation() [1/2]

void Observer::stopObservation ( )

Stop the observation.

Definition at line 20 of file Observer.cpp.

20  {
21  if (job_) {
22  auto manager = job_->manager();
23  manager->stopObservation(*this);
24  job_->stop();
25  }
26 }

◆ stopObservation() [2/2]

void knowrob::Observer::stopObservation ( )

Stop the observation.

Member Data Documentation

◆ job_

std::shared_ptr< ObserverJob > knowrob::Observer::job_
protected

Definition at line 39 of file Observer.h.


The documentation for this class was generated from the following files: