Modify the spec file for secure log
[framework/osp/social.git] / src / FScl_AccountDbMonitor.h
1 //
2 // Copyright (c) 2012 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 * @file         FScl_AccountDbMonitor.h
18 * @brief        This is the header file for the _AccountDbMonitor class.
19 *
20 * This header file contains the declarations of the _AccountDbMonitor class.
21 */
22
23 #ifndef _FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_
24 #define _FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_
25
26 #include <new>
27 #include <pthread.h>
28 #include <unique_ptr.h>
29 #include <account.h>
30 #include <FBaseTypes.h>
31 #include <FBaseResult.h>
32 #include <FBaseObject.h>
33
34 namespace Tizen { namespace Base {
35
36 namespace Collection
37 {
38 template<typename Type>
39 class ArrayListT;
40 }
41
42 namespace Runtime
43 {
44 class Mutex;
45 }
46
47 }}
48
49 namespace Tizen { namespace Social
50 {
51 class _IAccountDbChangeEventListener;
52 class _AccountDbChangeEvent;
53
54 /**
55  * @class       _AccountDbMonitor
56  * @brief       This class handles the _AccountDbMonitor operations.
57  * @since       2.1
58  */
59 class _AccountDbMonitor
60         : public Tizen::Base::Object
61 {
62 public:
63         result AddListener(const _IAccountDbChangeEventListener& listener);
64
65         result RemoveListener(const _IAccountDbChangeEventListener& listener);
66
67         static _AccountDbMonitor* GetInstance(void);
68
69 private:
70         _AccountDbMonitor(void);
71
72         virtual ~_AccountDbMonitor(void);
73
74         result Construct(void);
75
76         _AccountDbMonitor(const _AccountDbMonitor& rhs);
77
78         static bool OnAccountChangeEventReceived(const char* pEventType, int accountId, void* pUserData);
79
80         _AccountDbMonitor& operator =(const _AccountDbMonitor& rhs);
81
82         static void InitSingleton(void);
83
84         static void DestroySingleton(void);
85
86 private:
87         class __Callback
88         {
89         public:
90                 __Callback(account_subscribe_h accountSubscribeHandle, account_event_cb callback, void* pUserData);
91                 result Register(void);
92                 ~__Callback(void);
93
94         private:
95                 account_subscribe_h __accountSubscribeHandle;
96                 account_event_cb __callback;
97                 void* __pUserData;
98         };
99
100 private:
101         std::unique_ptr<_AccountDbChangeEvent> __pEvent;
102         std::unique_ptr<Tizen::Base::Runtime::Mutex> __pMutex;
103         std::unique_ptr<__Callback> __pAccountChangeCallback;
104
105         static _AccountDbMonitor* __pTheInstance;
106         friend struct std::default_delete< _AccountDbMonitor >;
107 };      // _AccountDbMonitor
108
109 }}  // Tizen::Social
110
111 #endif //_FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_