client-cpp  0.10.0
ConfigurationManager.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
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 CONFIGURATION_MANAGER_HPP_
18 #define CONFIGURATION_MANAGER_HPP_
19 
21 
26 #include "kaa/configuration/gen/ConfigurationDefinitions.hpp"
28 
29 namespace kaa {
30 
31 class IExecutorContext;
32 class IConfigurationReceiver;
33 
45 public:
47 
48  virtual void init();
49 
50  virtual void processConfigurationData(const std::vector<std::uint8_t>& data, bool fullResync);
51 
52  virtual void addReceiver(IConfigurationReceiver &receiver);
53  virtual void removeReceiver(IConfigurationReceiver &receiver);
54  virtual const KaaRootConfiguration& getConfiguration();
55 
57 
59  {
60  return *this;
61  }
62 
64  {
65  return *this;
66  }
67 
69  {
70  return configurationHash_;
71  }
72 
73  virtual ~ConfigurationManager() noexcept {}
74 
75 private:
76  void updateConfiguration(const std::uint8_t* data, const std::uint32_t dataSize);
77  void loadConfiguration();
78  void notifySubscribers(const KaaRootConfiguration& configuration);
79 
80 private:
81  bool isConfigurationLoaded_;
82 
83  IKaaClientContext &context_;
84  KaaRootConfiguration configuration_;
85 
86  IConfigurationStoragePtr storage_;
87  EndpointObjectHash configurationHash_;
88 
89  KAA_MUTEX_DECLARE(configurationGuard_);
91 };
92 
93 } // namespace kaa
94 
95 #endif /* CONFIGURATION_MANAGER_HPP_ */
virtual IConfigurationProcessor & getConfigurationProcessor()
ConfigurationManager(IKaaClientContext &context)
virtual ~ConfigurationManager() noexcept
virtual void addReceiver(IConfigurationReceiver &receiver)
virtual void processConfigurationData(const std::vector< std::uint8_t > &data, bool fullResync)
virtual EndpointObjectHash getConfigurationHash()
virtual void removeReceiver(IConfigurationReceiver &receiver)
virtual void setConfigurationStorage(IConfigurationStoragePtr storage)
std::shared_ptr< IConfigurationStorage > IConfigurationStoragePtr
virtual IConfigurationHashContainer & getConfigurationHashContainer()
virtual const KaaRootConfiguration & getConfiguration()