Skip to content

Commit 036f89e

Browse files
committed
Fixed some build issues with VS2013.
Still makes the compiler crash though...
1 parent 79ffa32 commit 036f89e

9 files changed

Lines changed: 62 additions & 54 deletions

File tree

include/react/ReactiveDomain.h

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include <functional>
55
#include <memory>
66

7-
#include "tbb/spin_mutex.h"
8-
#include "tbb/queuing_mutex.h"
97
#include "tbb/concurrent_vector.h"
8+
#include "tbb/queuing_mutex.h"
9+
#include "tbb/spin_mutex.h"
1010

1111
#include "Observer.h"
1212

@@ -326,8 +326,8 @@ template
326326
>
327327
struct ReactiveEngineInterface
328328
{
329-
typedef TEngine::NodeInterface NodeInterface;
330-
typedef TEngine::TurnInterface TurnInterface;
329+
typedef typename TEngine::NodeInterface NodeInterface;
330+
typedef typename TEngine::TurnInterface TurnInterface;
331331

332332
static TEngine& Engine()
333333
{
@@ -414,10 +414,10 @@ class DomainBase
414414
public:
415415
typedef TPolicy Policy;
416416

417-
typedef ReactiveEngineInterface<D, Policy::Engine> Engine;
417+
typedef ReactiveEngineInterface<D, typename Policy::Engine> Engine;
418418

419419
////////////////////////////////////////////////////////////////////////////////////////
420-
/// Aliases for handles of current domain
420+
/// Aliases for reactives of current domain
421421
////////////////////////////////////////////////////////////////////////////////////////
422422
template <typename S>
423423
using Signal = RSignal<D,S>;
@@ -527,8 +527,8 @@ class DomainBase
527527
////////////////////////////////////////////////////////////////////////////////////////
528528
/// Aliases for transactions
529529
////////////////////////////////////////////////////////////////////////////////////////
530-
typedef TransactionData<Engine::TurnInterface> TransactionData;
531-
typedef TransactionInput<Engine::TurnInterface> TransactionInput;
530+
typedef TransactionData<typename Engine::TurnInterface> TransactionData;
531+
typedef TransactionInput<typename Engine::TurnInterface> TransactionInput;
532532

533533
////////////////////////////////////////////////////////////////////////////////////////
534534
/// Transaction
@@ -537,14 +537,12 @@ class DomainBase
537537
{
538538
public:
539539
Transaction() :
540-
committed_(false),
541-
flags_(defaultCommitFlags_)
540+
flags_{ defaultCommitFlags_ }
542541
{
543542
}
544543

545544
Transaction(int flags) :
546-
committed_(false),
547-
flags_(flags)
545+
flags_{ flags }
548546
{
549547
}
550548

@@ -578,7 +576,7 @@ class DomainBase
578576
private:
579577

580578
int flags_;
581-
bool committed_;
579+
bool committed_ = false;
582580

583581
TransactionData data_;
584582
};
@@ -590,15 +588,15 @@ class DomainBase
590588
{
591589
public:
592590
ScopedTransaction() :
593-
transaction_(defaultCommitFlags_)
591+
transaction_{ defaultCommitFlags_ }
594592
{
595593
ASSERT_(ScopedTransactionInput::IsNull(), "Nested scoped transactions are not supported.");
596594
ASSERT_(TransactionInputContinuation::IsNull(), "Scoped transactions are not supported inside of observer functions.");
597595
ScopedTransactionInput::Set(&transaction_.Data().Input());
598596
}
599597

600598
ScopedTransaction(int flags) :
601-
transaction_(flags)
599+
transaction_{ flags }
602600
{
603601
ASSERT_(ScopedTransactionInput::IsNull(), "Nested scoped transactions are not supported.");
604602
ASSERT_(TransactionInputContinuation::IsNull(), "Scoped transactions are not supported inside of observer functions.");
@@ -638,7 +636,7 @@ class DomainBase
638636
defaultCommitFlags_ = flags;
639637
}
640638

641-
static int SetDefaultCommitFlags()
639+
static int GetDefaultCommitFlags()
642640
{
643641
return defaultCommitFlags_;
644642
}
@@ -650,7 +648,7 @@ class DomainBase
650648

651649
static int nextTransactionId()
652650
{
653-
int curId = nextTransactionId_.fetch_add(1);
651+
int curId = nextTransactionId_.fetch_add(1, std::memory_order_relaxed);
654652

655653
if (curId == INT_MAX)
656654
nextTransactionId_.fetch_sub(INT_MAX);

include/react/ReactiveObject.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ReactiveObject
3535
template <typename Domain_, typename Val_> class TOuter,
3636
typename TInner
3737
>
38-
inline auto MakeVar(const TOuter<D,TInner>& value)
38+
static inline auto MakeVar(const TOuter<D,TInner>& value)
3939
-> VarSignal<Signal<TInner>>
4040
{
4141
return react::MakeVar<D>(value);
@@ -45,7 +45,7 @@ class ReactiveObject
4545
/// MakeVar
4646
////////////////////////////////////////////////////////////////////////////////////////
4747
template <typename S>
48-
inline auto MakeVar(const S& value)
48+
static inline auto MakeVar(const S& value)
4949
-> VarSignal<S>
5050
{
5151
return react::MakeVar<D>(value);
@@ -59,7 +59,7 @@ class ReactiveObject
5959
typename TFunc,
6060
typename ... TArgs
6161
>
62-
inline auto MakeSignal(TFunc func, const Signal<TArgs>& ... args)
62+
static inline auto MakeSignal(TFunc func, const Signal<TArgs>& ... args)
6363
-> Signal<decltype(func(args() ...))>
6464
{
6565
typedef decltype(func(args() ...)) S;
@@ -71,7 +71,7 @@ class ReactiveObject
7171
/// MakeEventSource
7272
////////////////////////////////////////////////////////////////////////////////////////
7373
template <typename E>
74-
inline auto MakeEventSource()
74+
static inline auto MakeEventSource()
7575
-> EventSource<E>
7676
{
7777
return react::MakeEventSource<D,E>();

include/react/Signal.h

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
////////////////////////////////////////////////////////////////////////////////////////
1515
namespace react {
1616

17+
template <typename D, typename S>
18+
class SignalNode;
19+
20+
template <typename D, typename S>
21+
class VarNode;
22+
1723
////////////////////////////////////////////////////////////////////////////////////////
1824
/// RSignal
1925
////////////////////////////////////////////////////////////////////////////////////////
@@ -52,7 +58,7 @@ class RSignal : public Reactive<SignalNode<D,S>>
5258

5359
S operator()(void) const
5460
{
55-
return (*ptr_)();
61+
return Value();
5662
}
5763
};
5864

@@ -167,7 +173,7 @@ inline auto MakeSignal(TFunc func, const RSignal<D,TArgs>& ... args)
167173
////////////////////////////////////////////////////////////////////////////////////////
168174
/// Unary arithmetic operators
169175
////////////////////////////////////////////////////////////////////////////////////////
170-
#define DECLARE_ARITHMETIC_OP1(op) \
176+
#define DECLARE_OP(op) \
171177
template \
172178
< \
173179
typename D, \
@@ -181,15 +187,15 @@ inline auto operator ## op(const RSignal<D,TVal>& arg) \
181187
arg.GetPtr(), [] (TVal a) { return op a; }, false)); \
182188
}
183189

184-
DECLARE_ARITHMETIC_OP1(+);
185-
DECLARE_ARITHMETIC_OP1(-);
190+
DECLARE_OP(+);
191+
DECLARE_OP(-);
186192

187-
#undef DECLARE_ARITHMETIC_OP1
193+
#undef DECLARE_OP
188194

189195
////////////////////////////////////////////////////////////////////////////////////////
190196
/// Binary arithmetic operators
191197
////////////////////////////////////////////////////////////////////////////////////////
192-
#define DECLARE_ARITHMETIC_OP2(op) \
198+
#define DECLARE_OP(op) \
193199
template \
194200
< \
195201
typename D, \
@@ -255,18 +261,18 @@ inline auto operator ## op(const TLeftVal& lhs, \
255261
rhs.GetPtr(), [=] (TRightVal a) { return lhs op a; }, false)); \
256262
}
257263

258-
DECLARE_ARITHMETIC_OP2(+);
259-
DECLARE_ARITHMETIC_OP2(-);
260-
DECLARE_ARITHMETIC_OP2(*);
261-
DECLARE_ARITHMETIC_OP2(/);
262-
DECLARE_ARITHMETIC_OP2(%);
264+
DECLARE_OP(+);
265+
DECLARE_OP(-);
266+
DECLARE_OP(*);
267+
DECLARE_OP(/);
268+
DECLARE_OP(%);
263269

264-
#undef DECLARE_ARITHMETIC_OP2
270+
#undef DECLARE_OP
265271

266272
////////////////////////////////////////////////////////////////////////////////////////
267273
/// Comparison operators
268274
////////////////////////////////////////////////////////////////////////////////////////
269-
#define DECLARE_COMP_OP(op) \
275+
#define DECLARE_OP(op) \
270276
template \
271277
< \
272278
typename D, \
@@ -296,19 +302,19 @@ inline auto operator ## op(const RSignal<D,TLeftVal>& lhs, const TRightVal& rhs)
296302
lhs.GetPtr(), [=] (TLeftVal a) { return a op rhs; }, false)); \
297303
}
298304

