NVIDIA DeepStream SDK API Reference

7.0 Release
dataloader.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 
14 #ifndef _DS3D_COMMON_HPP_DATALOADER_HPP
15 #define _DS3D_COMMON_HPP_DATALOADER_HPP
16 
17 #include <ds3d/common/common.h>
18 #include <ds3d/common/func_utils.h>
20 
21 namespace ds3d {
22 
46 class GuardDataLoader : public GuardDataProcess<abiDataLoader> {
48 
49 public:
50  // GuardDataLoader() = default;
51  template <typename... Args /*, _EnableIfConstructible<_Base, Args...> = true*/>
52  GuardDataLoader(Args&&... args) : _Base(std::forward<Args>(args)...)
53  {
54  }
55  ~GuardDataLoader() = default;
56 
57  std::string getOutputCaps()
58  {
59  DS_ASSERT(ptr());
60  return cppString(ptr()->getCaps_i(CapsPort::kOutput));
61  }
62 
64  {
65  abiRefDataMap* data = nullptr;
66  DS_ASSERT(ptr());
67  ErrCode code = ptr()->readData_i(data);
68  datamap.reset(data);
69  return code;
70  }
71 
73  {
74  DS_ASSERT(ptr());
75  DS_ASSERT(dataReadyCB);
76  GuardCB<abiOnDataCB> guardCb;
77  guardCb.setFn<ErrCode, const abiRefDataMap*>(std::move(dataReadyCB));
78  return ptr()->readDataAsync_i(guardCb.abiRef());
79  }
80 };
81 
82 } // namespace ds3d
83 
84 #endif // _DS3D_COMMON_HPP_DATALOADER_HPP
ds3d::GuardDataLoader::GuardDataLoader
GuardDataLoader(Args &&... args)
Definition: dataloader.hpp:52
DS_ASSERT
#define DS_ASSERT(...)
Definition: defines.h:31
ds3d::GuardDataProcess
Definition: dataprocess.hpp:29
dataprocess.hpp
ds3d::GuardRef< abiCB >::abiRef
abiCB * abiRef() const
Definition: obj.hpp:269
ds3d::abiDataLoader::readData_i
virtual ErrCode readData_i(abiRefDataMap *&datamap)=0
ds3d::GuardDataLoader
GuardDataLoader is the safe access entry for abiDataLoader.
Definition: dataloader.hpp:46
ds3d::GuardDataLoader::readDataAsync
ErrCode readDataAsync(abiOnDataCB::CppFunc dataReadyCB)
Definition: dataloader.hpp:72
ds3d::abiRefT< abiDataMap >
ds3d::ErrCode
ErrCode
Definition: common.h:43
ds3d::GuardCB::setFn
void setFn(F f)
Definition: obj.hpp:297
ds3d::GuardRef::reset
void reset(ref *abiref=nullptr)
Definition: obj.hpp:260
common.h
ds3d::GuardDataT< abiDataLoader >::ptr
abiDataLoader * ptr() const
Definition: obj.hpp:361
ds3d::CapsPort::kOutput
@ kOutput
func_utils.h
ds3d::GuardDataMap
Definition: datamap.hpp:21
ds3d::abiDataLoader::readDataAsync_i
virtual ErrCode readDataAsync_i(const abiOnDataCB *dataReadyCb)=0
ds3d::GuardDataLoader::~GuardDataLoader
~GuardDataLoader()=default
ds3d::cppString
std::string cppString(const char *str, size_t len=0)
Definition: func_utils.h:108
ds3d
Definition: lidar_3d_datatype.h:35
ds3d::abiCallBackT::CppFunc
std::function< void(Args...)> CppFunc
Definition: abi_obj.h:72
ds3d::GuardDataLoader::getOutputCaps
std::string getOutputCaps()
Definition: dataloader.hpp:57
ds3d::GuardCB
Definition: obj.hpp:285
ds3d::GuardDataLoader::readData
ErrCode readData(GuardDataMap &datamap)
Definition: dataloader.hpp:63