[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/jchjava/cpp.react/master/include/react/detail/SignalBase.h [Back]  [Original]

//          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_DETAIL_SIGNALBASE_H_INCLUDED
#define REACT_DETAIL_SIGNALBASE_H_INCLUDED

#pragma once

#include "react/detail/Defs.h"

#include 

#include "react/detail/ReactiveBase.h"
#include "react/detail/ReactiveInput.h"
#include "react/detail/graph/SignalNodes.h"

/***************************************/ REACT_IMPL_BEGIN /**************************************/

///////////////////////////////////////////////////////////////////////////////////////////////////
/// SignalBase
///////////////////////////////////////////////////////////////////////////////////////////////////
template
<
    typename D,
    typename S
>
class SignalBase : public CopyableReactive
{
public:
    SignalBase() = default;
    SignalBase(const SignalBase&) = default;
    
    template 
    SignalBase(T&& t) :
        SignalBase::CopyableReactive( std::forward(t) )
    {}

protected:
    const S& getValue() const
    {
        return this->ptr_->ValueRef();
    }

    template 
    void setValue(T&& newValue) const
    {
        DomainSpecificInputManager::Instance().AddInput(
            *reinterpret_cast(this->ptr_.get()),
            std::forward(newValue));
    }

    template 
    void modifyValue(const F& func) const
    {
        DomainSpecificInputManager::Instance().ModifyInput(
            *reinterpret_cast(this->ptr_.get()), func);
    }
};

/****************************************/ REACT_IMPL_END /***************************************/

#endif // REACT_DETAIL_SIGNALBASE_H_INCLUDED

Web Proxy Viewer  |  New URL  |  Original Page