client-cpp  0.0.1-SNAPSHOT
ConfigurationProcessor.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_PROCESSOR_HPP_
18 #define CONFIGURATION_PROCESSOR_HPP_
19 
20 #include <boost/cstdint.hpp>
21 #include <boost/signals2.hpp>
22 #include <boost/smart_ptr/shared_ptr.hpp>
23 #include <boost/thread/recursive_mutex.hpp>
24 
26 
27 namespace kaa {
28 
41 public:
42  typedef avro::ValidSchema Schema;
43 
45  ConfigurationProcessor(boost::shared_ptr<avro::ValidSchema> schema) { schema_ = schema; }
46  ~ConfigurationProcessor() { schema_.reset(); }
47 
51  void processConfigurationData(const boost::uint8_t *data, size_t data_length, bool full_resync);
52 
58 
64 
68  void onSchemaUpdated(boost::shared_ptr<avro::ValidSchema> schema);
69 
70 private:
71  typedef boost::recursive_mutex mutex_type;
72  typedef boost::unique_lock<mutex_type> lock_type;
73 
74  mutex_type confProcessorMutex_;
75 
76  boost::signals2::signal<void (int, const avro::GenericDatum &, bool)> deltaReceivers_;
77  boost::signals2::signal<void ()> onProcessedObservers_;
78 
79  boost::shared_ptr<Schema> schema_;
80 };
81 
82 } // namespace kaa
83 
84 #endif /* CONFIGURATION_PROCESSOR_HPP_ */
void addOnProcessedObserver(IConfigurationProcessedObserver &observer)
void unsubscribeFromUpdates(IGenericDeltaReceiver &receiver)
void removeOnProcessedObserver(IConfigurationProcessedObserver &observer)
void onSchemaUpdated(boost::shared_ptr< avro::ValidSchema > schema)
ConfigurationProcessor(boost::shared_ptr< avro::ValidSchema > schema)
void subscribeForUpdates(IGenericDeltaReceiver &receiver)
void processConfigurationData(const boost::uint8_t *data, size_t data_length, bool full_resync)