client-cpp  0.6.1
ICommonRecord.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 I_COMMON_RECORD_HPP_
18 #define I_COMMON_RECORD_HPP_
19 
20 #include "kaa/KaaDefaults.hpp"
21 
22 #ifdef KAA_USE_CONFIGURATION
23 
26 
27 #include <boost/uuid/uuid.hpp>
28 #include <map>
29 
30 namespace kaa {
31 
32 typedef boost::uuids::uuid uuid_t;
33 
37 template<class Container>
38 class ICommonRecordBase: public ISchemaDependent, public ICommonValue {
39 public:
40  typedef Container container_type;
41  typedef typename Container::mapped_type fields_type;
42  typedef typename Container::key_type keys_type;
43 
44  ICommonRecordBase() : ICommonValue(CommonValueType::COMMON_RECORD) {}
45  virtual ~ICommonRecordBase() {}
46 
50  virtual void setUuid(uuid_t uuid) = 0;
51 
55  virtual uuid_t getUuid() = 0;
56 
63  virtual bool hasField (const keys_type &field_name) const = 0;
64 
71  virtual fields_type getField (const keys_type &field_name) const = 0;
72 
78  virtual void setField (const keys_type &field_name, fields_type value) = 0;
79 
85  virtual void removeField (const keys_type &field_name) = 0;
86 
90  virtual const container_type & getFields () const = 0;
91 };
92 
93 typedef ICommonRecordBase<std::map<std::string, std::shared_ptr<ICommonValue> > > ICommonRecord;
94 
95 } // namespace kaa
96 
97 #endif
98 
99 #endif /* I_COMMON_RECORD_HPP_ */