Committing TBB 2019 Update 9 source code
[platform/upstream/tbb.git] / include / tbb / flow_graph_abstractions.h
1 /*
2     Copyright (c) 2005-2019 Intel Corporation
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8         http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15 */
16
17 #ifndef __TBB_flow_graph_abstractions_H
18 #define __TBB_flow_graph_abstractions_H
19
20 namespace tbb {
21 namespace flow {
22 namespace interface11 {
23
24 //! Pure virtual template classes that define interfaces for async communication
25 class graph_proxy {
26 public:
27     //! Inform a graph that messages may come from outside, to prevent premature graph completion
28     virtual void reserve_wait() = 0;
29
30     //! Inform a graph that a previous call to reserve_wait is no longer in effect
31     virtual void release_wait() = 0;
32
33     virtual ~graph_proxy() {}
34 };
35
36 template <typename Input>
37 class receiver_gateway : public graph_proxy {
38 public:
39     //! Type of inputing data into FG.
40     typedef Input input_type;
41
42     //! Submit signal from an asynchronous activity to FG.
43     virtual bool try_put(const input_type&) = 0;
44 };
45
46 } //interfaceX
47
48 using interface11::graph_proxy;
49 using interface11::receiver_gateway;
50
51 } //flow
52 } //tbb
53 #endif