NVIDIA DeepStream SDK API Reference

8.0 Release
ds_yaml_parser.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024 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 #include <iostream>
14 #include <typeinfo>
15 #include "yaml-cpp/yaml.h"
16 #include <string.h>
17 
18 using namespace std;
19 
21  // Class Used to Pass PAD Template Data
22  public:
23  std:: string target;
26 
27  Link_To_Element (std:: string target, std:: string source_element_src_pad_template, std:: string target_element_sink_pad_template) {
28  this->target = target;
29  this->source_element_src_pad_template = source_element_src_pad_template;
30  this->target_element_sink_pad_template = target_element_sink_pad_template;
31  }
32 };
33 
34 // TODO: Make required members private instead of public
35 class YAML_DSLink {
36 public:
37  std::string source;
38  std::string target;
39  YAML_DSLink(std::string src, std::string dest) {
40  source.assign(src);
41  target.assign(dest);
42  }
43 };
44 
45 // TODO: Make required members private instead of public
47 public:
48  std::string m_elementName;
49  std::string m_linkName;
50  // Used to pass linking data
51  std::vector< Link_To_Element > m_linkToElement;
52  std::vector<YAML_DSElement> m_subConfigs;
53  // properties
54  YAML::Node properties_;
55 
57  m_subConfigs.clear();
58  }
59 
60  YAML_DSElement(std::string name): m_elementName(name) {
61  m_subConfigs.clear();
62  }
63 
64 };
65 
67 public:
68  YAML_DSConfig(std::string ds_yaml_file) {
69  m_yamlName.assign(ds_yaml_file);
70  m_yamlNode = YAML::LoadFile(ds_yaml_file);
71  }
72  const std::vector<YAML_DSElement> & getElementsVector() {
73  return m_dsElement;
74  }
75  void Parse();
76  void PrintElements();
77 
78 private:
79  YAML::Node m_yamlNode;
80  std::string m_yamlName;
81  std::vector<YAML_DSElement> m_dsElement;
82  std::vector<YAML_DSLink*> m_dsLinks_vec;
83 
84  void CreateElementFromNode (const YAML::Node &node);
85  void CreateElementsLink (const YAML::Node &node);
86  void ParseDSYAML(const YAML::Node &node);
87 };
YAML_DSElement::YAML_DSElement
YAML_DSElement(std::string name)
Definition: ds_yaml_parser.hpp:60
YAML_DSConfig::YAML_DSConfig
YAML_DSConfig(std::string ds_yaml_file)
Definition: ds_yaml_parser.hpp:68
YAML_DSElement::m_linkToElement
std::vector< Link_To_Element > m_linkToElement
Definition: ds_yaml_parser.hpp:51
YAML_DSConfig
Definition: ds_yaml_parser.hpp:66
YAML_DSElement::m_subConfigs
std::vector< YAML_DSElement > m_subConfigs
Definition: ds_yaml_parser.hpp:52
YAML_DSElement::m_linkName
std::string m_linkName
Definition: ds_yaml_parser.hpp:49
YAML_DSElement
Definition: ds_yaml_parser.hpp:46
YAML_DSElement::~YAML_DSElement
~YAML_DSElement()
Definition: ds_yaml_parser.hpp:56
YAML_DSElement::properties_
YAML::Node properties_
Definition: ds_yaml_parser.hpp:54
YAML_DSElement::m_elementName
std::string m_elementName
Definition: ds_yaml_parser.hpp:48
YAML_DSConfig::getElementsVector
const std::vector< YAML_DSElement > & getElementsVector()
Definition: ds_yaml_parser.hpp:72