NVIDIA DeepStream SDK API Reference

7.0 Release
includes/ds3d/common/config.h
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_CONFIG_HPP
15 #define DS3D_COMMON_HPP_CONFIG_HPP
16 
17 #include <ds3d/common/common.h>
18 #include <ds3d/common/idatatype.h>
19 #include <ds3d/common/type_trait.h>
20 
21 namespace ds3d { namespace config {
22 
23 enum class ComponentType : int {
24  kNone = 0,
25  kDataLoader = 1,
26  kDataFilter = 2,
27  kDataRender = 3,
28  kUserApp = 4,
29  kDataBridge = 5,
30  kDataMixer = 6,
31  kGstParseBin = 10,
32 };
33 
35  std::string name;
37  std::string gstInCaps;
38  std::string gstOutCaps;
39  std::string linkTo;
40  std::string linkFrom;
41  std::string withQueue; // choose from [src, sink]
42  std::string customLibPath;
43  std::string customCreateFunction;
44  std::string configBody;
45 
46  // raw data
47  std::string rawContent;
48  std::string filePath;
49 };
50 
51 inline ComponentType
52 componentType(const std::string& strType)
53 {
54  const static std::unordered_map<std::string, ComponentType> kTypeMap = {
55  {"ds3d::dataloader", ComponentType::kDataLoader},
56  {"ds3d::datafilter", ComponentType::kDataFilter},
57  {"ds3d::datarender", ComponentType::kDataRender},
58  {"ds3d::databridge", ComponentType::kDataBridge},
59  {"ds3d::datamixer", ComponentType::kDataMixer},
60  {"ds3d::userapp", ComponentType::kUserApp},
61  {"ds3d::gstparsebin", ComponentType::kGstParseBin},
62  };
63  DS_ASSERT(!strType.empty());
64  auto tpIt = kTypeMap.find(strType);
66  tpIt != kTypeMap.end(), ComponentType::kNone, "component type: %s is not supportted.",
67  strType.c_str());
68  return tpIt->second;
69 }
70 
71 inline const char*
73 {
74  switch(type) {
75  case ComponentType::kDataLoader: return "ds3d::dataloader";
76  case ComponentType::kDataFilter: return "ds3d::datafilter";
77  case ComponentType::kDataRender: return "ds3d::datarender";
78  case ComponentType::kDataBridge: return "ds3d::databridge";
79  case ComponentType::kDataMixer: return "ds3d::datamixer";
81  return "ds3d::userapp";
83  return "ds3d::gstparsebin";
84  default: return "ds3d::unknown::component";
85  }
86 }
87 
88 }} // namespace ds3d::config
89 
90 #endif // DS3D_COMMON_HPP_CONFIG_HPP
ds3d::config::ComponentType
ComponentType
Definition: includes/ds3d/common/config.h:23
ds3d::config::ComponentConfig::type
ComponentType type
Definition: includes/ds3d/common/config.h:36
DS_ASSERT
#define DS_ASSERT(...)
Definition: defines.h:31
ds3d::config::ComponentType::kNone
@ kNone
ds3d::config::componentTypeStr
const char * componentTypeStr(ComponentType type)
Definition: includes/ds3d/common/config.h:72
type_trait.h
ds3d::config::ComponentType::kDataFilter
@ kDataFilter
ds3d::config::ComponentConfig::gstInCaps
std::string gstInCaps
Definition: includes/ds3d/common/config.h:37
ds3d::config::ComponentType::kDataBridge
@ kDataBridge
ds3d::config::ComponentConfig::withQueue
std::string withQueue
Definition: includes/ds3d/common/config.h:41
ds3d::config::ComponentType::kGstParseBin
@ kGstParseBin
ds3d::config::ComponentConfig::linkFrom
std::string linkFrom
Definition: includes/ds3d/common/config.h:40
ds3d::config::ComponentType::kDataRender
@ kDataRender
ds3d::config::ComponentConfig::configBody
std::string configBody
Definition: includes/ds3d/common/config.h:44
common.h
ds3d::config::ComponentType::kDataLoader
@ kDataLoader
ds3d::config::ComponentConfig::filePath
std::string filePath
Definition: includes/ds3d/common/config.h:48
ds3d::config::ComponentConfig::customCreateFunction
std::string customCreateFunction
Definition: includes/ds3d/common/config.h:43
ds3d::config::ComponentConfig::name
std::string name
Definition: includes/ds3d/common/config.h:35
ds3d::config::ComponentConfig::rawContent
std::string rawContent
Definition: includes/ds3d/common/config.h:47
idatatype.h
ds3d::config::ComponentConfig
Definition: includes/ds3d/common/config.h:34
ds3d::config::ComponentConfig::gstOutCaps
std::string gstOutCaps
Definition: includes/ds3d/common/config.h:38
DS3D_FAILED_RETURN
#define DS3D_FAILED_RETURN(condition, ret, fmt,...)
Definition: defines.h:64
ds3d::config::componentType
ComponentType componentType(const std::string &strType)
Definition: includes/ds3d/common/config.h:52
ds3d
Definition: lidar_3d_datatype.h:35
ds3d::config::ComponentType::kDataMixer
@ kDataMixer
ds3d::config::ComponentConfig::linkTo
std::string linkTo
Definition: includes/ds3d/common/config.h:39
ds3d::config::ComponentConfig::customLibPath
std::string customLibPath
Definition: includes/ds3d/common/config.h:42
ds3d::config::ComponentType::kUserApp
@ kUserApp