Skip to content

Commit 127bb4d

Browse files
committed
General code cleanup.
1 parent 86e2e18 commit 127bb4d

40 files changed

Lines changed: 189 additions & 168 deletions

include/react/Defs.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
#define REACT_ASSERT(condition, ...) for (; !(condition); assert(condition)) printf(__VA_ARGS__ ## "\n")
2626
#define REACT_ERROR(...) REACT_ASSERT(false, __VA_ARGS__)
2727

28-
////////////////////////////////////////////////////////////////////////////////////////
29-
// Type aliases
30-
REACT_BEGIN
28+
/***********************************/ REACT_BEGIN /************************************/
3129

30+
// Type aliases
3231
using uint = unsigned int;
3332
using uchar = unsigned char;
3433

35-
REACT_END
34+
/************************************/ REACT_END /*************************************/

include/react/EventStream.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
#include "Observer.h"
1818
#include "react/graph/EventStreamNodes.h"
1919

20-
////////////////////////////////////////////////////////////////////////////////////////
21-
REACT_BEGIN
20+
/***********************************/ REACT_BEGIN /************************************/
2221

2322
template <typename T>
2423
class Reactive;
@@ -73,19 +72,19 @@ class REvents : public Reactive<REACT_IMPL::EventStreamNode<D,E>>
7372
}
7473
};
7574

76-
REACT_END
75+
/************************************/ REACT_END /*************************************/
7776

78-
REACT_IMPL_BEGIN
77+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
7978

8079
template <typename D, typename L, typename R>
8180
bool Equals(const REvents<D,L>& lhs, const REvents<D,R>& rhs)
8281
{
8382
return lhs.Equals(rhs);
8483
}
8584

86-
REACT_IMPL_END
85+
/**********************************/ REACT_IMPL_END /**********************************/
8786

88-
REACT_BEGIN
87+
/***********************************/ REACT_BEGIN /************************************/
8988

9089
////////////////////////////////////////////////////////////////////////////////////////
9190
/// REventSource
@@ -258,4 +257,4 @@ inline auto Transform(const REvents<D,TIn>& src, F&& func)
258257
src.GetPtr(), std::forward<F>(func), false));
259258
}
260259

261-
REACT_END
260+
/************************************/ REACT_END /*************************************/

include/react/Observer.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
#include "react/graph/ObserverNodes.h"
1515

16-
////////////////////////////////////////////////////////////////////////////////////////
17-
REACT_BEGIN
16+
/***********************************/ REACT_BEGIN /************************************/
1817

1918
template <typename T>
2019
class Reactive;
@@ -71,9 +70,9 @@ class RObserver
7170
std::shared_ptr<SubjectT> subject_;
7271
};
7372

74-
REACT_END
73+
/************************************/ REACT_END /*************************************/
7574

76-
REACT_IMPL_BEGIN
75+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
7776

7877
////////////////////////////////////////////////////////////////////////////////////////
7978
/// ObserverRegistry
@@ -141,9 +140,9 @@ class ObserverRegistry
141140
std::unordered_map<IObserverNode*,Entry_> observerMap_;
142141
};
143142

144-
REACT_IMPL_END
143+
/**********************************/ REACT_IMPL_END /**********************************/
145144

146-
REACT_BEGIN
145+
/***********************************/ REACT_BEGIN /************************************/
147146

148147
////////////////////////////////////////////////////////////////////////////////////////
149148
/// Observe
@@ -231,4 +230,4 @@ inline void DetachThisObserver()
231230
REACT_IMPL::current_observer_state_::shouldDetach = true;
232231
}
233232

234-
REACT_END
233+
/************************************/ REACT_END /*************************************/

include/react/Operations.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
#include "EventStream.h"
1919
#include "react/graph/ConversionNodes.h"
2020

21-
////////////////////////////////////////////////////////////////////////////////////////
22-
REACT_BEGIN
21+
/***********************************/ REACT_BEGIN /************************************/
2322

