lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
lintel::SchedulerService Class Reference

#include <SchedulerService.h>

Inheritance diagram for lintel::SchedulerService:
lintel::PropertyRegistration< SchedulerService > lintel::AbstractService< T > lintel::AbstractServiceInterface

Public Member Functions

template<class F , class... Args>
auto schedule (F &&f, Args &&...args) -> std::future< std::invoke_result_t< std::decay_t< F >, std::decay_t< Args >... > >
 
template<class F , class... Args>
auto schedule_after (const std::chrono::steady_clock::duration &d, F &&f, Args &&...args) -> std::future< std::invoke_result_t< std::decay_t< F >, std::decay_t< Args >... > >
 
template<class F , class... Args>
auto schedule_at (const std::chrono::steady_clock::time_point &t, F &&f, Args &&...args) -> std::future< std::invoke_result_t< std::decay_t< F >, std::decay_t< Args >... > >
 
template<class F , class... Args>
void schedule_at_fixed_rate (const std::chrono::steady_clock::duration &d, const std::chrono::steady_clock::duration &period, F &&f, Args &&...args)
 
void clear ()
 
 SchedulerService (const std::shared_ptr< ProcessName > &processName)
 
void onInitialize () override
 
void onShutdown () override
 
virtual ~SchedulerService ()
 
- Public Member Functions inherited from lintel::AbstractService< T >
 AbstractService ()=delete
 
 AbstractService (std::string processName, std::string instanceName)
 
 AbstractService (std::string processName)
 
ShutdownPriority shutdownPriorityOf () const override
 
const std::string & getProcessName () const override
 
const std::string & getInstanceName () const override
 
std::string_view getClassName () const override
 
- Public Member Functions inherited from lintel::AbstractServiceInterface
virtual ~AbstractServiceInterface ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from lintel::PropertyRegistration< SchedulerService >
std::shared_ptr< Property< type > > registerProperty (std::string name, type defaultValue, std::string description, bool runtime, const std::string &fileName, int32_t position)
 
- Protected Attributes inherited from lintel::AbstractService< T >
std::vector< std::shared_ptr< PropertyBase > > m_properties
 

Detailed Description

Service for scheduling and executing tasks at specified times or at fixed rates.

Constructor & Destructor Documentation

◆ SchedulerService()

lintel::SchedulerService::SchedulerService ( const std::shared_ptr< ProcessName > &  processName)
explicit

Constructor.

Parameters
processNamecurrent process name

◆ ~SchedulerService()

virtual lintel::SchedulerService::~SchedulerService ( )
virtual

Member Function Documentation

◆ clear()

void lintel::SchedulerService::clear ( )

Remove all scheduled tasks.

◆ onInitialize()

void lintel::SchedulerService::onInitialize ( )
overridevirtual

Default initialization does nothing; override in subclasses.

Reimplemented from lintel::AbstractService< T >.

◆ onShutdown()

void lintel::SchedulerService::onShutdown ( )
overridevirtual

Default shutdown does nothing; override in subclasses.

Reimplemented from lintel::AbstractService< T >.

◆ schedule()

template<class F , class... Args>
auto lintel::SchedulerService::schedule ( F &&  f,
Args &&...  args 
) -> std::future<std::invoke_result_t<std::decay_t<F>, std::decay_t<Args>...>>

Schedule a task for immediate execution.

Template Parameters
Fcallable type
Argsargument types
Parameters
fcallable to execute
argsarguments to pass
Returns
future for the result

◆ schedule_after()

template<class F , class... Args>
auto lintel::SchedulerService::schedule_after ( const std::chrono::steady_clock::duration &  d,
F &&  f,
Args &&...  args 
) -> std::future<std::invoke_result_t<std::decay_t<F>, std::decay_t<Args>...>>

Schedule a task for execution after a delay.

Template Parameters
Fcallable type
Argsargument types
Parameters
ddelay duration
fcallable to execute
argsarguments to pass
Returns
future for the result

◆ schedule_at()

template<class F , class... Args>
auto lintel::SchedulerService::schedule_at ( const std::chrono::steady_clock::time_point &  t,
F &&  f,
Args &&...  args 
) -> std::future<std::invoke_result_t<std::decay_t<F>, std::decay_t<Args>...>>

Schedule a task for execution at a specific time point.

Template Parameters
Fcallable type
Argsargument types
Parameters
tabsolute time point for execution
fcallable to execute
argsarguments to pass
Returns
future for the result

◆ schedule_at_fixed_rate()

template<class F , class... Args>
void lintel::SchedulerService::schedule_at_fixed_rate ( const std::chrono::steady_clock::duration &  d,
const std::chrono::steady_clock::duration &  period,
F &&  f,
Args &&...  args 
)

Schedule a task for repeated execution at a fixed rate.

Template Parameters
Fcallable type
Argsargument types
Parameters
dinitial delay
periodinterval between executions
fcallable to execute
argsarguments to pass

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