2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FScl_AccountDbMonitor.h
18 * @brief This is the header file for the _AccountDbMonitor class.
20 * This header file contains the declarations of the _AccountDbMonitor class.
23 #ifndef _FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_
24 #define _FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_
28 #include <unique_ptr.h>
30 #include <FBaseTypes.h>
31 #include <FBaseResult.h>
32 #include <FBaseObject.h>
34 namespace Tizen { namespace Base {
38 template<typename Type>
49 namespace Tizen { namespace Social
51 class _IAccountDbChangeEventListener;
52 class _AccountDbChangeEvent;
55 * @class _AccountDbMonitor
56 * @brief This class handles the _AccountDbMonitor operations.
59 class _AccountDbMonitor
60 : public Tizen::Base::Object
63 result AddListener(const _IAccountDbChangeEventListener& listener);
65 result RemoveListener(const _IAccountDbChangeEventListener& listener);
67 static _AccountDbMonitor* GetInstance(void);
70 _AccountDbMonitor(void);
72 virtual ~_AccountDbMonitor(void);
74 result Construct(void);
76 _AccountDbMonitor(const _AccountDbMonitor& rhs);
78 static bool OnAccountChangeEventReceived(const char* pEventType, int accountId, void* pUserData);
80 _AccountDbMonitor& operator =(const _AccountDbMonitor& rhs);
82 static void InitSingleton(void);
84 static void DestroySingleton(void);
90 __Callback(account_subscribe_h accountSubscribeHandle, account_event_cb callback, void* pUserData);
91 result Register(void);
95 account_subscribe_h __accountSubscribeHandle;
96 account_event_cb __callback;
101 std::unique_ptr<_AccountDbChangeEvent> __pEvent;
102 std::unique_ptr<Tizen::Base::Runtime::Mutex> __pMutex;
103 std::unique_ptr<__Callback> __pAccountChangeCallback;
105 static _AccountDbMonitor* __pTheInstance;
106 friend struct std::default_delete< _AccountDbMonitor >;
107 }; // _AccountDbMonitor
111 #endif //_FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_