2423
////////////////////////////////////////////////////////////////////////////////////////
2524
/// Fold
@@ -209,4 +208,4 @@ struct Decrementer : public std::unary_function<T,T>
209208
T operator() (T v) { return v-1; }
210209
};
211210

212-
REACT_END
211+
/************************************/ REACT_END /*************************************/

include/react/ReactiveBase.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include <functional>
1212
#include <memory>
1313

14-
////////////////////////////////////////////////////////////////////////////////////////
15-
REACT_BEGIN
14+
/***********************************/ REACT_BEGIN /************************************/
1615

1716
////////////////////////////////////////////////////////////////////////////////////////
1817
/// Reactive
@@ -52,9 +51,9 @@ class Reactive
5251
std::shared_ptr<T> ptr_;
5352
};
5453

55-
REACT_END
54+
/************************************/ REACT_END /*************************************/
5655

57-
REACT_IMPL_BEGIN
56+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
5857

5958
template <typename L, typename R>
6059
bool Equals(const L& lhs, const R& rhs)
@@ -68,4 +67,4 @@ bool Equals(const std::reference_wrapper<L>& lhs, const std::reference_wrapper<R
6867
return lhs.get() == rhs.get();
6968
}
7069

71-
REACT_IMPL_END
70+
/**********************************/ REACT_IMPL_END /**********************************/

include/react/ReactiveDomain.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#pragma once
88

9+
#include "react/Defs.h"
10+
911
#include <atomic>
1012
#include <functional>
1113
#include <memory>
@@ -20,8 +22,7 @@
2022
#include "react/logging/EventLog.h"
2123
#include "react/logging/EventRecords.h"
2224

23-
////////////////////////////////////////////////////////////////////////////////////////
24-
REACT_BEGIN
25+
/***********************************/ REACT_BEGIN /************************************/
2526

2627
template <typename D, typename S>
2728
class RSignal;
@@ -52,9 +53,9 @@ template
5253
inline auto MakeSignal(TFunc func, const RSignal<D,TArgs>& ... args)
5354
-> RSignal<D,decltype(func(args() ...))>;
5455

55-
REACT_END
56+
/************************************/ REACT_END /*************************************/
5657

57-
REACT_IMPL_BEGIN
58+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
5859

5960
////////////////////////////////////////////////////////////////////////////////////////
6061
/// ContinuationInput
@@ -96,9 +97,9 @@ class ContinuationInput
9697
std::unique_ptr<InputVectT> bufferedInputsPtr_ = nullptr;
9798
};
9899

99-
REACT_IMPL_END
100+
/**********************************/ REACT_IMPL_END /**********************************/
100101

101-
REACT_BEGIN
102+
/***********************************/ REACT_BEGIN /************************************/
102103

103104
////////////////////////////////////////////////////////////////////////////////////////
104105
/// CommitFlags
@@ -108,9 +109,9 @@ enum ETurnFlags
108109
enable_input_merging = 1 << 0
109110
};
110111

111-
REACT_END
112+
/************************************/ REACT_END /*************************************/
112113

113-
REACT_IMPL_BEGIN
114+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
114115

115116
////////////////////////////////////////////////////////////////////////////////////////
116117
/// EngineInterface
@@ -590,8 +591,8 @@ class DomainInitializer
590591
}
591592
};
592593

593-
REACT_IMPL_END
594+
/**********************************/ REACT_IMPL_END /**********************************/
594595

595596
#define REACTIVE_DOMAIN(name, ...) \
596597
struct name : public REACT_IMPL::DomainBase<name, REACT_IMPL::DomainPolicy<__VA_ARGS__ >> {}; \
597-
REACT_IMPL::DomainInitializer< name > name ## _initializer_;
598+
REACT_IMPL::DomainInitializer< name > name ## _initializer_;

include/react/ReactiveObject.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
#pragma once
88

9-
////////////////////////////////////////////////////////////////////////////////////////
10-
namespace react {
9+
#include "react/Defs.h"
10+
11+
/***********************************/ REACT_BEGIN /************************************/
1112

1213
////////////////////////////////////////////////////////////////////////////////////////
1314
/// ReactiveObject
@@ -122,4 +123,4 @@ class ReactiveObject
122123
obj))
123124
};
124125

