client-cpp  0.0.1-SNAPSHOT
ConfigurationPersistenceManager.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 CONFIGURATIONPERSISTENCEMANAGER_HPP_
18 #define CONFIGURATIONPERSISTENCEMANAGER_HPP_
19 
21 
22 #include <boost/thread/mutex.hpp>
24 
25 namespace kaa {
26 
38 public:
40  : storage_(NULL)
41  , processor_(NULL)
42  , ignoreConfigurationUpdate_(false)
43  {}
45 
50 
54  void onConfigurationUpdated(const ICommonRecord &configuration);
55 
59  void onSchemaUpdated(boost::shared_ptr<avro::ValidSchema> schema);
60 
65 
73 private:
74  typedef boost::mutex mutex_type;
75  typedef boost::unique_lock<mutex_type> lock_type;
76 
77  void readStoredConfiugration();
78 
79  mutex_type schemaGuard_;
80  mutex_type confPersistenceGuard_;
81 
82  IConfigurationStorage * storage_;
83  IConfigurationProcessor * processor_;
84 
85  boost::shared_ptr<avro::ValidSchema> schema_;
86  EndpointObjectHash configurationHash_;
87  bool ignoreConfigurationUpdate_;
88 };
89 
90 } // namespace kaa
91 
92 
93 #endif /* CONFIGURATIONPERSISTENCEMANAGER_HPP_ */
void onSchemaUpdated(boost::shared_ptr< avro::ValidSchema > schema)
void setConfigurationStorage(IConfigurationStorage *storage)
void onConfigurationUpdated(const ICommonRecord &configuration)
EndpointObjectHash getConfigurationHash()
void setConfigurationProcessor(IConfigurationProcessor *processor)