Template Class StatefulNodelet

Inheritance Relationships

Base Types

Derived Type

Class Documentation

template<typename NodeletType = ::nodelet::Nodelet>
class StatefulNodelet : public virtual nodelet::Nodelet, public cras::StatefulNodeletInterface

A mixin that can tell when a nodelet is being unloaded.

Template Parameters:

NodeletType – Type of the base nodelet.

Subclassed by cras::NodeletBase<::nodelet::Nodelet >

Public Functions

virtual ~StatefulNodelet()
virtual bool ok() const override

Whether it is OK to continue sleeping. If false, a pending sleep() should stop as soon as possible.

Note

Always override this function as its default implementation returns false (used in case this function is called after the descendant parts of the objects have already been destructed).

Returns:

Whether it is OK to continue.

virtual void requestStop() override

Call this function to request stopping this nodelet. ok() should return false after calling this. It terminates all ongoing sleeps called by this->sleep().

Note

This method is automatically called from the destructor (but rather call it as soon as you know the nodelet should be stopped).

void shutdown()