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

Replaced SharedPtrT alias with actual std::shared_ptr. Switching to a… · jchjava/cpp.react@77de3d6 · GitHub

Commit 77de3d6

Browse files
committed
Replaced SharedPtrT alias with actual std::shared_ptr. Switching to a different shared ptr impl was not possible anyway due to using make_shared.
1 parent b7b227d commit 77de3d6

9 files changed

Lines changed: 86 additions & 90 deletions

File tree

‎include/react/Event.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Events : public REACT_IMPL::EventStreamBase<D,E>
4848

4949
private:
5050
using NodeT = REACT_IMPL::EventStreamNode<D,E>;
51-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
51+
using NodePtrT = std::shared_ptr<NodeT>;
5252

5353
public:
5454
using ValueT = E;
@@ -115,7 +115,7 @@ class Events<D,E&> : public REACT_IMPL::EventStreamBase<D,std::reference_wrapper
115115

116116
private:
117117
using NodeT = REACT_IMPL::EventStreamNode<D,std::reference_wrapper<E>>;
118-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
118+
using NodePtrT = std::shared_ptr<NodeT>;
119119

120120
public:
121121
using ValueT = E;
@@ -181,7 +181,7 @@ class EventSource : public Events<D,E>
181181
{
182182
private:
183183
using NodeT = REACT_IMPL::EventSourceNode<D,E>;
184-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
184+
using NodePtrT = std::shared_ptr<NodeT>;
185185

186186
public:
187187
EventSource() = default;
@@ -233,7 +233,7 @@ class EventSource<D,E&> : public Events<D,std::reference_wrapper<E>>
233233
{
234234
private:
235235
using NodeT = REACT_IMPL::EventSourceNode<D,std::reference_wrapper<E>>;
236-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
236+
using NodePtrT = std::shared_ptr<NodeT>;
237237

238238
public:
239239
EventSource() = default;
@@ -274,7 +274,7 @@ class TempEvents : public Events<D,E>
274274
{
275275
protected:
276276
using NodeT = REACT_IMPL::EventOpNode<D,E,TOp>;
277-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
277+
using NodePtrT = std::shared_ptr<NodeT>;
278278

279279
public:
280280
TempEvents() = default;

‎include/react/Signal.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Signal : public REACT_IMPL::SignalBase<D,S>
3434

3535
private:
3636
using NodeT = REACT_IMPL::SignalNode<D,S>;
37-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
37+
using NodePtrT = std::shared_ptr<NodeT>;
3838

3939
public:
4040
using ValueT = S;
@@ -83,7 +83,7 @@ class Signal<D,S&> : public REACT_IMPL::SignalBase<D,std::reference_wrapper<S>>
8383

8484
private:
8585
using NodeT = REACT_IMPL::SignalNode<D,std::reference_wrapper<S>>;
86-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
86+
using NodePtrT = std::shared_ptr<NodeT>;
8787

8888
public:
8989
using ValueT = S;
@@ -125,7 +125,7 @@ class VarSignal : public Signal<D,S>
125125
{
126126
private:
127127
using NodeT = REACT_IMPL::VarNode<D,S>;
128-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
128+
using NodePtrT = std::shared_ptr<NodeT>;
129129

130130
public:
131131
VarSignal() = default;
@@ -172,7 +172,7 @@ class VarSignal<D,S&> : public Signal<D,std::reference_wrapper<S>>
172172
{
173173
private:
174174
using NodeT = REACT_IMPL::VarNode<D,std::reference_wrapper<S>>;
175-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
175+
using NodePtrT = std::shared_ptr<NodeT>;
176176

177177
public:
178178
using ValueT = S;
@@ -213,7 +213,7 @@ class TempSignal : public Signal<D,S>
213213
{
214214
private:
215215
using NodeT = REACT_IMPL::SignalOpNode<D,S,TOp>;
216-
using NodePtrT = REACT_IMPL::SharedPtrT<NodeT>;
216+
using NodePtrT = std::shared_ptr<NodeT>;
217217

218218
public:
219219
TempSignal() = default;

‎include/react/detail/ReactiveBase.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ReactiveBase
3535
{
3636
public:
3737
using DomainT = typename TNode::DomainT;
38-
using NodePtrT = SharedPtrT<TNode>;
38+
using NodePtrT = std::shared_ptr<TNode>;
3939

4040
ReactiveBase() = default;
4141
ReactiveBase(const ReactiveBase&) = default;
@@ -52,7 +52,7 @@ class ReactiveBase
5252
ptr_{ std::move(ptr) }
5353
{}
5454

55-
const SharedPtrT<TNode>& NodePtr() const
55+
const std::shared_ptr<TNode>& NodePtr() const
5656
{
5757
return ptr_;
5858
}
@@ -68,7 +68,7 @@ class ReactiveBase
6868
}
6969

7070
protected:
71-
SharedPtrT<TNode> ptr_;
71+
std::shared_ptr<TNode> ptr_;
7272
};
7373

7474
/****************************************/ REACT_IMPL_END /***************************************/

‎include/react/detail/graph/AlgorithmNodes.h‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "react/detail/Defs.h"
1010

11+
#include <memory>
1112
#include <utility>
1213

1314
#include "EventNodes.h"
@@ -71,10 +72,10 @@ class IterateNode : public SignalNode<D,S>
7172
}
7273

7374
virtual const char* GetNodeType() const override { return "IterateNode"; }
74-
virtual int DependencyCount() const override { return 1; }
75+
virtual int DependencyCount() const override { return 1; }
7576

7677
private:
77-
SharedPtrT<EventStreamNode<D,E>> events_;
78+
std::shared_ptr<EventStreamNode<D,E>> events_;
7879

7980
TFunc func_;
8081
};
@@ -93,7 +94,7 @@ class IterateByRefNode : public SignalNode<D,S>
9394
{
9495
public:
9596
template <typename T, typename F>
96-
IterateByRefNode(T&& init, const SharedPtrT<EventStreamNode<D,E>>& events, F&& func) :
97+
IterateByRefNode(T&& init, const std::shared_ptr<EventStreamNode<D,E>>& events, F&& func) :
9798
SignalNode{ std::forward<T>(init) },
9899
func_{ std::forward<F>(func) },
99100
events_{ events }
@@ -132,7 +133,7 @@ class IterateByRefNode : public SignalNode<D,S>
132133
protected:
133134
TFunc func_;
134135

135-
SharedPtrT<EventStreamNode<D,E>> events_;
136+
std::shared_ptr<EventStreamNode<D,E>> events_;
136137
};
137138

138139
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -168,7 +169,7 @@ class SyncedIterateNode : public SignalNode<D,S>
168169

169170
apply(
170171
DetachFunctor<D,SyncedIterateNode,
171-
SharedPtrT<SignalNode<D,TDepValues>>...>{ *this },
172+
std::shared_ptr<SignalNode<D,TDepValues>>...>{ *this },
172173
deps_);
173174

174175
Engine::OnNodeDestroy(*this);
@@ -184,7 +185,7 @@ class SyncedIterateNode : public SignalNode<D,S>
184185
MyFunc{ f }
185186
{}
186187

187-
S operator()(const SharedPtrT<SignalNode<D,TDepValues>>& ... args)
188+
S operator()(const std::shared_ptr<SignalNode<D,TDepValues>>& ... args)
188189
{
189190
return MyFunc(MyEvent, MyValue, args->ValueRef() ...);
190191
}
@@ -231,9 +232,9 @@ class SyncedIterateNode : public SignalNode<D,S>
231232
virtual int DependencyCount() const override { return 1 + sizeof...(TDepValues); }
232233

233234
private:
234-
using DepHolderT = std::tuple<SharedPtrT<SignalNode<D,TDepValues>>...>;
235+
using DepHolderT = std::tuple<std::shared_ptr<SignalNode<D,TDepValues>>...>;
235236

236-
SharedPtrT<EventStreamNode<D,E>> events_;
237+
std::shared_ptr<EventStreamNode<D,E>> events_;
237238

238239
DepHolderT deps_;
239240
TFunc func_;
@@ -272,7 +273,7 @@ class SyncedIterateByRefNode : public SignalNode<D,S>
272273

273274
apply(
274275
DetachFunctor<D,SyncedIterateByRefNode,
275-
SharedPtrT<SignalNode<D,TDepValues>>...>{ *this },
276+
std::shared_ptr<SignalNode<D,TDepValues>>...>{ *this },
276277
deps_);
277278

278279
Engine::OnNodeDestroy(*this);
@@ -288,7 +289,7 @@ class SyncedIterateByRefNode : public SignalNode<D,S>
288289
MyFunc{ f }
289290
{}
290291

291-
void operator()(const SharedPtrT<SignalNode<D,TDepValues>>& ... args)
292+
void operator()(const std::shared_ptr<SignalNode<D,TDepValues>>& ... args)
292293
{
293294
MyFunc(MyEvent, MyValue, args->ValueRef() ...);
294295
}
@@ -329,9 +330,9 @@ class SyncedIterateByRefNode : public SignalNode<D,S>
329330
virtual int DependencyCount() const override { return 1 + sizeof...(TDepValues); }
330331

331332
private:
332-
using DepHolderT = std::tuple<SharedPtrT<SignalNode<D,TDepValues>>...>;
333+
using DepHolderT = std::tuple<std::shared_ptr<SignalNode<D,TDepValues>>...>;
333334

334-
SharedPtrT<EventStreamNode<D,E>> events_;
335+
std::shared_ptr<EventStreamNode<D,E>> events_;
335336

336337
DepHolderT deps_;
337338
TFunc func_;
@@ -349,7 +350,7 @@ class HoldNode : public SignalNode<D,S>
349350
{
350351
public:
351352
template <typename T>
352-
HoldNode(T&& init, const SharedPtrT<EventStreamNode<D,S>>& events) :
353+
HoldNode(T&& init, const std::shared_ptr<EventStreamNode<D,S>>& events) :
353354
SignalNode(std::forward<T>(init)),
354355
events_{ events }
355356
{
@@ -398,7 +399,7 @@ class HoldNode : public SignalNode<D,S>
398399
virtual int DependencyCount() const override { return 1; }
399400

400401
private:
401-
const SharedPtrT<EventStreamNode<D,S>> events_;
402+
const std::shared_ptr<EventStreamNode<D,S>> events_;
402403
};
403404

404405
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -413,8 +414,8 @@ template
413414
class SnapshotNode : public SignalNode<D,S>
414415
{
415416
public:
416-
SnapshotNode(const SharedPtrT<SignalNode<D,S>>& target,
417-
const SharedPtrT<EventStreamNode<D,E>>& trigger) :
417+
SnapshotNode(const std::shared_ptr<SignalNode<D,S>>& target,
418+
const std::shared_ptr<EventStreamNode<D,E>>& trigger) :
418419
SignalNode{ target->ValueRef() },
419420
target_{ target },
420421
trigger_{ trigger }
@@ -467,8 +468,8 @@ class SnapshotNode : public SignalNode<D,S>
467468
}
468469

469470
private:
470-
const SharedPtrT<SignalNode<D,S>> target_;
471-
const SharedPtrT<EventStreamNode<D,E>> trigger_;
471+
const std::shared_ptr<SignalNode<D,S>> target_;
472+
const std::shared_ptr<EventStreamNode<D,E>> trigger_;
472473
};
473474

474475
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -482,7 +483,7 @@ template
482483
class MonitorNode : public EventStreamNode<D,E>
483484
{
484485
public:
485-
MonitorNode(const SharedPtrT<SignalNode<D,E>>& target) :
486+
MonitorNode(const std::shared_ptr<SignalNode<D,E>>& target) :
486487
EventStreamNode{ },
487488
target_{ target }
488489
{
@@ -521,7 +522,7 @@ class MonitorNode : public EventStreamNode<D,E>
521522
}
522523

523524
private:
524-
const SharedPtrT<SignalNode<D,E>> target_;
525+
const std::shared_ptr<SignalNode<D,E>> target_;
525526
};
526527

527528
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -536,8 +537,8 @@ template
536537
class PulseNode : public EventStreamNode<D,S>
537538
{
538539
public:
539-
PulseNode(const SharedPtrT<SignalNode<D,S>>& target,
540-
const SharedPtrT<EventStreamNode<D,E>>& trigger) :
540+
PulseNode(const std::shared_ptr<SignalNode<D,S>>& target,
541+
const std::shared_ptr<EventStreamNode<D,E>>& trigger) :
541542
EventStreamNode{ },
542543
target_{ target },
543544
trigger_{ trigger }
@@ -581,8 +582,8 @@ class PulseNode : public EventStreamNode<D,S>
581582
}
582583

583584
private:
584-
const SharedPtrT<SignalNode<D,S>> target_;
585-
const SharedPtrT<EventStreamNode<D,E>> trigger_;
585+
const std::shared_ptr<SignalNode<D,S>> target_;
586+
const std::shared_ptr<EventStreamNode<D,E>> trigger_;
586587
};
587588

588589
/****************************************/ REACT_IMPL_END /***************************************/

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL