RIC:1060: Change in PTL
[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 /*
18  * This source code is part of the near-RT RIC (RAN Intelligent Controller)
19  * platform project (RICP).
20 */
21
22 #ifndef SHAREDDATALAYER_NAMESPACECONFIGURATIONIMPL_HPP_
23 #define SHAREDDATALAYER_NAMESPACECONFIGURATIONIMPL_HPP_
24
25 #include "private/namespaceconfigurations.hpp"
26 #include <unordered_map>
27 #include <vector>
28
29 namespace shareddatalayer
30 {
31     class NamespaceConfigurationsImpl: public NamespaceConfigurations
32     {
33     public:
34         NamespaceConfigurationsImpl();
35
36         ~NamespaceConfigurationsImpl() override;
37
38         void addNamespaceConfiguration(const NamespaceConfiguration& namespaceConfiguration) override;
39         bool isDbBackendUseEnabled(const std::string& ns) const override;
40         bool areNotificationsEnabled(const std::string& ns) const override;
41         std::string getDescription(const std::string& ns) const override;
42         bool isEmpty() const override;
43
44         //Meant for UT usage
45         bool isNamespaceInLookupTable(const std::string& ns) const;
46
47     private:
48         std::vector<NamespaceConfiguration> namespaceConfigurations;
49         const std::vector<int>::size_type defaultConfigurationIndex;
50         mutable std::unordered_map<std::string, std::vector<int>::size_type> namespaceConfigurationsLookupTable;
51
52         const NamespaceConfiguration& findConfigurationForNamespace(const std::string& ns) const;
53     };
54 }
55
56 #endif