SMACC
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
smacc::ISmaccUpdatable Class Referenceabstract

#include <smacc_updatable.h>

Inheritance diagram for smacc::ISmaccUpdatable:
Inheritance graph
Collaboration diagram for smacc::ISmaccUpdatable:
Collaboration graph

Public Member Functions

 ISmaccUpdatable ()
 
 ISmaccUpdatable (ros::Duration duration)
 
void executeUpdate ()
 
void setUpdatePeriod (ros::Duration duration)
 

Protected Member Functions

virtual void update ()=0
 

Private Attributes

boost::optional< ros::Duration > periodDuration_
 
ros::Time lastUpdate_
 

Detailed Description

Definition at line 15 of file smacc_updatable.h.

Constructor & Destructor Documentation

◆ ISmaccUpdatable() [1/2]

smacc::ISmaccUpdatable::ISmaccUpdatable ( )

Definition at line 6 of file smacc_updatable.cpp.

7 : lastUpdate_(0)
8{
9}

◆ ISmaccUpdatable() [2/2]

smacc::ISmaccUpdatable::ISmaccUpdatable ( ros::Duration  duration)

Definition at line 11 of file smacc_updatable.cpp.

12 : lastUpdate_(0),
13 periodDuration_(duration)
14{
15}
boost::optional< ros::Duration > periodDuration_

Member Function Documentation

◆ executeUpdate()

void smacc::ISmaccUpdatable::executeUpdate ( )

Definition at line 22 of file smacc_updatable.cpp.

23{
24 bool update = true;
26 {
27 auto now = ros::Time::now();
28 auto elapsed = now - this->lastUpdate_;
29 update = elapsed > *periodDuration_;
30 if(update)
31 {
32 this->lastUpdate_ = now;
33 }
34 }
35
36 if (update)
37 {
38 this->update();
39 }
40}
virtual void update()=0

References lastUpdate_, periodDuration_, and update().

Here is the call graph for this function:

◆ setUpdatePeriod()

void smacc::ISmaccUpdatable::setUpdatePeriod ( ros::Duration  duration)

Definition at line 17 of file smacc_updatable.cpp.

18{
19 periodDuration_ = duration;
20}

References periodDuration_.

◆ update()

virtual void smacc::ISmaccUpdatable::update ( )
protectedpure virtual

Member Data Documentation

◆ lastUpdate_

ros::Time smacc::ISmaccUpdatable::lastUpdate_
private

Definition at line 29 of file smacc_updatable.h.

Referenced by executeUpdate().

◆ periodDuration_

boost::optional<ros::Duration> smacc::ISmaccUpdatable::periodDuration_
private

Definition at line 28 of file smacc_updatable.h.

Referenced by executeUpdate(), and setUpdatePeriod().


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