Fix the boiler plate codes
[platform/framework/native/appfw.git] / src / base / runtime / FBaseRt_EventPendingOperationManager.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 /**
18  * @file        FBaseRt_EventPendingOperationManager.h
19  * @brief       This is the header file of __EventPendingOperationManager class.
20  */
21
22 #ifndef _FRT_INTERNAL_EVENT_PENDING_OPERATION_MANAGER_H_
23 #define _FRT_INTERNAL_EVENT_PENDING_OPERATION_MANAGER_H_
24
25
26 #include <FBaseObject.h>
27 #include <FBaseColLinkedList.h>
28
29
30 namespace Tizen { namespace Base { namespace Runtime
31 {
32
33
34 // forward declaration
35 class Event;
36 class IEventFilter;
37 class IEventListener;
38
39 enum EventPendingOperationType
40 {
41         EVENT_OPERATION_REMOVE_FILTER,
42         EVENT_OPERATION_ADD_FILTER,
43         EVENT_OPERATION_REMOVE_LISTENER,
44         EVENT_OPERATION_ADD_LISTENER,
45
46 };
47
48
49 //
50 // @class _EventPendingOperationManager
51 // This class manages the pending operation of the Event class.
52 // Pending operations are the collection related operations because the collection does not permit
53 // the add/remove operation when it is traversing.
54 //
55 // Event class makes an add/remove filter/listener a pending operations while they are executed in the filter or the listener.
56 //
57 class _EventPendingOperationManager
58         : public Tizen::Base::Object
59 {
60 public:
61         /**
62          * Is a default constructor.
63          */
64         _EventPendingOperationManager(void);
65
66         /**
67          * This methods completes the pending operation to add filters.
68          *
69          * @param[in]   pFilter The pointer of filters to add.
70          * @return              The error code.
71          * @exception   E_SUCCESS
72          */
73         result AddFilter(const IEventFilter& filter);
74
75
76         /**
77          * This methods completes the pending operation to remove filters.
78          *
79          * @param[in]   pFilter The pointer of filters to remove.
80          * @return              The error code.
81          * @exception   E_SUCCESS
82          */
83         result RemoveFilter(const IEventFilter& filter);
84
85
86         /**
87          * This methods completes the pending operation to add listeners.
88          *
89          * @param[in]   pListener The pointer of listeners to add.
90          * @return              The error code.
91          * @exception   E_SUCCESS
92          */
93         result AddListener(const IEventListener& listener);
94
95
96         /**
97          * This methods completes the pending operation to remove listeners.
98          *
99          * @param[in]   pListener The pointer of listeners to remove.
100          * @return              The error code.
101          * @exception   E_SUCCESS
102          */
103         result RemoveListener(const IEventListener& listener);
104
105
106 private:
107         class _EventPendingOperation
108                 : public Tizen::Base::Object
109         {
110 public:
111                 _EventPendingOperation(void)
112                         : opType(EVENT_OPERATION_ADD_LISTENER)
113                         , pFilter(null)
114                         , pListener(null)
115                 {
116
117                 }
118
119                 virtual ~_EventPendingOperation(void)
120                 {
121
122                 }
123
124                 EventPendingOperationType opType;
125                 const IEventFilter* pFilter;
126                 const IEventListener* pListener;
127         };
128
129         Tizen::Base::Collection::LinkedList __operations;
130
131 };
132
133 } } } // Tizen::Runtime
134
135 #endif // _FRT_INTERNAL_EVENT_PENDING_OPERATION_MANAGER_H_