Skip to content

Commit 749e6e1

Browse files
committed
fix compile error
1 parent a8be863 commit 749e6e1

10 files changed

Lines changed: 46 additions & 39 deletions

File tree

include/react/common/ptrcache.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#pragma once
1111

12-
#include "react/detail/Defs.h"
12+
#include "react/detail/defs.h"
1313

1414
#include <memory>
1515
#include <mutex>
@@ -45,7 +45,7 @@ class WeakPtrCache
4545
}
4646

4747
std::shared_ptr<V> v = createFunc();
48-
auto res = map_.emplace(key, v);
48+
// auto res = map_.emplace(key, v);
4949
return v;
5050
}
5151

@@ -69,4 +69,4 @@ class WeakPtrCache
6969

7070
/******************************************/ REACT_END /******************************************/
7171

72-
#endif // REACT_COMMON_PTR_CACHE_H_INCLUDED
72+
#endif // REACT_COMMON_PTR_CACHE_H_INCLUDED

include/react/common/slotmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#pragma once
1111

12-
#include "react/detail/Defs.h"
12+
#include "react/detail/defs.h"
1313

1414
#include <algorithm>
1515
#include <array>

include/react/detail/event_nodes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class EventSlotNode : public EventNode<E>
147147
EventSlotNode(const Group& group) :
148148
EventSlotNode::EventNode( group )
149149
{
150-
inputNodeId_ = GetGraphPtr()->RegisterNode(&slotInput_, NodeCategory::dyninput);
150+
inputNodeId_ = this->GetGraphPtr()->RegisterNode(&slotInput_, NodeCategory::dyninput);
151151
this->RegisterMe();
152152

153153
this->AttachToMe(inputNodeId_);
@@ -159,7 +159,7 @@ class EventSlotNode : public EventNode<E>
159159
this->DetachFromMe(inputNodeId_);
160160

161161
this->UnregisterMe();
162-
GetGraphPtr()->UnregisterNode(inputNodeId_);
162+
this->GetGraphPtr()->UnregisterNode(inputNodeId_);
163163
}
164164

165165
virtual UpdateResult Update(TurnId turnId) noexcept override
@@ -424,7 +424,7 @@ class EventLinkNode : public EventNode<E>
424424
srcGraphPtr->DetachNode(outputNodeId_, GetInternals(dep_).GetNodeId());
425425
srcGraphPtr->UnregisterNode(outputNodeId_);
426426

427-
auto& linkCache = GetGraphPtr()->GetLinkCache();
427+
auto& linkCache = this->GetGraphPtr()->GetLinkCache();
428428
linkCache.Erase(this);
429429

430430
this->UnregisterMe();

include/react/detail/graph_impl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ReactGraph
106106

107107
template <typename F>
108108
void EnqueueTransaction(F&& func, SyncPoint::Dependency dep, TransactionFlags flags);
109-
109+
110110
LinkCache& GetLinkCache()
111111
{ return linkCache_; }
112112

@@ -119,8 +119,8 @@ class ReactGraph
119119
NodeData& operator=(const NodeData&) = default;
120120

121121
NodeData(IReactNode* nodePtrIn, NodeCategory categoryIn) :
122-
nodePtr( nodePtrIn ),
123-
category(categoryIn)
122+
category(categoryIn),
123+
nodePtr( nodePtrIn )
124124
{ }
125125

