Program Listing for File holoviz.hpp
↰ Return to documentation for file (gxf_extensions/holoviz/holoviz.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 GXF_EXTENSIONS_HOLOVIZ_HOLOVIZ_HPP
#define GXF_EXTENSIONS_HOLOVIZ_HOLOVIZ_HPP
#include <array>
#include <list>
#include <string>
#include <vector>
#include "gxf/core/handle.hpp"
#include "gxf/std/allocator.hpp"
#include "gxf/std/codelet.hpp"
#include "gxf/std/receiver.hpp"
#include "gxf/std/scheduling_terms.hpp"
namespace nvidia::holoscan {
class Holoviz : public gxf::Codelet {
public:
gxf_result_t registerInterface(gxf::Registrar* registrar) override;
gxf_result_t start() override;
gxf_result_t tick() override;
gxf_result_t stop() override;
enum class InputType {
UNKNOWN,
COLOR,
COLOR_LUT,
POINTS,
LINES,
LINE_STRIP,
TRIANGLES,
CROSSES,
RECTANGLES,
OVALS,
TEXT
};
struct InputSpec {
InputSpec() = default;
InputSpec(const std::string tensor_name, InputType type)
: tensor_name_(tensor_name), type_(type) {}
std::string tensor_name_;
InputType type_;
float opacity_ = 1.f;
int32_t priority_ =
0;
std::vector<float> color_{1.f, 1.f, 1.f, 1.f};
float line_width_ = 1.f;
float point_size_ = 1.f;
std::vector<std::string> text_;
};
private:
// parameters
gxf::Parameter<std::vector<gxf::Handle<gxf::Receiver>>> receivers_;
gxf::Parameter<gxf::Handle<gxf::Receiver>> render_buffer_input_;
gxf::Parameter<gxf::Handle<gxf::Transmitter>> render_buffer_output_;
gxf::Parameter<std::vector<InputSpec>> tensors_;
gxf::Parameter<std::vector<std::vector<float>>> color_lut_;
gxf::Parameter<std::string> window_title_;
gxf::Parameter<std::string> display_name_;
gxf::Parameter<uint32_t> width_;
gxf::Parameter<uint32_t> height_;
gxf::Parameter<uint32_t> framerate_;
gxf::Parameter<bool> use_exclusive_display_;
gxf::Parameter<bool> fullscreen_;
gxf::Parameter<bool> headless_;
gxf::Parameter<gxf::Handle<gxf::BooleanSchedulingTerm>> window_close_scheduling_term_;
gxf::Parameter<gxf::Handle<gxf::Allocator>> allocator_;
// internal state
std::vector<float> lut_;
std::vector<InputSpec> input_spec_;
};
} // namespace nvidia::holoscan
#endif/* GXF_EXTENSIONS_HOLOVIZ_HOLOVIZ_HPP */