Resource Tuner
Loading...
Searching...
No Matches
PropertiesRegistry.h
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause-Clear
3
4#ifndef PROPERTIES_REGISTRY_H
5#define PROPERTIES_REGISTRY_H
6
7#include <iostream>
8#include <unordered_map>
9#include <memory>
10#include <shared_mutex>
11
17private:
18 static std::shared_ptr<PropertiesRegistry> propRegistryInstance;
19 std::unordered_map<std::string, std::string> mProperties;
20 std::shared_timed_mutex mPropRegistryMutex;
21
23
24public:
26
35 int8_t createProperty(const std::string& propertyName, const std::string& propertyValue);
36
45 int8_t queryProperty(const std::string& propertyName, std::string& result);
46
55 int8_t modifyProperty(const std::string& propertyName, const std::string& propertyValue);
56
64 int8_t deleteProperty(const std::string& propertyName);
65
66 int32_t getPropertiesCount();
67
68 static std::shared_ptr<PropertiesRegistry> getInstance() {
69 if(propRegistryInstance == nullptr) {
70 std::shared_ptr<PropertiesRegistry> localpropRegistryInstance(new PropertiesRegistry());
71 localpropRegistryInstance.swap(propRegistryInstance);
72 }
73 return propRegistryInstance;
74 }
75};
76
77#endif
PropertiesRegistry.
int8_t modifyProperty(const std::string &propertyName, const std::string &propertyValue)
Modify the value of the property with the given name.
int8_t deleteProperty(const std::string &propertyName)
Delete the Property with the given name (key)
int8_t createProperty(const std::string &propertyName, const std::string &propertyValue)
Create a property with the given name (key) and value.
int8_t queryProperty(const std::string &propertyName, std::string &result)
Get the Property value corresponding to the given key.