299-
DECLARE_COMP_OP(==);
300-
DECLARE_COMP_OP(!=);
301-
DECLARE_COMP_OP(<);
302-
DECLARE_COMP_OP(<=);
303-
DECLARE_COMP_OP(>);
304-
DECLARE_COMP_OP(>=);
305+
DECLARE_OP(==);
306+
DECLARE_OP(!=);
307+
DECLARE_OP(<);
308+
DECLARE_OP(<=);
309+
DECLARE_OP(>);
310+
DECLARE_OP(>=);
305311

306-
#undef DECLARE_COMP_OP
312+
#undef DECLARE_OP
307313

308314
////////////////////////////////////////////////////////////////////////////////////////
309315
/// Unary logical operators
310316
////////////////////////////////////////////////////////////////////////////////////////
311-
#define DECLARE_LOGICAL_OP1(op) \
317+
#define DECLARE_OP(op) \
312318
template \
313319
< \
314320
typename D, \
@@ -322,14 +328,14 @@ inline auto operator ## op(const RSignal<D,TVal>& arg) \
322328
arg.GetPtr(), [] (TVal a) { return op a; }, false)); \
323329
}
324330

325-
DECLARE_LOGICAL_OP1(!);
331+
DECLARE_OP(!);
326332

327-
#undef DECLARE_LOGICAL_OP1
333+
#undef DECLARE_OP
328334

