|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#include <reactor-sdk/reactor-sdk.hh> |
| 4 | + |
| 5 | +#include "Source/SourceReactor.hh" |
| 6 | +#include "Sink/SinkReactor.hh" |
| 7 | + |
| 8 | +using namespace sdk; |
| 9 | + |
| 10 | +class MainReactor: public Reactor { |
| 11 | +public: |
| 12 | + struct Parameters : public SystemParameter<string, int> { |
| 13 | + ParameterMetadata<string> alias = ParameterMetadata<string> { |
| 14 | + .name = "alias", |
| 15 | + .description = "Alternate name", |
| 16 | + .min_value = "another", |
| 17 | + .max_value = "another", |
| 18 | + .value = "another" |
| 19 | + }; |
| 20 | + |
| 21 | + ParameterMetadata<int> log_level = ParameterMetadata<int> { |
| 22 | + .name = "log_level", |
| 23 | + .description = "Log level", |
| 24 | + .min_value = 0, |
| 25 | + .max_value = 1, |
| 26 | + .value = 1 |
| 27 | + }; |
| 28 | + |
| 29 | + Parameters(Reactor *container) |
| 30 | + : SystemParameter<string, int>(container) { |
| 31 | + register_parameters (alias, log_level); |
| 32 | + } |
| 33 | + }; |
| 34 | + |
| 35 | +private: |
| 36 | + Parameters parameters{this}; |
| 37 | + |
| 38 | + std::unique_ptr<SourceReactor> src; |
| 39 | + std::unique_ptr<SinkReactor> snk; |
| 40 | + |
| 41 | +public: |
| 42 | + MainReactor(const std::string &name, Environment *env) |
| 43 | + : Reactor(name, env) {} |
| 44 | + MainReactor(const std::string &name, Reactor *container) |
| 45 | + : Reactor(name, container) {} |
| 46 | + |
| 47 | + void construction() override; |
| 48 | + void assembling() override; |
| 49 | +}; |
| 50 | + |
| 51 | + |
0 commit comments