VART-X  0.3.0
vart_inferresult.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024-2026 Advanced Micro Devices Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
24 #include <cstdint>
25 #include <functional>
26 #include <memory>
27 #include <vector>
29 
32 namespace vart {
33 
37 class InferResultImplBase;
38 
49 class InferResult : public std::enable_shared_from_this<InferResult> {
50  public:
51  InferResult() = delete;
52 
67  InferResult(InferResultType infer_res_type);
68 
77  InferResult(std::shared_ptr<InferResultImplBase> ptr);
78 
85  const std::shared_ptr<InferResultImplBase>& get_pimpl_handle() const;
86 
102 
110 
121  void add_child(std::shared_ptr<InferResult> child);
122 
133  void add_children(std::vector<std::shared_ptr<InferResult>> arg_children);
134 
141  std::vector<std::shared_ptr<InferResult>> get_children();
142 
149  std::shared_ptr<InferResult> get_parent();
150 
157  std::shared_ptr<InferResult> get_root();
158 
177  void traverse(const std::function<void(std::shared_ptr<InferResult>, void*)>& callback,
178  TraversalOrder order,
179  void* user_data);
180 
187  size_t get_depth();
188 
189  private:
190  std::shared_ptr<InferResultImplBase> pimpl;
191  std::weak_ptr<InferResult> parent;
192  std::vector<std::shared_ptr<InferResult>> children;
193 };
194 
195 } // namespace vart
This module is used to represent inference results. Built-in supported types are ROOT,...
Definition: vart_inferresult.hpp:49
InferResult(InferResultType infer_res_type)
InferResult() - Constructor for using supported infer result type implementations.
InferResult()=delete
void add_children(std::vector< std::shared_ptr< InferResult >> arg_children)
add_children() - Add all children at once.
const std::shared_ptr< InferResultImplBase > & get_pimpl_handle() const
get_pimpl_handle() - Gives pointer to implementation class.
InferResult(std::shared_ptr< InferResultImplBase > ptr)
InferResult() - Constructor for using user defined implementation.
void transform(InferResScaleInfo &info)
transform() - Transforms the infer results to the input frame resolution.
std::vector< std::shared_ptr< InferResult > > get_children()
get_children() - Returns all children of the node.
std::shared_ptr< InferResult > get_root()
get_root() - Returns root of the given inference result node.
std::shared_ptr< InferResult > get_parent()
get_parent() - Returns parent of the given inference result node.
void add_child(std::shared_ptr< InferResult > child)
add_child() - Add a child to this infer result node.
void traverse(const std::function< void(std::shared_ptr< InferResult >, void *)> &callback, TraversalOrder order, void *user_data)
traverse() - Traverse through the tree nodes in a given order.
InferResultData * get_infer_result()
get_infer_result() - Get the inference result data held by this node.
size_t get_depth()
get_depth() - Returns depth of the current node
VART (Vitis AI Runtime) public API namespace.
InferResultType
Definition: vart_inferresult_types.hpp:37
TraversalOrder
Definition: vart_inferresult_types.hpp:28
Width and height info used to transform inference results to input frame resolution.
Definition: vart_inferresult_types.hpp:62
Base structure for inference result data.
Definition: vart_inferresult_types.hpp:77