-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathgroup.h
More file actions
66 lines (46 loc) · 2.14 KB
/
group.h
File metadata and controls
66 lines (46 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright Sebastian Jeckel 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef REACT_GROUP_H_INCLUDED
#define REACT_GROUP_H_INCLUDED
#pragma once
#include "react/detail/defs.h"
#include <memory>
#include <utility>
#include "react/api.h"
#include "react/common/syncpoint.h"
#include "react/detail/graph_interface.h"
#include "react/detail/graph_impl.h"
/*****************************************/ REACT_BEGIN /*****************************************/
///////////////////////////////////////////////////////////////////////////////////////////////////
/// Group
///////////////////////////////////////////////////////////////////////////////////////////////////
class Group : protected REACT_IMPL::GroupInternals
{
public:
Group() = default;
Group(const Group&) = default;
Group& operator=(const Group&) = default;
Group(Group&&) = default;
Group& operator=(Group&&) = default;
template <typename F>
void DoTransaction(F&& func)
{ GetGraphPtr()->DoTransaction(std::forward<F>(func)); }
template <typename F>
void EnqueueTransaction(F&& func, TransactionFlags flags = TransactionFlags::none)
{ GetGraphPtr()->EnqueueTransaction(std::forward<F>(func), SyncPoint::Dependency{ }, flags); }
template <typename F>
void EnqueueTransaction(F&& func, const SyncPoint& syncPoint, TransactionFlags flags = TransactionFlags::none)
{ GetGraphPtr()->EnqueueTransaction(std::forward<F>(func), SyncPoint::Dependency{ syncPoint }, flags); }
friend bool operator==(const Group& a, const Group& b)
{ return a.GetGraphPtr() == b.GetGraphPtr(); }
friend bool operator!=(const Group& a, const Group& b)
{ return !(a == b); }
friend auto GetInternals(Group& g) -> REACT_IMPL::GroupInternals&
{ return g; }
friend auto GetInternals(const Group& g) -> const REACT_IMPL::GroupInternals&
{ return g; }
};
/******************************************/ REACT_END /******************************************/
#endif // REACT_GROUP_H_INCLUDED