87c80b9faa8bcdd03228b65b746ae2f66b35a9de
[ric-plt/sdl.git] / include / private / namespaceconfigurationsimpl.hpp
1 /*
2    Copyright (c) 2018-2019 Nokia.
3
4    Licensed under the Apache License, Version 2.0 (the "License");
5    you may not use this file except in compliance with the License.
6    You may obtain a copy of the License at
7
8        http://www.apache.org/licenses/LICENSE-2.0
9
10    Unless required by applicable law or agreed to in writing, software
11    distributed under the License is distributed on an "AS IS" BASIS,
12    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    See the License for the specific language governing permissions and
14    limitations under the License.
15 */
16
17 #ifndef SHAREDDATALAYER_NAMESPACECONFIGURATIONIMPL_HPP_
18 #define SHAREDDATALAYER_NAMESPACECONFIGURATIONIMPL_HPP_
19
20 #include "private/namespaceconfigurations.hpp"
21 #include <unordered_map>
22 #include <vector>
23
24 namespace shareddatalayer
25 {
26     class NamespaceConfigurationsImpl: public NamespaceConfigurations
27     {
28     public:
29         NamespaceConfigurationsImpl();
30
31         ~NamespaceConfigurationsImpl() override;
32
33         void addNamespaceConfiguration(const NamespaceConfiguration& namespaceConfiguration) override;
34         bool isDbBackendUseEnabled(const std::string& ns) const override;
35         bool areNotificationsEnabled(const std::string& ns) const override;
36         std::string getDescription(const std::string& ns) const override;
37         bool isEmpty() const override;
38
39         //Meant for UT usage
40         bool isNamespaceInLookupTable(const std::string& ns) const;
41
42     private:
43         std::vector<NamespaceConfiguration> namespaceConfigurations;
44         const std::vector<int>::size_type defaultConfigurationIndex;
45         mutable std::unordered_map<std::string, std::vector<int>::size_type> namespaceConfigurationsLookupTable;
46
47         const NamespaceConfiguration& findConfigurationForNamespace(const std::string& ns) const;
48     };
49 }
50
51 #endif