55#include < tuple>
66
77#include " GraphBase.h"
8- #include " react/Signal.h"
9- #include " react/EventStream.h"
108
119// //////////////////////////////////////////////////////////////////////////////////////
1210namespace react {
1311
14- template <typename T>
15- class Reactive ;
16-
17- template <typename D, typename S>
18- class RSignal ;
19-
20- template <typename D, typename E>
21- class REvents ;
22-
2312// //////////////////////////////////////////////////////////////////////////////////////
2413// / SignalNode
2514// //////////////////////////////////////////////////////////////////////////////////////
@@ -64,7 +53,7 @@ class SignalNode : public ReactiveNode<D,S,S>
6453
6554 S operator ()(void ) const
6655 {
67- return value_ ;
56+ return Value () ;
6857 }
6958
7059 const S& ValueRef () const
@@ -117,7 +106,7 @@ class VarNode : public SignalNode<D,S>
117106
118107 bool ApplyNewValue ()
119108 {
120- if (! equals (value_, newValue_))
109+ if (! impl::Equals (value_, newValue_))
121110 {
122111 value_ = newValue_;
123112 return true ;
@@ -130,25 +119,6 @@ class VarNode : public SignalNode<D,S>
130119
131120private:
132121 S newValue_;
133-
134- template <typename L, typename R>
135- static bool equals (L lhs, R rhs)
136- {
137- return lhs == rhs;
138- }
139-
140- // todo - ugly
141- template <typename L, typename R>
142- static bool equals (const REvents<D,L>& lhs, const REvents<D,R>& rhs)
143- {
144- return lhs.Equals (rhs);
145- }
146-
147- template <typename L, typename R>
148- static bool equals (const RSignal<D,L>& lhs, const RSignal<D,R>& rhs)
149- {
150- return lhs.Equals (rhs);
151- }
152122};
153123
154124// //////////////////////////////////////////////////////////////////////////////////////
@@ -226,9 +196,7 @@ class FunctionNode : public SignalNode<D,S>
226196 S newValue = evaluate ();
227197 D::Log ().template Append <NodeEvaluateEndEvent>(GetObjectId (*this ), turn.Id (), std::this_thread::get_id ().hash ());
228198
229-
230- // if (newValue != value_)
231- if (! equals (value_, newValue))
199+ if (! impl::Equals (value_, newValue))
232200 {
233201 value_ = newValue;
234202 Engine::OnNodePulse (*this , turn);
@@ -245,7 +213,7 @@ class FunctionNode : public SignalNode<D,S>
245213
246214private:
247215 std::tuple<SignalNodePtr<D,TArgs> ...> deps_;
248- std::function<S(TArgs ...)> func_;
216+ std::function<S(TArgs ...)> func_;
249217
250218 S evaluate () const
251219 {
@@ -256,25 +224,6 @@ class FunctionNode : public SignalNode<D,S>
256224 {
257225 return std::make_tuple (args->ValueRef () ...);
258226 }
259-
260- template <typename L, typename R>
261- static bool equals (L lhs, R rhs)
262- {
263- return lhs == rhs;
264- }
265-
266- // todo - ugly
267- template <typename L, typename R>
268- static bool equals (const REvents<D,L>& lhs, const REvents<D,R>& rhs)
269- {
270- return lhs.Equals (rhs);
271- }
272-
273- template <typename L, typename R>
274- static bool equals (const RSignal<D,L>& lhs, const RSignal<D,R>& rhs)
275- {
276- return lhs.Equals (rhs);
277- }
278227};
279228
280229// //////////////////////////////////////////////////////////////////////////////////////
0 commit comments