Merge "Fix memory leaks in Locales" into tizen_2.1
[platform/framework/native/appfw.git] / src / io / inc / FIo_FileEventManagerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file        FIo_FileEventManagerImpl.h
20  * @brief       This is the header file for the %_FileEventManagerImpl class.
21  *
22  * This header file contains the declarations of the %_FileEventManagerImpl class.
23  */
24
25 #ifndef _FIO_INTERNAL_FILE_EVENT_MANAGER_IMPL_H_
26 #define _FIO_INTERNAL_FILE_EVENT_MANAGER_IMPL_H_
27
28 #include <glib.h>
29
30 #include <FBaseObject.h>
31 #include <FBaseColHashMap.h>
32 #include <FOspConfig.h>
33 #include <FBaseRtEvent.h>
34
35 namespace Tizen { namespace Base
36 {
37 class String;
38 }}
39
40 namespace Tizen { namespace Io
41 {
42
43 class FileEventManager;
44 class IFileEventListener;
45
46 class _OSP_EXPORT_ _FileEventManagerImpl
47         : public Tizen::Base::Object
48 {
49
50 public:
51         _FileEventManagerImpl(void);
52
53         virtual ~_FileEventManagerImpl(void);
54
55         result Construct(IFileEventListener& listener);
56
57         result AddPath(const Tizen::Base::String& path, unsigned long eventsToMonitor);
58
59         result RemovePath(const Tizen::Base::String& path);
60
61         result SendEvent(void);
62
63         static _FileEventManagerImpl* GetInstance(FileEventManager& fileEventManager);
64
65         static const _FileEventManagerImpl* GetInstance(const FileEventManager& fileEventManager);
66
67 private:
68         _FileEventManagerImpl(const _FileEventManagerImpl& source);
69
70         _FileEventManagerImpl& operator =(const _FileEventManagerImpl& source);
71
72         Tizen::Base::String GetRegisteredPath(int fd);
73
74         static gboolean OnFileEventOccured(GIOChannel* source, GIOCondition condition, gpointer data);
75
76         Tizen::Base::Collection::HashMap* __pMonitorFileList;
77         Tizen::Base::Runtime::Event* __pEvent;
78         int __inotifyFd;
79         GSource* __pGSource;
80         GIOChannel* __pGIOChannel;
81
82         friend class FileEventManager;
83
84 }; // _FileEventManagerImpl
85
86 }} // Tizen::Io
87
88 #endif //_FIO_INTERNAL_FILE_EVENT_MANAGER_IMPL_H_
89