Upload Audio_Effects_SDK/samples/utils/ConfigReader.hpp with huggingface_hub
Browse files
Audio_Effects_SDK/samples/utils/ConfigReader.hpp
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
3 |
+
|
4 |
+
NVIDIA CORPORATION and its licensors retain all intellectual property
|
5 |
+
and proprietary rights in and to this software, related documentation
|
6 |
+
and any modifications thereto. Any use, reproduction, disclosure or
|
7 |
+
distribution of this software and related documentation without an express
|
8 |
+
license agreement from NVIDIA CORPORATION is strictly prohibited.
|
9 |
+
*/
|
10 |
+
#pragma once
|
11 |
+
|
12 |
+
#include <string>
|
13 |
+
#include <unordered_map>
|
14 |
+
#include <vector>
|
15 |
+
|
16 |
+
using config_dict = std::unordered_map<std::string, std::string>;
|
17 |
+
|
18 |
+
/**
|
19 |
+
Parses and provides access to configuration values. The format of the file expected is:
|
20 |
+
# Comments start with #. No comments allowed on lines having name/value
|
21 |
+
name value
|
22 |
+
*/
|
23 |
+
class ConfigReader {
|
24 |
+
public:
|
25 |
+
// Parses the config file.
|
26 |
+
bool Load(const std::string& config_filename);
|
27 |
+
// Returns true if config value is available
|
28 |
+
bool IsConfigValueAvailable(const std::string& name) const;
|
29 |
+
// Get value associated with name
|
30 |
+
bool GetConfigValue(const std::string& name, std::string* value) const;
|
31 |
+
// Get value associated with name. Returns empty string if value not found
|
32 |
+
std::string GetConfigValue(const std::string& name) const;
|
33 |
+
// Get vector of values associated with name. Returns empty vector if no value is found
|
34 |
+
std::vector<std::string> GetConfigValueList(const std::string& name) const;
|
35 |
+
private:
|
36 |
+
// true if config file is loaded
|
37 |
+
bool loaded_ = false;
|
38 |
+
// Internal config data store
|
39 |
+
config_dict config_dict_;
|
40 |
+
};
|