export _AppControlImpl::FindAndStart()
[platform/framework/native/appfw.git] / src / app / FApp_DataControlManager.h
1 //
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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 /**
18  * @file        FApp_DataControlManager.h
19  * @brief       This is the header file for the _DataControlManager class.
20  */
21
22 #ifndef _FAPP_INTERNAL_DATA_CONTROL_MANAGER_H_
23 #define _FAPP_INTERNAL_DATA_CONTROL_MANAGER_H_
24
25 #include <FBaseObject.h>
26 #include <FBaseColHashMap.h>
27 #include <FBaseColLinkedList.h>
28 #include <FBaseRtEvent.h>
29 #include <FAppTypes.h>
30
31 namespace Tizen { namespace App
32 {
33
34 class _SqlDataControlImpl;
35 class _MapDataControlImpl;
36
37 class _DataControlRequestInfo
38         : public Tizen::Base::Object
39 {
40 public:
41         _DataControlRequestInfo(Tizen::Base::Runtime::Event* pEvent)
42                 : __pEvent(null)
43                 , __pSqlDcImpl(null)
44                 , __pMapDcImpl(null)
45         {
46                 __pEvent = pEvent;
47         }
48
49         virtual ~_DataControlRequestInfo(void)
50         {
51         }
52
53         Tizen::Base::Runtime::Event* GetEvent(void)
54         {
55                 return __pEvent;
56         }
57
58         void SetSqlDataControlImpl(_SqlDataControlImpl* pSqlDcImpl)
59         {
60                 __pSqlDcImpl = pSqlDcImpl;
61         }
62
63         void SetMapDataControlImpl(_MapDataControlImpl* pMapDcImpl)
64         {
65                 __pMapDcImpl = pMapDcImpl;
66         }
67
68         _SqlDataControlImpl* GetSqlDataControlImpl(void)
69         {
70                 return __pSqlDcImpl;
71         }
72
73         _MapDataControlImpl* GetMapDataControlImpl(void)
74         {
75                 return __pMapDcImpl;
76         }
77
78 private:
79         _DataControlRequestInfo(void);
80
81 private:
82         Tizen::Base::Runtime::Event* __pEvent;
83         _SqlDataControlImpl* __pSqlDcImpl;
84         _MapDataControlImpl* __pMapDcImpl;
85 };
86
87 class _DataControlManager
88         : public Tizen::Base::Object
89 {
90 public:
91         static _DataControlManager* GetInstance(void);
92
93         result AddRequestInfo(Tizen::Base::Integer* pReqId, _DataControlRequestInfo* pReqInfo);
94
95         _DataControlRequestInfo* GetRequestInfo(Tizen::Base::Integer& reqId);
96
97         int GetRequestCount(void) const;
98
99         void RemoveRequestInfo(Tizen::Base::Integer& reqId);
100
101         void RemoveAllRequests(void);
102
103         int GetUniqueId(void);
104
105         result AllowAccess(const AppId& appId);
106
107 private:
108         _DataControlManager(void);
109
110         virtual ~_DataControlManager(void);
111
112         void Cache(const AppId& appId);
113
114         bool IsCached(const AppId& appId);
115
116         static void InitSingleton(void);
117
118         static void DestroySingleton(void);
119
120 private:
121         static _DataControlManager* __pDataControlManagerInstance;
122         Tizen::Base::Collection::HashMap* __pDataControlRequestList;
123         Tizen::Base::Collection::LinkedList* __pProviderList;
124         int __uniqueId;
125
126 }; // _DataControlManager
127
128 }} // Tizen::App
129
130 #endif // _FAPP_INTERNAL_DATA_CONTROL_MANAGER_H_
131