329335
////////////////////////////////////////////////////////////////////////////////////////
330336
/// Binary logical operators
331337
////////////////////////////////////////////////////////////////////////////////////////
332-
#define DECLARE_LOGICAL_OP2(op) \
338+
#define DECLARE_OP(op) \
333339
template \
334340
< \
335341
typename D, \
@@ -359,10 +365,10 @@ inline auto operator ## op(const RSignal<D,TLeftVal>& lhs, const TRightVal& rhs)
359365
lhs.GetPtr(), [=] (TLeftVal a) { return a op rhs; }, false)); \
360366
}
361367

362-
DECLARE_LOGICAL_OP2(&&);
363-
DECLARE_LOGICAL_OP2(||);
368+
DECLARE_OP(&&);
369+
DECLARE_OP(||);
364370

365-
#undef DECLARE_LOGICAL_OP2
371+
#undef DECLARE_OP
366372

367373
////////////////////////////////////////////////////////////////////////////////////////
368374
/// InputPack - Wraps several nodes in a tuple. Create with comma operator.

include/react/common/Util.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class ThreadLocalStaticPtr
5050

5151
private:
5252
ThreadLocalStaticPtr() {}
53-
~ThreadLocalStaticPtr() {}
5453

5554
static __declspec(thread) T* ptr_;
5655
};

include/react/graph/GraphBase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
//#include "react/ReactiveDomain.h"
88
#include "react/common/Util.h"
9+
#include "react/common/Types.h"
910

1011
////////////////////////////////////////////////////////////////////////////////////////
1112
namespace react {

include/react/graph/ObserverNodes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <functional>
55

66
#include "GraphBase.h"
7+
#include "EventStreamNodes.h"
8+
#include "SignalNodes.h"
79

810
namespace react {
911

src/benchmark/BenchmarkGrid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ template
1818
class GridGraphGenerator
1919
{
2020
public:
21-
typedef D::Signal<TValue> MyHandle;
21+
typedef typename D::template Signal<TValue> MyHandle;
2222

2323
typedef std::function<TValue(TValue)> Func1T;
2424
typedef std::function<TValue(TValue,TValue)> Func2T;

src/benchmark/BenchmarkRandom.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ template
1818
class RandomGraphGenerator
1919
{
2020
public:
21-
typedef D::Signal<TValue> MyHandle;
22-
typedef D::VarSignal<TValue> MyInputHandle;
21+
typedef typename D::template Signal<TValue> MyHandle;
22+
typedef typename D::template VarSignal<TValue> MyInputHandle;
2323

2424
typedef std::vector<MyHandle> HandleVect;
2525
typedef std::vector<MyInputHandle> InputHandleVect;

src/react/common/Util.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ void PrintBits(size_t const size, void const* const p)
2323

2424
const std::string CurrentDateTime()
2525
{
26+
struct tm tstruct;
2627
char buf[80];
27-
time_t now = time(0);
28-
struct tm tstruct = *localtime(&now);
28+
__time64_t now;
29+
30+
errno_t err = _localtime64_s(&tstruct, &now);
2931

3032
strftime(buf, sizeof(buf), "%Y-%m-%d___%H.%M.%S", &tstruct);
3133

0 commit comments

Comments
 (0)