flow_graph_abstractions.h 1.5 KB

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