126126
NodeCategory category = NodeCategory::normal;
@@ -187,12 +187,12 @@ class ReactGraph
187187
template <typename F>
188188
void ReactGraph::PushInput(NodeId nodeId, F&& inputCallback)
189189
{
190-
auto& node = nodeData_[nodeId];
191-
auto* nodePtr = node.nodePtr;
190+
// auto& node = nodeData_[nodeId];
191+
// auto* nodePtr = node.nodePtr;
192192

193193
// This writes to the input buffer of the respective node.
194194
std::forward<F>(inputCallback)();
195-
195+
196196
changedInputs_.push_back(nodeId);
197197

198198
if (transactionLevel_ == 0)
@@ -244,4 +244,4 @@ class GroupInternals
244244

245245
/****************************************/ REACT_IMPL_END /***************************************/
246246

247-
#endif // REACT_DETAIL_GRAPH_IMPL_H_INCLUDED
247+
#endif // REACT_DETAIL_GRAPH_IMPL_H_INCLUDED

include/react/detail/graph_interface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ using NodeId = size_t;
2828
using TurnId = size_t;
2929
using LinkId = size_t;
3030

31-
static NodeId invalid_node_id = (std::numeric_limits<size_t>::max)();
32-
static TurnId invalid_turn_id = (std::numeric_limits<size_t>::max)();
33-
static LinkId invalid_link_id = (std::numeric_limits<size_t>::max)();
31+
// static NodeId invalid_node_id = (std::numeric_limits<size_t>::max)();
32+
// static TurnId invalid_turn_id = (std::numeric_limits<size_t>::max)();
33+
// static LinkId invalid_link_id = (std::numeric_limits<size_t>::max)();
3434

3535
enum class UpdateResult
3636
{

include/react/detail/state_nodes.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <utility>
1717
#include <vector>
1818

19-
#include "node_base.h"
19+
#include "react/detail/node_base.h"
2020

2121
/***************************************/ REACT_IMPL_BEGIN /**************************************/
2222

@@ -98,7 +98,7 @@ class StateVarNode : public StateNode<S>
9898
}
9999
}
100100
else if (isInputModified_)
101-
{
101+
{
102102
isInputModified_ = false;
103103
return UpdateResult::changed;
104104
}
@@ -202,8 +202,8 @@ class StateSlotNode : public StateNode<S>
202202
StateSlotNode::StateNode( group, GetInternals(dep).Value() ),
203203
input_( dep )
204204
{
205-
inputNodeId_ = GetGraphPtr()->RegisterNode(&slotInput_, NodeCategory::dyninput);
206-
205+
inputNodeId_ = this->GetGraphPtr()->RegisterNode(&slotInput_, NodeCategory::dyninput);
206+
207207
this->RegisterMe();
208208
this->AttachToMe(inputNodeId_);
209209
this->AttachToMe(GetInternals(dep).GetNodeId());
@@ -215,7 +215,7 @@ class StateSlotNode : public StateNode<S>
215215
this->DetachFromMe(inputNodeId_);
216216
this->UnregisterMe();
217217

218-
GetGraphPtr()->UnregisterNode(inputNodeId_);
218+
this->GetGraphPtr()->UnregisterNode(inputNodeId_);
219219
}
220220

221221
virtual UpdateResult Update(TurnId turnId) noexcept override

include/react/event.h

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222

2323
#include "react/common/ptrcache.h"
2424

25+
/*****************************************/ REACT_BEGIN /*****************************************/
26+
template <typename> class Event;
27+
/******************************************/ REACT_END /******************************************/
28+
/***************************************/ REACT_IMPL_BEGIN /**************************************/
29+
template <typename E>
30+
Event<E> SameGroupOrLink(const Group& targetGroup, const Event<E>& dep);
31+
/****************************************/ REACT_IMPL_END /***************************************/
32+
2533
/*****************************************/ REACT_BEGIN /*****************************************/
2634

2735
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -60,10 +68,10 @@ class Event : protected REACT_IMPL::EventInternals<E>
6068
Event& operator=(Event&&) = default;
6169

6270
auto GetGroup() const -> const Group&
63-
{ return GetNodePtr()->GetGroup(); }
71+
{ return this->GetNodePtr()->GetGroup(); }
6472

6573
auto GetGroup() -> Group&
66-
{ return GetNodePtr()->GetGroup(); }
74+
{ return this->GetNodePtr()->GetGroup(); }
6775

6876
friend bool operator==(const Event<E>& a, const Event<E>& b)
6977
{ return a.GetNodePtr() == b.GetNodePtr(); }
@@ -83,7 +91,7 @@ class Event : protected REACT_IMPL::EventInternals<E>
8391
{ }
8492

8593
template <typename F, typename T>
86-
static auto CreateProcessingNode(const Group& group, F&& func, const Event<T>& dep) -> decltype(auto)
94+
static auto CreateProcessingNode(const Group& group, F&& func, const Event<T>& dep) -> std::shared_ptr<REACT_IMPL::EventNode<E>>
8795
{
8896
using REACT_IMPL::EventProcessingNode;
8997
using REACT_IMPL::SameGroupOrLink;
@@ -103,7 +111,7 @@ class Event : protected REACT_IMPL::EventInternals<E>
103111
}
104112

105113
template <typename RET, typename NODE, typename ... ARGS>
106-
friend static RET impl::CreateWrappedNode(ARGS&& ... args);
114+
friend RET impl::CreateWrappedNode(ARGS&& ... args);
107115
};
108116

109117
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -124,14 +132,14 @@ class EventSource : public Event<E>
124132

125133
EventSource(EventSource&& other) = default;
126134
EventSource& operator=(EventSource&& other) = default;
127-
135+
128136
void Emit(const E& value)
129137
{ EmitValue(value); }
130138

131139
void Emit(E&& value)
132140
{ EmitValue(std::move(value)); }
133141

134-
template <typename T = E, typename = std::enable_if_t<std::is_same_v<T, Token>>>
142+
template <typename T = E, typename = std::enable_if_t<std::is_same<T, Token>::value>>
135143
void Emit()
136144
{ EmitValue(Token::value); }
137145

@@ -147,7 +155,7 @@ class EventSource : public Event<E>
147155
{ }
148156

