2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FScl_AccountDbMonitor.h
19 * @brief This is the header file for the _AccountDbMonitor class.
21 * This header file contains the declarations of the _AccountDbMonitor class.
24 #ifndef _FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_
25 #define _FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_
29 #include <unique_ptr.h>
31 #include <FBaseTypes.h>
32 #include <FBaseResult.h>
33 #include <FBaseObject.h>
35 namespace Tizen { namespace Base {
39 template<typename Type>
50 namespace Tizen { namespace Social
52 class _IAccountDbChangeEventListener;
53 class _AccountDbChangeEvent;
56 * @class _AccountDbMonitor
57 * @brief This class handles the _AccountDbMonitor operations.
60 class _AccountDbMonitor
61 : public Tizen::Base::Object
64 result AddListener(const _IAccountDbChangeEventListener& listener);
66 result RemoveListener(const _IAccountDbChangeEventListener& listener);
68 static _AccountDbMonitor* GetInstance(void);
71 _AccountDbMonitor(void);
73 virtual ~_AccountDbMonitor(void);
75 result Construct(void);
77 _AccountDbMonitor(const _AccountDbMonitor& rhs);
79 static bool OnAccountChangeEventReceived(const char* pEventType, int accountId, void* pUserData);
81 _AccountDbMonitor& operator =(const _AccountDbMonitor& rhs);
83 static void InitSingleton(void);
85 static void DestroySingleton(void);
91 __Callback(account_subscribe_h accountSubscribeHandle, account_event_cb callback, void* pUserData);
92 result Register(void);
96 account_subscribe_h __accountSubscribeHandle;
97 account_event_cb __callback;
102 std::unique_ptr<_AccountDbChangeEvent> __pEvent;
103 std::unique_ptr<Tizen::Base::Runtime::Mutex> __pMutex;
104 std::unique_ptr<__Callback> __pAccountChangeCallback;
106 static _AccountDbMonitor* __pTheInstance;
107 friend struct std::default_delete< _AccountDbMonitor >;
108 }; // _AccountDbMonitor
112 #endif //_FSCL_INTERNAL_ACCOUNT_DB_MONITOR_H_