NRP Core  1.4.1
EventLoop Class Reference

EventLoop implementation which runs a Computational Graph. More...

#include <event_loop.h>

Inheritance diagram for EventLoop:
EventLoopInterface

Public Member Functions

 EventLoop (const nlohmann::json &graph_config, std::chrono::milliseconds timestep, std::chrono::milliseconds timestepThres, ComputationalGraph::ExecMode execMode=ComputationalGraph::ExecMode::ALL_NODES, bool ownGIL=true, bool spinROS=false)
 Constructor. More...
 
 ~EventLoop ()
 
- Public Member Functions inherited from EventLoopInterface
virtual ~EventLoopInterface ()=default
 
 EventLoopInterface ()=delete
 
 EventLoopInterface (std::chrono::milliseconds timestep, std::chrono::milliseconds timestepThres)
 Constructor. More...
 
virtual void initialize ()
 Initialize loop. More...
 
void runLoopOnce (const std::chrono::time_point< std::chrono::steady_clock > &startTime)
 Run a single loop. More...
 
void runLoop (std::chrono::milliseconds timeout)
 Run loop. More...
 
void runLoopAsync (std::chrono::milliseconds timeout=std::chrono::milliseconds(0), bool doInit=false)
 Run loop in a thread. More...
 
void stopLoop ()
 Stop loop. More...
 
void shutdown ()
 Shutdown loop. More...
 
bool isRunning ()
 Returns true if the event loop is currently running, false otherwise. More...
 
void waitForLoopEnd ()
 Blocks execution until the loop reaches timeout. More...
 

Protected Member Functions

void initializeCB () override
 Initialize loop. More...
 
void runLoopCB () override
 Execute actions which must be performed every loop. More...
 
void shutdownCB () override
 Shutdown loop. More...
 
- Protected Member Functions inherited from EventLoopInterface
bool isRunningNotAsync ()
 Internal isRunning function. More...
 

Additional Inherited Members

- Protected Attributes inherited from EventLoopInterface
std::chrono::milliseconds _timestep
 timestep of the event loop
More...
 
std::chrono::milliseconds _timestepThres
 allowed time deviation in event loop timestep execution before printing a warning message More...
 
std::chrono::milliseconds _currentTime = std::chrono::milliseconds(0)
 current time clock
More...
 
unsigned long _iterations = 0L
 stores the number of times the loop has been run More...
 

Detailed Description

EventLoop implementation which runs a Computational Graph.

Constructor & Destructor Documentation

◆ EventLoop()

EventLoop::EventLoop ( const nlohmann::json graph_config,
std::chrono::milliseconds  timestep,
std::chrono::milliseconds  timestepThres,
ComputationalGraph::ExecMode  execMode = ComputationalGraph::ExecMode::ALL_NODES,
bool  ownGIL = true,
bool  spinROS = false 
)

Constructor.

◆ ~EventLoop()

EventLoop::~EventLoop ( )

Member Function Documentation

◆ initializeCB()

void EventLoop::initializeCB ( )
overrideprotectedvirtual

Initialize loop.

Implements EventLoopInterface.

◆ runLoopCB()

void EventLoop::runLoopCB ( )
overrideprotectedvirtual

Execute actions which must be performed every loop.

Implements EventLoopInterface.

◆ shutdownCB()

void EventLoop::shutdownCB ( )
overrideprotectedvirtual

Shutdown loop.

Implements EventLoopInterface.


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