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.
|
Go to the documentation of this file.
25 #include "celix/Exceptions.h"
50 template<
typename Rep,
typename Period>
52 options.initialDelayInSeconds = std::chrono::duration_cast<std::chrono::duration<double>>(delay).count();
64 template<
typename Rep,
typename Period>
66 options.intervalInSeconds = std::chrono::duration_cast<std::chrono::duration<double>>(interval).count();
90 callback = std::move(cb);
104 removeCallback = std::move(cb);
115 throw celix::Exception{
"Cannot build scheduled event without callback"};
117 return ScheduledEvent{ctx, name, std::move(callback), std::move(removeCallback), options};
121 std::shared_ptr<celix_bundle_context_t> ctx;
124 std::function<void()> callback{};
125 std::function<void()> removeCallback{};
ScheduledEventBuilder & withInitialDelay(std::chrono::duration< Rep, Period > delay)
Set the initial delay of the scheduled event.
Definition: ScheduledEventBuilder.h:51
A C++ builder for a ScheduledEvent object.
Definition: ScheduledEventBuilder.h:33
ScheduledEventBuilder(std::shared_ptr< celix_bundle_context_t > _cCtx)
Construct a scheduled event builder with the given bundle context.
Definition: ScheduledEventBuilder.h:40
ScheduledEventBuilder & withName(std::string n)
Set the name of the scheduled event.
Definition: ScheduledEventBuilder.h:76
Celix scheduled event options, used for creating scheduling events with the celix framework.
Definition: celix_bundle_context.h:1463
ScheduledEventBuilder & withRemoveCallback(std::function< void()> cb)
Set the remove callback of the scheduled event.
Definition: ScheduledEventBuilder.h:103
A C++ abstraction for a scheduled event in Celix.
Definition: ScheduledEvent.h:35
ScheduledEventBuilder & withCallback(std::function< void()> cb)
Set the callback of the scheduled event.
Definition: ScheduledEventBuilder.h:89
ScheduledEventBuilder & withInterval(std::chrono::duration< Rep, Period > interval)
Set the interval of the scheduled event.
Definition: ScheduledEventBuilder.h:65
ScheduledEvent build()
Build the scheduled event with the given options.
Definition: ScheduledEventBuilder.h:113