forked from Framework-R-D/phlex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.cpp
More file actions
33 lines (27 loc) · 819 Bytes
/
driver.cpp
File metadata and controls
33 lines (27 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "phlex/model/product_store.hpp"
#include "phlex/source.hpp"
#include <ranges>
namespace {
class number_generator {
public:
number_generator(phlex::experimental::configuration const& config) n_{0}
{
if (config.kind("max_numbers") == boost::json::kind::int64_t)
n_ = config.get<int>("max_numbers";
}
void next(phlex::experimental::framework_driver& driver) const
{
auto job_store = phlex::experimental::product_store::base();
driver.yield(job_store);
for (int i : std::views::iota(1, n_ + 1)) {
auto store = job_store->make_child(i, "event");
store->add_product("i", i);
store->add_product("j", -i);
driver.yield(store);
}
}
private:
int n_;
};
}
PHLEX_EXPERIMENTAL_REGISTER_SOURCE(number_generator)