NVIDIA DeepStream SDK API Reference

7.0 Release
nvds_utils.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020 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 #ifndef __NVDS_COMMON_UTILS_H__
14 #define __NVDS_COMMON_UTILS_H__
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif
20 
21 /*
22  * Release memory allocated for gobjects
23  */
24 void free_gobjs(GKeyFile *gcfg_file, GError *error, gchar **keys, gchar *key_name);
25 
26 /*
27  * Internal function to verify if the config string value is a quoted string
28  * config key = "value"
29  * If so, strip beginning and ending quote
30  */
31 NvDsMsgApiErrorType strip_quote(char *cfg_value, const char *cfg_key, const char *LOG_CAT);
32 
33 /*
34  *Function to open a file and search config value for a config key
35  *If found, place the result in cfg_val
36  */
37 NvDsMsgApiErrorType fetch_config_value(char *config_path, const char *cfg_key, char *cfg_val, int len, const char *log_category);
38 
39 /*
40  *Generate hash value of a string using SHA256
41  */
42 std::string generate_sha256_hash(std::string str);
43 
44 /*
45  * remove leading & trailing whitespaces from a string
46  */
47 std::string trim(std::string str);
48 
49 /*
50  * Sort string of format key=value;key1=value1
51  * ex: str = "pq=89;xyz=33;abc=123;"
52  * output = "abc=123;pq=89;xyz=33"
53  */
54 std::string sort_key_value_pairs(std::string str);
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif
trim
std::string trim(std::string str)
fetch_config_value
NvDsMsgApiErrorType fetch_config_value(char *config_path, const char *cfg_key, char *cfg_val, int len, const char *log_category)
NvDsMsgApiErrorType
NvDsMsgApiErrorType
Defines completion codes for operations in the messaging API.
Definition: nvds_msgapi.h:57
LOG_CAT
#define LOG_CAT
Definition: nvmsgbroker.h:29
strip_quote
NvDsMsgApiErrorType strip_quote(char *cfg_value, const char *cfg_key, const char *LOG_CAT)
sort_key_value_pairs
std::string sort_key_value_pairs(std::string str)
free_gobjs
void free_gobjs(GKeyFile *gcfg_file, GError *error, gchar **keys, gchar *key_name)
generate_sha256_hash
std::string generate_sha256_hash(std::string str)