diff options
Diffstat (limited to 'src/Reactor.cpp')
-rw-r--r-- | src/Reactor.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Reactor.cpp b/src/Reactor.cpp index 02eb108..f72086d 100644 --- a/src/Reactor.cpp +++ b/src/Reactor.cpp @@ -31,6 +31,25 @@ PATCHAGE_RESTORE_WARNINGS namespace patchage { +class SettingVisitor +{ +public: + using result_type = void; ///< For boost::apply_visitor + + explicit SettingVisitor(Configuration& conf) + : _conf{conf} + {} + + template<class S> + void operator()(const S& setting) const + { + _conf.set_setting(setting); + } + +private: + Configuration& _conf; +}; + inline std::ostream& operator<<(std::ostream& os, const ClientType type) { @@ -55,6 +74,13 @@ Reactor::Reactor(Configuration& conf, {} void +Reactor::operator()(const action::ChangeSetting& action) +{ + SettingVisitor visitor{_conf}; + boost::apply_visitor(visitor, action.setting); +} + +void Reactor::operator()(const action::ConnectPorts& action) { if (action.tail.type() == action.head.type()) { |