149157
private:
150-
static auto CreateSourceNode(const Group& group) -> decltype(auto)
158+
static auto CreateSourceNode(const Group& group) -> std::shared_ptr<REACT_IMPL::EventNode<E>>
151159
{
152160
using REACT_IMPL::EventSourceNode;
153161
return std::make_shared<EventSourceNode<E>>(group);
@@ -219,7 +227,7 @@ class EventSlot : public Event<E>
219227
NodeId nodeId = castedPtr->GetInputNodeId();
220228
auto& graphPtr = GetInternals(this->GetGroup()).GetGraphPtr();
221229

222-
graphPtr->PushInput(nodeId, [this, castedPtr, &input] { castedPtr->AddSlotInput(SameGroupOrLink(GetGroup(), input)); });
230+
graphPtr->PushInput(nodeId, [this, castedPtr, &input] { castedPtr->AddSlotInput(SameGroupOrLink(this->GetGroup(), input)); });
223231
}
224232

225233
void RemoveSlotInput(const Event<E>& input)
@@ -232,7 +240,7 @@ class EventSlot : public Event<E>
232240
NodeId nodeId = castedPtr->GetInputNodeId();
233241
auto& graphPtr = GetInternals(this->GetGroup()).GetGraphPtr();
234242

235-
graphPtr->PushInput(nodeId, [this, castedPtr, &input] { castedPtr->RemoveSlotInput(SameGroupOrLink(GetGroup(), input)); });
243+
graphPtr->PushInput(nodeId, [this, castedPtr, &input] { castedPtr->RemoveSlotInput(SameGroupOrLink(this->GetGroup(), input)); });
236244
}
237245

238246
void RemoveAllSlotInputs()
@@ -274,12 +282,12 @@ class EventLink : public Event<E>
274282
{ }
275283

276284
private:
277-
static auto GetOrCreateLinkNode(const Group& group, const Event<E>& input) -> decltype(auto)
285+
static auto GetOrCreateLinkNode(const Group& group, const Event<E>& input) -> std::shared_ptr<REACT_IMPL::EventNode<E>>
278286
{
279287
using REACT_IMPL::EventLinkNode;
280288
using REACT_IMPL::IReactNode;
281289
using REACT_IMPL::ReactGraph;
282-
290+
283291
IReactNode* k = GetInternals(input).GetNodePtr().get();
284292

285293
ReactGraph::LinkCache& linkCache = GetInternals(group).GetGraphPtr()->GetLinkCache();
@@ -403,7 +411,7 @@ static auto Join(const Event<U1>& dep1, const Event<Us>& ... deps) -> Event<std:
403411
/***************************************/ REACT_IMPL_BEGIN /**************************************/
404412

405413
template <typename E>
406-
static Event<E> SameGroupOrLink(const Group& targetGroup, const Event<E>& dep)
414+
Event<E> SameGroupOrLink(const Group& targetGroup, const Event<E>& dep)
407415
{
408416
if (dep.GetGroup() == targetGroup)
409417
return dep;
@@ -413,4 +421,4 @@ static Event<E> SameGroupOrLink(const Group& targetGroup, const Event<E>& dep)
413421

414422
/****************************************/ REACT_IMPL_END /***************************************/
415423

416-
#endif // REACT_EVENT_H_INCLUDED
424+
#endif // REACT_EVENT_H_INCLUDED

include/react/group.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <memory>
1515
#include <utility>
1616

17-
#include "react/API.h"
17+
#include "react/api.h"
1818
#include "react/common/syncpoint.h"
1919

2020
#include "react/detail/graph_interface.h"

include/react/observer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Observer : protected REACT_IMPL::ObserverInternals
8080
}
8181

8282
template <typename F, typename T>
83-
static auto CreateEventObserverNode(const Group& group, F&& func, const Event<T>& dep) -> decltype(auto)
83+
static auto CreateEventObserverNode(const Group& group, F&& func, const Event<T>& dep) -> std::shared_ptr<REACT_IMPL::ObserverNode>
8484
{
8585
using REACT_IMPL::EventObserverNode;
8686
return std::make_shared<EventObserverNode<typename std::decay<F>::type, T>>(
@@ -101,4 +101,4 @@ class Observer : protected REACT_IMPL::ObserverInternals
101101

102102
/******************************************/ REACT_END /******************************************/
103103

104-
#endif // REACT_OBSERVER_H_INCLUDED
104+
#endif // REACT_OBSERVER_H_INCLUDED

src/detail/graph_impl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ size_t TransactionQueue::ProcessNextBatch()
236236
bool syncLinked = false;
237237

238238
bool skipPop = false;
239-
bool isDone = false;
240239

241240
// Outer loop. One transaction per iteration.
242241
for (;;)

0 commit comments

Comments
 (0)