.. SPDX-FileCopyrightText: 2019-2021 Intel Corporation .. .. SPDX-License-Identifier: CC-BY-4.0 ============= continue_node ============= **[flow_graph.continue_node]** A node that executes a specified body object when triggered. .. code:: cpp // Defined in header namespace oneapi { namespace tbb { namespace flow { template< typename Output, typename Policy = /*implementation-defined*/ > class continue_node : public graph_node, public receiver, public sender { public: template continue_node( graph &g, Body body, node_priority_t priority = no_priority ); template continue_node( graph &g, Body body, Policy /*unspecified*/ = Policy(), node_priority_t priority = no_priority ); template continue_node( graph &g, int number_of_predecessors, Body body, node_priority_t priority = no_priority ); template continue_node( graph &g, int number_of_predecessors, Body body, Policy /*unspecified*/ = Policy(), node_priority_t priority = no_priority ); continue_node( const continue_node &src ); ~continue_node(); bool try_put( const input_type &v ); bool try_get( output_type &v ); }; } // namespace flow } // namespace tbb } // namespace oneapi Requirements: * The type ``Output`` must meet the `CopyConstructible` requirements from [copyconstructible] ISO C++ Standard section. * The type ``Policy`` can be specified as :doc:`lightweight policy` or defaulted. * The type ``Body`` must meet the :doc:`ContinueNodeBody requirements <../named_requirements/flow_graph/continue_node_body>`. A ``continue_node`` is a ``graph_node``, ``receiver``, and ``sender``. This node is used for nodes that wait for their predecessors to complete before executing, but no explicit data is passed across the incoming edges. A ``continue_node`` maintains an internal threshold that defines the number of predecessors. This value can be provided at construction. Call of the :doc:`make_edge function ` with ``continue_node`` as a receiver increases its threshold. Call of the :doc:`remove_edge function ` with ``continue_node`` as a receiver decreases it. Each time the number of ``try_put()`` calls reaches the defined threshold, node's ``body`` is called and the node starts counting the number of ``try_put()`` calls from the beginning. ``continue_node`` has a `discarding` and `broadcast-push` :doc:`properties `. The body object passed to a ``continue_node`` is copied. Updates to member variables do not affect the original object used to construct the node. If the state held within a body object must be inspected from outside of the node, the :doc:`copy_body function ` can be used to obtain an updated copy. Member functions ----------------- .. code:: cpp template continue_node( graph &g, Body body, node_priority_t priority = no_priority ); Constructs a ``continue_node`` that invokes ``body``. The internal threshold is set to 0. This function specifies :doc:`node priority`. ---------------------------------------------------------------- .. code:: cpp template continue_node( graph &g, Body body, Policy /*unspecified*/ = Policy(), node_priority_t priority = no_priority ); Constructs a ``continue_node`` that invokes ``body``. The internal threshold is set to 0. This function specifies :doc:`lightweight policy` and :doc:`node priority`. ---------------------------------------------------------------- .. code:: cpp template continue_node( graph &g, int number_of_predecessors, Body body, node_priority_t priority = no_priority ); Constructs a ``continue_node`` that invokes ``body``. The internal threshold is set to ``number_of_predecessors``. This function specifies :doc:`node priority`. ---------------------------------------------------------------- .. code:: cpp template continue_node( graph &g, int number_of_predecessors, Body body, Policy /*unspecified*/ = Policy(), node_priority_t priority = no_priority ); Constructs a ``continue_node`` that invokes ``body``. The internal threshold is set to ``number_of_predecessors``. This function specifies :doc:`lightweight policy` and :doc:`node priority`. ---------------------------------------------------------------- .. code:: cpp template continue_node( graph &g, int number_of_predecessors, Body body ); Constructs a ``continue_node`` that invokes ``body``. The internal threshold is set to ``number_of_predecessors``. ---------------------------------------------------------------- .. code:: cpp continue_node( const continue_node &src ) Constructs a ``continue_node`` that has the same initial state that ``src`` had after its construction. It does not copy the current count of ``try_puts`` received, or the current known number of predecessors. The ``continue_node`` that is constructed has a reference to the same ``graph`` object as ``src``, has a copy of the initial ``body`` used by ``src``, and only has a non-zero threshold if ``src`` is constructed with a non-zero threshold. The new body object is copy-constructed from a copy of the original body provided to ``src`` at its construction. ---------------------------------------------------------------- .. code:: cpp bool try_put( const Input &v ) Increments the count of ``try_put()`` calls received. If the incremented count is equal to the number of known predecessors, performs the ``body`` function object execution. It does not wait for the execution of the body to complete. **Returns**: ``true`` ---------------------------------------------------------------- .. code:: cpp bool try_get( Output &v ) **Returns**: ``false`` Deduction Guides ---------------- .. code:: cpp template continue_node(graph&, Body, Policy, node_priority_t = no_priority) -> continue_node>, Policy>; template continue_node(graph&, int, Body, Policy, node_priority_t = no_priority) -> continue_node>, Policy>; template continue_node(graph&, Body, node_priority_t = no_priority) -> continue_node>, /*default-policy*/>; template continue_node(graph&, int, Body, node_priority_t = no_priority) -> continue_node>, /*default-policy*/>; Where: * ``continue_output_t`` is an alias to `Output` template argument type. If `Output` specified as ``void``, ``continue_output_t`` is an alias to ``continue_msg`` type. Example ------- A set of ``continue_nodes`` forms a :doc:`Dependency Flow Graph `.