NVIDIA DeepStream SDK API Reference

9.1 Release
sources/includes/ds3d/common/hpp/databridge.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_DATA_BRIDGE_HPP
19 #define DS3D_COMMON_HPP_DATA_BRIDGE_HPP
20 
21 #include <ds3d/common/common.h>
22 #include <ds3d/common/func_utils.h>
23 #include <ds3d/common/hpp/dataprocess.hpp>
24 
25 namespace ds3d {
26 
59 class GuardDataBridge : public GuardDataProcess<abiDataBridge> {
61 
62 public:
63  template <typename... Args>
64  GuardDataBridge(Args&&... args) : _Base(std::forward<Args>(args)...)
65  {
66  }
67  ~GuardDataBridge() = default;
68 
70  const struct VideoBridge2dInput* inputData, abiOnDataCB::CppFunc outputDataCB,
71  abiOnBridgeDataCB::CppFunc inputConsumedCB)
72  {
73  GuardCB<abiOnDataCB> guardOutputCb;
74  GuardCB<abiOnBridgeDataCB> guardConsumedCb;
75  guardOutputCb.setFn<ErrCode, const abiRefDataMap*>(std::move(outputDataCB));
76  guardConsumedCb.setFn<ErrCode, const struct VideoBridge2dInput*>(std::move(inputConsumedCB));
77 
78  DS_ASSERT(ptr());
79  ErrCode code =
80  ptr()->process_i(inputData, guardOutputCb.abiRef(), guardConsumedCb.abiRef());
81  return code;
82  }
83 };
84 
85 } // namespace ds3d
86 
87 #endif // DS3D_COMMON_HPP_DATA_BRIDGE_HPP
ds3d::GuardDataBridge::process
ErrCode process(const struct VideoBridge2dInput *inputData, abiOnDataCB::CppFunc outputDataCB, abiOnBridgeDataCB::CppFunc inputConsumedCB)
Definition: sources/includes/ds3d/common/hpp/databridge.hpp:69
ds3d::GuardDataBridge::GuardDataBridge
GuardDataBridge(Args &&... args)
Definition: sources/includes/ds3d/common/hpp/databridge.hpp:64
ds3d::GuardDataProcess
Definition: sources/includes/ds3d/common/hpp/dataprocess.hpp:33
ds3d::VideoBridge2dInput
Definition: sources/includes/ds3d/common/idatatype.h:157
ds3d::GuardRef< abiCB >::abiRef
abiCB * abiRef() const
Definition: sources/includes/ds3d/common/hpp/obj.hpp:273
ds3d::abiRefT< abiDataMap >
ds3d::GuardDataBridge::~GuardDataBridge
~GuardDataBridge()=default
ds3d::abiDataBridge::process_i
virtual ErrCode process_i(const struct VideoBridge2dInput *inputData, const abiOnDataCB *outputDataCb, const abiOnBridgeDataCB *dataConsumedCb)=0
DS_ASSERT
#define DS_ASSERT(...)
Definition: sources/includes/ds3d/common/defines.h:36
ds3d::ErrCode
ErrCode
Definition: sources/includes/ds3d/common/common.h:47
ds3d::GuardDataBridge
GuardDataBridge is the safe access entry for abiDataBridge.
Definition: sources/includes/ds3d/common/hpp/databridge.hpp:59
ds3d::GuardCB::setFn
void setFn(F f)
Definition: sources/includes/ds3d/common/hpp/obj.hpp:301
ds3d::GuardDataT< abiDataBridge >::ptr
abiDataBridge * ptr() const
Definition: sources/includes/ds3d/common/hpp/obj.hpp:365
ds3d
Definition: sources/includes/ds3d/common/abi_dataprocess.h:25
ds3d::abiCallBackT::CppFunc
std::function< void(Args...)> CppFunc
Definition: sources/includes/ds3d/common/abi_obj.h:76
ds3d::GuardCB
Definition: sources/includes/ds3d/common/hpp/obj.hpp:289