2d936759e8588c243b0159c52770f554de9fc6c1
[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
30 namespace Tizen { namespace App
31 {
32
33 class _DataControlRequestInfo
34         : public Tizen::Base::Object
35 {
36 public:
37         _DataControlRequestInfo(Tizen::Base::Runtime::Event* pEvent)
38         {
39                 __pEvent = pEvent;
40         }
41
42         virtual ~_DataControlRequestInfo(void)
43         {
44         }
45
46         Tizen::Base::Runtime::Event* GetEvent(void)
47         {
48                 return __pEvent;
49         }
50 private:
51         _DataControlRequestInfo(void)
52                 : __pEvent(null)
53         {
54         }
55 private:
56         Tizen::Base::Runtime::Event* __pEvent;
57 };
58
59 class _DataControlManager
60         : public Tizen::Base::Object
61 {
62 public:
63         static _DataControlManager* GetInstance(void);
64
65         result AddRequestInfo(Tizen::Base::Integer* pReqId, _DataControlRequestInfo* pReqInfo);
66
67         _DataControlRequestInfo* GetRequestInfo(Tizen::Base::Integer& reqId);
68
69         int GetRequestCount(void) const;
70
71         void RemoveRequestInfo(Tizen::Base::Integer& reqId);
72
73         void RemoveAllRequests(void);
74
75         int GetUniqueId(void);
76
77         result AllowAccess(Tizen::Base::String& appId);
78
79 private:
80         _DataControlManager(void);
81
82         virtual ~_DataControlManager(void);
83
84         void Cache(Tizen::Base::String& appId);
85
86         bool IsCached(Tizen::Base::String& appId);
87
88         static void InitSingleton(void);
89
90         static void DestroySingleton(void);
91
92 private:
93         static _DataControlManager* __pDataControlManagerInstance;
94         Tizen::Base::Collection::HashMap* __pDataControlRequestList;
95         Tizen::Base::Collection::LinkedList* __pProviderList;
96         int __uniqueId;
97
98 }; // _DataControlManager
99
100 }} // Tizen::App
101
102 #endif // _FAPP_INTERNAL_DATA_CONTROL_MANAGER_H_
103