125-
} //~namespace react
126+
/************************************/ REACT_END /*************************************/

include/react/Signal.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
#include "react/common/Util.h"
2121
#include "react/graph/SignalNodes.h"
2222

23-
////////////////////////////////////////////////////////////////////////////////////////
24-
REACT_IMPL_BEGIN
23+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
2524

2625
template <typename D, typename S>
2726
class SignalNode;
@@ -37,9 +36,9 @@ template
3736
>
3837
class FunctionNode;
3938

40-
REACT_IMPL_END
39+
/**********************************/ REACT_IMPL_END /**********************************/
4140

42-
REACT_BEGIN
41+
/***********************************/ REACT_BEGIN /************************************/
4342

4443
////////////////////////////////////////////////////////////////////////////////////////
4544
/// RSignal
@@ -134,9 +133,9 @@ class RVarSignal : public RSignal<D,S>
134133
}
135134
};
136135

137-
REACT_END
136+
/************************************/ REACT_END /*************************************/
138137

139-
REACT_IMPL_BEGIN
138+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
140139

141140
template <typename D, typename L, typename R>
142141
bool Equals(const RSignal<D,L>& lhs, const RSignal<D,R>& rhs)
@@ -150,9 +149,9 @@ bool Equals(const RVarSignal<D,L>& lhs, const RVarSignal<D,R>& rhs)
150149
return lhs.Equals(rhs);
151150
}
152151

153-
REACT_IMPL_END
152+
/**********************************/ REACT_IMPL_END /**********************************/
154153

155-
REACT_BEGIN
154+
/***********************************/ REACT_BEGIN /************************************/
156155

157156
////////////////////////////////////////////////////////////////////////////////////////
158157
/// IsSignalT
@@ -532,9 +531,9 @@ inline auto operator,(const InputPack<D, TCurValues ...>& cur, const RSignal<D,T
532531
return InputPack<D, TCurValues ... , TAppendValue>(cur, append);
533532
}
534533

535-
REACT_END
534+
/************************************/ REACT_END /*************************************/
536535

537-
REACT_IMPL_BEGIN
536+
/*********************************/ REACT_IMPL_BEGIN /*********************************/
538537

539538
template
540539
<
@@ -551,9 +550,9 @@ struct ApplyHelper
551550
}
552551
};
553552

554-
REACT_IMPL_END
553+
/**********************************/ REACT_IMPL_END /**********************************/
555554

556-
REACT_BEGIN
555+
/***********************************/ REACT_BEGIN /************************************/
557556

558557
////////////////////////////////////////////////////////////////////////////////////////
559558
/// operator->* overload to connect inputs to a function and return the resulting node.
@@ -602,4 +601,4 @@ inline auto Flatten(const RSignal<D,RSignal<D,TInnerValue>>& node)
602601
node.GetPtr(), node().GetPtr(), false));
603602
}
604603

605-
REACT_END
604+
/************************************/ REACT_END /*************************************/

include/react/common/Concurrency.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <mutex>
1212
#include <condition_variable>
1313

14-
REACT_BEGIN
14+
/***********************************/ REACT_BEGIN /************************************/
1515

1616
class BlockingCondition
1717
{
@@ -78,4 +78,4 @@ class BlockingCondition
7878
bool blocked_ = false;
7979
};
8080

81-
REACT_END
81+
/************************************/ REACT_END /*************************************/

include/react/common/Containers.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
#include <array>
1313
#include <vector>
1414

15-
////////////////////////////////////////////////////////////////////////////////////////
16-
REACT_BEGIN
15+
/***********************************/ REACT_BEGIN /************************************/
1716

1817
////////////////////////////////////////////////////////////////////////////////////////
1918
/// NodeVector
@@ -88,4 +87,4 @@ class NodePtrBuffer
8887
DataT nodes_;
8988
};
9089

91-
REACT_END
90+
/************************************/ REACT_END /*************************************/

0 commit comments

Comments
 (0)