Program Listing for File executor.hpp
↰ Return to documentation for file (include/holoscan/core/executor.hpp
)
/*
* 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_EXECUTORS_EXECUTOR_HPP
#define HOLOSCAN_CORE_EXECUTORS_EXECUTOR_HPP
#include <cstdint>
#include <functional>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "./common.hpp"
#include "./operator.hpp"
namespace holoscan {
class Executor {
public:
Executor() = delete;
explicit Executor(Fragment* fragment) : fragment_(fragment) {}
virtual ~Executor() = default;
virtual void run(Graph& graph) { (void)graph; }
Fragment* fragment() { return fragment_; }
void context(void* context) { context_ = context; }
void* context() { return context_; }
// add uint64_t context getters/setters for Python API
void context_uint64(uint64_t context) { context_ = reinterpret_cast<void*>(context); }
uint64_t context_uint64() { return reinterpret_cast<uint64_t>(context_); }
protected:
friend class Fragment; // make Fragment a friend class to access protected members of Executor
// (add_receivers()).
friend class Operator; // make Operator a friend class to access protected members of Executor
// (initialize_operator()).
virtual bool initialize_operator(Operator* op) {
(void)op;
return false;
}
virtual 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) {
(void)op;
(void)receivers_name;
(void)input_labels;
(void)iospec_vector;
return false;
}
Fragment* fragment_ = nullptr;
void* context_ = nullptr;
};
} // namespace holoscan
#endif/* HOLOSCAN_CORE_EXECUTORS_EXECUTOR_HPP */