Userspace Resource Manager
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 <unordered_map>
8#include <string>
9#include <system_error>
10#include <memory>
11#include <shared_mutex>
12
18private:
19 static std::shared_ptr<PropertiesRegistry> propRegistryInstance;
20 std::unordered_map<std::string, std::string> mProperties;
21 std::shared_timed_mutex mPropRegistryMutex;
22
24
25public:
27
36 int8_t createProperty(const std::string& propertyName, const std::string& propertyValue);
37
46 int8_t queryProperty(const std::string& propertyName, std::string& result);
47
56 int8_t modifyProperty(const std::string& propertyName, const std::string& propertyValue);
57
65 int8_t deleteProperty(const std::string& propertyName);
66
67 int32_t getPropertiesCount();
68
69 static std::shared_ptr<PropertiesRegistry> getInstance() {
70 if(propRegistryInstance == nullptr) {
71 std::shared_ptr<PropertiesRegistry> localpropRegistryInstance(new PropertiesRegistry());
72 localpropRegistryInstance.swap(propRegistryInstance);
73 }
74 return propRegistryInstance;
75 }
76};
77
78#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.