Update wrt-commons_0.2.53
[framework/web/wrt-commons.git] / modules / widget_dao / include / dpl / wrt-dao-ro / feature_model.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file    feature_model.h
18  * @author  Pawel Sikorski (p.sikorski@samgsung.com)
19  * @version
20  * @brief   This file contains FeatureModel, FeatureHandle definitions.
21  */
22 #ifndef FEATURE_MODEL_H
23 #define FEATURE_MODEL_H
24
25 #include <dpl/event/model.h>
26 #include <dpl/event/property.h>
27 #include <dpl/shared_ptr.h>
28 #include <string>
29 #include <list>
30 #include <set>
31 #include <dpl/wrt-dao-ro/common_dao_types.h>
32
33 namespace WrtDB {
34
35 typedef int FeatureHandle;
36 typedef std::list<FeatureHandle> FeatureHandleList;
37 typedef DPL::SharedPtr<FeatureHandleList> FeatureHandleListPtr;
38
39 typedef int FeatureSetHandle;
40 typedef std::list<FeatureSetHandle> FeatureSetHandleList;
41
42 class FeatureModel : public DPL::Event::Model
43 {
44   public:
45     DPL::Event::Property<FeatureHandle, DPL::Event::PropertyReadOnly> FHandle;
46     DPL::Event::Property<std::string> Name;
47
48     DPL::Event::Property<std::set<std::string> > DeviceCapabilities;
49     DPL::Event::Property<DbPluginHandle> PHandle;
50
51     FeatureModel(FeatureHandle handle) :
52         FHandle(this, handle),
53         Name(this),
54         DeviceCapabilities(this),
55         PHandle(this, -1)
56     {
57     }
58
59     void SetData(const std::string& name, const std::set<std::string>& deviceCapabilities, const DbPluginHandle& pluginHandle)
60     {
61         Name.SetWithoutLock(name);
62         DeviceCapabilities.SetWithoutLock(deviceCapabilities);
63         PHandle.SetWithoutLock(pluginHandle);
64     }
65 };
66
67 typedef DPL::SharedPtr<FeatureModel> FeatureModelPtr;
68
69 } // namespace WrtDB
70
71 #endif // FEATURE_MODEL_H