client-cpp  0.7.4
ConfigurationManager.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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"
27 
28 namespace kaa {
29 
30 class IExecutorContext;
31 class IConfigurationReceiver;
32 
44 public:
46 
47  virtual void init();
48 
49  virtual void processConfigurationData(const std::vector<std::uint8_t>& data, bool fullResync);
50 
51  virtual void addReceiver(IConfigurationReceiver &receiver);
52  virtual void removeReceiver(IConfigurationReceiver &receiver);
53  virtual const KaaRootConfiguration& getConfiguration();
54 
56 
58  {
59  return *this;
60  }
61 
63  {
64  return *this;
65  }
66 
68  {
69  return configurationHash_;
70  }
71 
72 private:
73  void updateConfiguration(const std::uint8_t* data, const std::uint32_t dataSize);
74  void loadConfiguration();
75  void notifySubscribers(const KaaRootConfiguration& configuration);
76 
77 private:
78  bool isConfigurationLoaded_;
79 
80  IExecutorContext& executorContext_;
82  KaaRootConfiguration configuration_;
83 
84  IConfigurationStoragePtr storage_;
85  EndpointObjectHash configurationHash_;
86 
87  KAA_MUTEX_DECLARE(configurationGuard_);
89 };
90 
91 } // namespace kaa
92 
93 #endif /* CONFIGURATION_MANAGER_HPP_ */
virtual IConfigurationProcessor & getConfigurationProcessor()
ConfigurationManager(IExecutorContext &executorContext, IKaaClientStateStoragePtr state)
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< IKaaClientStateStorage > IKaaClientStateStoragePtr
std::shared_ptr< IConfigurationStorage > IConfigurationStoragePtr
virtual IConfigurationHashContainer & getConfigurationHashContainer()
virtual const KaaRootConfiguration & getConfiguration()