Program Listing for File gxf_executor.hpp
↰ Return to documentation for file (include/holoscan/core/executors/gxf/gxf_executor.hpp
)
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2023 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_EXECUTORS_GXF_GXF_EXECUTOR_HPP
#define HOLOSCAN_CORE_EXECUTORS_GXF_GXF_EXECUTOR_HPP
#include <gxf/core/gxf.h>
#include <functional>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "../../executor.hpp"
#include "../../gxf/gxf_extension_manager.hpp"
namespace holoscan::gxf {
class GXFExecutor : public holoscan::Executor {
public:
GXFExecutor() = delete;
explicit GXFExecutor(holoscan::Fragment* app, bool create_gxf_context = true);
~GXFExecutor() override;
void run(Graph& graph) override;
void context(void* context) override;
// Inherit Executor::context().
using Executor::context;
std::shared_ptr<ExtensionManager> extension_manager() override;
static void create_input_port(Fragment* fragment, gxf_context_t gxf_context, gxf_uid_t eid,
IOSpec* io_spec, bool bind_port = false);
static void create_output_port(Fragment* fragment, gxf_context_t gxf_context, gxf_uid_t eid,
IOSpec* io_spec, bool bind_port = false);
void op_eid(gxf_uid_t eid) { op_eid_ = eid; }
void op_cid(gxf_uid_t cid) { op_cid_ = cid; }
protected:
bool initialize_operator(Operator* op) override;
bool add_receivers(const std::shared_ptr<Operator>& op, const std::string& receivers_name,
std::set<std::string, std::less<>>& input_labels,
std::vector<holoscan::IOSpec*>& iospec_vector) override;
private:
void register_extensions();
bool own_gxf_context_ = false;
gxf_uid_t op_eid_ = 0;
gxf_uid_t op_cid_ = 0;
std::shared_ptr<GXFExtensionManager> gxf_extension_manager_;
};
} // namespace holoscan::gxf
#endif/* HOLOSCAN_CORE_EXECUTORS_GXF_GXF_EXECUTOR_HPP */