client-cpp  0.0.1-SNAPSHOT
SchemaPersistenceManager.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 SCHEMAPERSISTENCEMANAGER_HPP_
18 #define SCHEMAPERSISTENCEMANAGER_HPP_
19 
22 #include <boost/thread/mutex.hpp>
23 
24 namespace kaa {
25 
26 
37 public:
39  : storage_(NULL)
40  , processor_(NULL)
41  , ignoreSchemaUpdate_(false)
42  {}
43 
47  void setSchemaStorage(ISchemaStorage *storage);
48 
52  void onSchemaUpdated(boost::shared_ptr<avro::ValidSchema> schema);
53 
60  void setSchemaProcessor(ISchemaProcessor *processor);
61 private:
62  typedef boost::mutex mutex_type;
63  typedef boost::unique_lock<mutex_type> lock_type;
64 
65  void readStoredSchema();
66 
67  mutex_type schemaGuard_;
68  mutex_type schemaPersistenceGuard_;
69 
70  ISchemaStorage * storage_;
71  ISchemaProcessor * processor_;
72  bool ignoreSchemaUpdate_;
73 };
74 
75 } // namespace kaa
76 
77 
78 #endif /* SCHEMAPErsistenCEMANAGER_HPP_ */
void onSchemaUpdated(boost::shared_ptr< avro::ValidSchema > schema)
void setSchemaProcessor(ISchemaProcessor *processor)
void setSchemaStorage(ISchemaStorage *storage)