NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/ds3d/common/hpp/frame.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DS3D_COMMON_HPP_FRAME__HPP
19 #define _DS3D_COMMON_HPP_FRAME__HPP
20 
21 #include <ds3d/common/abi_frame.h>
22 #include <ds3d/common/func_utils.h>
23 
24 #include <ds3d/common/hpp/obj.hpp>
25 
26 namespace ds3d {
27 
28 
30 
31 #if 0
32 // abiFrame Guard
33 class FrameGuard : public GuardDataT<abiFrame> {
34  using _Base = GuardDataT<abiFrame>;
35 
36 public:
37  FrameGuard() = default;
38  template <typename... Args>
39  FrameGuard(Args&&... args) : _Base(std::forward<Args>(args)...)
40  {
41  }
42 
43  template <class EleT>
44  EleT& at(size_t idx)
45  {
46  abiFrame* f = this->ptr();
47  DS_ASSERT(this->ptr());
48  DS3D_THROW_ERROR(idx < ShapeSize(f->shape()), ErrCode::kOutOfRange, "idx out of range");
49  uint32_t eleSize = dataTypeBytes(f->dataType());
50  DS_ASSERT(sizeof(EleT) < eleSize);
51  return *static_cast<EleT*>((uint8_t*)f->base() + eleSize * idx);
52  }
53 };
54 #endif
55 
56 // abi2DFrame Guard
58 
59 } // namespace ds3d
60 
61 #endif // _DS3D_COMMON_HPP_FRAME__HPP
ds3d::ShapeSize
size_t ShapeSize(const Shape &shape)
Definition: sources/includes/ds3d/common/func_utils.h:170
ds3d::ErrCode::kOutOfRange
@ kOutOfRange
ds3d::abiFrame::shape
virtual const Shape & shape() const =0
ds3d::abiFrame::base
virtual void * base() const =0
DS_ASSERT
#define DS_ASSERT(...)
Definition: sources/includes/ds3d/common/defines.h:36
ds3d::GuardDataT
Definition: sources/includes/ds3d/common/hpp/obj.hpp:335
ds3d::FrameGuard
GuardDataT< abiFrame > FrameGuard
Definition: sources/includes/ds3d/common/hpp/frame.hpp:29
ds3d::dataTypeBytes
uint32_t dataTypeBytes(DataType t)
Definition: sources/includes/ds3d/common/func_utils.h:146
ds3d::GuardDataT::ptr
Tp * ptr() const
Definition: sources/includes/ds3d/common/hpp/obj.hpp:365
DS3D_THROW_ERROR
#define DS3D_THROW_ERROR(statement, code, msg)
Definition: sources/includes/ds3d/common/defines.h:83
ds3d
Definition: sources/includes/ds3d/common/abi_dataprocess.h:25
ds3d::abiFrame::dataType
virtual DataType dataType() const =0
ds3d::abiFrame
Definition: sources/includes/ds3d/common/abi_frame.h:26