Skip to content

Commit 412127d

Browse files
committed
Cleanup/refactoring.
1 parent bad1c79 commit 412127d

6 files changed

Lines changed: 38 additions & 10 deletions

File tree

include/react/Event.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ auto Transform(const Events<D,TIn>& source, const SignalPack<D,TDepValues...>& d
348348
/// Process
349349
///////////////////////////////////////////////////////////////////////////////////////////////////
350350
using REACT_IMPL::EventRange;
351-
using REACT_IMPL::EventInserter;
351+
using REACT_IMPL::EventEmitter;
352352

353353
template
354354
<

include/react/Signal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ bool Equals(const Signal<D,L>& lhs, const Signal<D,R>& rhs)
933933
REACT_IMPL::Identity<decltype(obj)>::Type::ValueT& r) \
934934
{ \
935935
using T = decltype(r.name); \
936-
using S = REACT_MSVC_NO_TYPENAME REACT::RemoveInput<T>::Type; \
936+
using S = REACT_MSVC_NO_TYPENAME REACT::DecayInput<T>::Type; \
937937
return static_cast<S>(r.name); \
938938
}))
939939

@@ -946,7 +946,7 @@ bool Equals(const Signal<D,L>& lhs, const Signal<D,R>& rhs)
946946
{ \
947947
assert(r != nullptr); \
948948
using T = decltype(r->name); \
949-
using S = REACT_MSVC_NO_TYPENAME REACT::RemoveInput<T>::Type; \
949+
using S = REACT_MSVC_NO_TYPENAME REACT::DecayInput<T>::Type; \
950950
return static_cast<S>(r->name); \
951951
}))
952952

include/react/TypeTraits.h

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,30 @@ struct IsContinuation { static const bool value = false; };
9494
template <typename D, typename D2>
9595
struct IsContinuation<Continuation<D,D2>> { static const bool value = true; };
9696

97+
///////////////////////////////////////////////////////////////////////////////////////////////////
98+
/// IsObservable
99+
///////////////////////////////////////////////////////////////////////////////////////////////////
100+
template <typename T>
101+
struct IsObservable { static const bool value = false; };
102+
103+
template <typename D, typename T>
104+
struct IsObservable<Signal<D,T>> { static const bool value = true; };
105+
106+
template <typename D, typename T>
107+
struct IsObservable<VarSignal<D,T>> { static const bool value = true; };
108+
109+
template <typename D, typename T, typename TOp>
110+
struct IsObservable<TempSignal<D,T,TOp>> { static const bool value = true; };
111+
112+
template <typename D, typename T>
113+
struct IsObservable<Events<D,T>> { static const bool value = true; };
114+
115+
template <typename D, typename T>
116+
struct IsObservable<EventSource<D,T>> { static const bool value = true; };
117+
118+
template <typename D, typename T, typename TOp>
119+
struct IsObservable<TempEvents<D,T,TOp>> { static const bool value = true; };
120+
97121
///////////////////////////////////////////////////////////////////////////////////////////////////
98122
/// IsReactive
99123
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -128,16 +152,16 @@ template <typename D, typename D2>
128152
struct IsReactive<Continuation<D,D2>> { static const bool value = true; };
129153

130154
///////////////////////////////////////////////////////////////////////////////////////////////////
131-
/// RemoveInput
155+
/// DecayInput
132156
///////////////////////////////////////////////////////////////////////////////////////////////////
133157
template <typename T>
134-
struct RemoveInput { using Type = T; };
158+
struct DecayInput { using Type = T; };
135159

136160
template <typename D, typename T>
137-
struct RemoveInput<VarSignal<D,T>> { using Type = Signal<D,T>; };
161+
struct DecayInput<VarSignal<D,T>> { using Type = Signal<D,T>; };
138162

139163
template <typename D, typename T>
140-
struct RemoveInput<EventSource<D,T>> { using Type = Events<D,T>; };
164+
struct DecayInput<EventSource<D,T>> { using Type = Events<D,T>; };
141165

142166
/******************************************/ REACT_END /******************************************/
143167

include/react/detail/graph/GraphBase.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,12 @@ class EventRange
255255
using const_iterator = typename std::vector<E>::const_iterator;
256256
using size_type = typename std::vector<E>::size_type;
257257

258+
// Copy ctor
258259
EventRange(const EventRange&) = default;
259260

261+
// Copy assignment
262+
EventRange& operator=(const EventRange&) = default;
263+
260264
const_iterator begin() const { return data_.begin(); }
261265
const_iterator end() const { return data_.end(); }
262266

@@ -272,7 +276,7 @@ class EventRange
272276
};
273277

274278
template <typename E>
275-
using EventInserter = std::back_insert_iterator<std::vector<E>>;
279+
using EventEmitter = std::back_insert_iterator<std::vector<E>>;
276280

277281
/****************************************/ REACT_IMPL_END /***************************************/
278282

tests/src/EventStreamTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ TYPED_TEST_P(EventStreamTest, EventProcess)
285285
int callCount = 0;
286286

287287
auto processed = Process<float>(merged,
288-
[&] (EventRange<int> range, EventInserter<float> out)
288+
[&] (EventRange<int> range, EventEmitter<float> out)
289289
{
290290
for (const auto& e : range)
291291
{

tests/src/OperationsTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ TYPED_TEST_P(OperationsTest, SyncedEventProcess1)
911911

912912
auto processed = Process<float>(merged,
913913
With(mult),
914-
[&] (EventRange<int> range, EventInserter<float> out, int mult)
914+
[&] (EventRange<int> range, EventEmitter<float> out, int mult)
915915
{
916916
for (const auto& e : range)
917917
{

0 commit comments

Comments
 (0)