NVIDIA Holoscan SDK v0.4.0
Clara Holoscan v0.4.0

Program Listing for File graph.hpp

Return to documentation for file (include/holoscan/core/graph.hpp)

Copy
Copied!
            

/* * SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HOLOSCAN_CORE_GRAPHS_GRAPH_HPP #define HOLOSCAN_CORE_GRAPHS_GRAPH_HPP #include <functional> #include <iostream> #include <memory> #include <optional> #include <set> #include <string> #include <unordered_map> #include <vector> #include "./common.hpp" namespace holoscan { // Forward declarations class Operator; class Graph { public: using NodeType = std::shared_ptr<Operator>; using EdgeDataElementType = std::unordered_map<std::string, std::set<std::string, std::less<>>>; using EdgeDataType = std::shared_ptr<EdgeDataElementType>; Graph() = default; virtual ~Graph() = default; virtual void add_operator(const NodeType& op) = 0; virtual void add_flow(const NodeType& op_u, const NodeType& op_v, const EdgeDataType& port_map) = 0; virtual std::optional<EdgeDataType> get_port_map(const NodeType& op_u, const NodeType& op_v) = 0; virtual bool is_root(const NodeType& op) = 0; virtual bool is_leaf(const NodeType& op) = 0; virtual std::vector<NodeType> get_root_operators() = 0; virtual std::vector<NodeType> get_operators() = 0; virtual std::vector<NodeType> get_next_operators(const NodeType& op) = 0; virtual void context(void* context) { context_ = context; } virtual void* context() { return context_; } protected: void* context_ = nullptr; }; } // namespace holoscan #endif/* HOLOSCAN_CORE_GRAPHS_GRAPH_HPP */

© Copyright 2022, NVIDIA. Last updated on Jun 28, 2023.