FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

// Copyright Sebastian Jeckel 2014. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef REACT_REACTOR_H_INCLUDED #define REACT_REACTOR_H_INCLUDED #pragma once #include "react/detail/Defs.h" #include #include #include #include "react/common/Util.h" #include "react/Event.h" #include "react/detail/ReactiveBase.h" #include "react/detail/graph/ReactorNodes.h" /*****************************************/ REACT_BEGIN /*****************************************/ template class Reactor { public: class Context; using NodeT = REACT_IMPL::ReactorNode; class Context { public: Context(NodeT& node) : node_( node ) {} template E& Await(const Events& evn) { return node_.Await(GetNodePtr(evn)); } template void RepeatUntil(const Events& evn, F&& func) { node_.RepeatUntil(GetNodePtr(evn), std::forward(func)); } template const S& Get(const Signal& sig) { return node_.Get(GetNodePtr(sig)); } private: NodeT& node_; }; template explicit Reactor(F&& func) : nodePtr_( new REACT_IMPL::ReactorNode(std::forward(func)) ) { nodePtr_->StartLoop(); } private: std::unique_ptr nodePtr_; }; /******************************************/ REACT_END /******************************************/ #endif // REACT_REACTOR_H_INCLUDED

Back | FazBrowse Home | New Git URL