NVIDIA DeepStream SDK API Reference

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