[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/zengyuxing007/cpp.react/master/examples/src/BasicComposition.cpp [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)

#include 
#include 
#include 

#include "react/Domain.h"
#include "react/Signal.h"
#include "react/Event.h"
#include "react/Observer.h"

///////////////////////////////////////////////////////////////////////////////////////////////////
/// Example 1 - Reactive class members
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace example1
{
    using namespace std;
    using namespace react;

    REACTIVE_DOMAIN(D, sequential)

    class Shape
    {
    public:
        USING_REACTIVE_DOMAIN(D)

        VarSignalT     Width   = MakeVar(0);
        VarSignalT     Height  = MakeVar(0);

        SignalT        Size    = Width * Height;

        EventSourceT      HasMoved = MakeEventSource();
    };

    void Run()
    {
        cout 

Web Proxy Viewer  |  New URL  |  Original Page