Apache Celix  latest
Apache Celix is a framework for C, C++14 and C++17 to develop dynamic modular software applications using component and in-process service-oriented programming.
Public Member Functions | List of all members
celix::ScheduledEventBuilder Class Referencefinal

A C++ builder for a ScheduledEvent object. More...

#include <ScheduledEventBuilder.h>

Public Member Functions

 ScheduledEventBuilder (std::shared_ptr< celix_bundle_context_t > _cCtx)
 Construct a scheduled event builder with the given bundle context. More...
 
template<typename Rep , typename Period >
ScheduledEventBuilderwithInitialDelay (std::chrono::duration< Rep, Period > delay)
 Set the initial delay of the scheduled event. More...
 
template<typename Rep , typename Period >
ScheduledEventBuilderwithInterval (std::chrono::duration< Rep, Period > interval)
 Set the interval of the scheduled event. More...
 
ScheduledEventBuilderwithName (std::string n)
 Set the name of the scheduled event. More...
 
ScheduledEventBuilderwithCallback (std::function< void()> cb)
 Set the callback of the scheduled event. More...
 
ScheduledEventBuilderwithRemoveCallback (std::function< void()> cb)
 Set the remove callback of the scheduled event. More...
 
ScheduledEvent build ()
 Build the scheduled event with the given options. More...
 

Detailed Description

A C++ builder for a ScheduledEvent object.

Constructor & Destructor Documentation

◆ ScheduledEventBuilder()

celix::ScheduledEventBuilder::ScheduledEventBuilder ( std::shared_ptr< celix_bundle_context_t >  _cCtx)
inline

Construct a scheduled event builder with the given bundle context.

Parameters
[in]ctxThe bundle context to use.

Member Function Documentation

◆ build()

ScheduledEvent celix::ScheduledEventBuilder::build ( )
inline

Build the scheduled event with the given options.

Returns
The scheduled event.

◆ withCallback()

ScheduledEventBuilder& celix::ScheduledEventBuilder::withCallback ( std::function< void()>  cb)
inline

Set the callback of the scheduled event.

The callback is called when the scheduled event is triggered on the event thread.

Parameters
[in]cbThe callback function.
Returns
A reference to this builder.

◆ withInitialDelay()

template<typename Rep , typename Period >
ScheduledEventBuilder& celix::ScheduledEventBuilder::withInitialDelay ( std::chrono::duration< Rep, Period >  delay)
inline

Set the initial delay of the scheduled event.

Template Parameters
RepThe representation type of the duration.
PeriodThe period type of the duration.
Parameters
[in]delayThe delay duration.
Returns
A reference to this builder.

◆ withInterval()

template<typename Rep , typename Period >
ScheduledEventBuilder& celix::ScheduledEventBuilder::withInterval ( std::chrono::duration< Rep, Period >  interval)
inline

Set the interval of the scheduled event.

Template Parameters
RepThe representation type of the duration.
PeriodThe period type of the duration.
Parameters
[in]intervalThe interval duration.
Returns
A reference to this builder.

◆ withName()

ScheduledEventBuilder& celix::ScheduledEventBuilder::withName ( std::string  n)
inline

Set the name of the scheduled event.

Parameters
[in]nameThe name of the scheduled event.
Returns
A reference to this builder.

◆ withRemoveCallback()

ScheduledEventBuilder& celix::ScheduledEventBuilder::withRemoveCallback ( std::function< void()>  cb)
inline

Set the remove callback of the scheduled event.

The remove callback is called when the scheduled event is removed from the scheduler and can be called from any thread.

Parameters
[in]cbThe callback function.
Returns
A reference to this builder.

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