[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / internal / event / common / thread-local-storage.h
1 #ifndef DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
2 #define DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/common/stage-def.h>
23 #include <dali/internal/event/common/scene-impl.h>
24
25 namespace Dali
26 {
27
28 struct Vector2;
29
30 namespace Integration
31 {
32 class PlatformAbstraction;
33 }
34
35 namespace Internal
36 {
37
38 class Core;
39 class NotificationManager;
40 class ShaderFactory;
41 class GestureEventProcessor;
42 class RelayoutController;
43 class ObjectRegistry;
44 class EventThreadServices;
45
46 namespace SceneGraph
47 {
48 class UpdateManager;
49 }
50
51 /**
52  * Class to store a pointer to core in thread local storage.
53  *
54  */
55 class ThreadLocalStorage
56 {
57 public:
58
59   /**
60    * Constructor
61    * Creates the TLS and adds a pointer to core
62    * @param [in] core reference to core
63    */
64   ThreadLocalStorage(Core* core);
65
66   /**
67    * Destructor.
68    */
69   ~ThreadLocalStorage();
70
71   /**
72    * Remove core pointer.
73    * Prevents the core pointer being automatically deleted when the thread exits.
74    */
75   void Remove();
76
77   /**
78    * Get the TLS
79    * @return reference to the TLS
80    */
81   static ThreadLocalStorage& Get();
82
83   /**
84    * Checks if the TLS has been created
85    * @return if the TLS has been created
86    */
87   static bool Created();
88
89   /**
90    * Get a pointer to the TLS or NULL if not initialized
91    * @return pointer to the TLS
92    */
93   static ThreadLocalStorage* GetInternal();
94
95   /**
96    * get platform abstraction
97    * @return reference to core
98    */
99   Dali::Integration::PlatformAbstraction& GetPlatformAbstraction();
100
101   /**
102    * Retrieve the update manager
103    * @return reference to update manager
104    */
105   SceneGraph::UpdateManager& GetUpdateManager();
106
107   /**
108    * Returns the Notification Manager
109    * @return reference to the Notification Manager
110    */
111   NotificationManager& GetNotificationManager();
112
113   /**
114    * Returns the Shader Factory
115    * @return reference to the Shader Factory
116    */
117   ShaderFactory& GetShaderFactory();
118
119   /**
120    * Returns the current stage.
121    * @return A pointer to the current stage.
122    */
123   StagePtr GetCurrentStage();
124
125   /**
126    * Returns the gesture event processor.
127    * @return A reference to the gesture event processor.
128    */
129   GestureEventProcessor& GetGestureEventProcessor();
130
131   /**
132    * Return the relayout controller
133    * @Return Return a reference to the relayout controller
134    */
135   RelayoutController& GetRelayoutController();
136
137   /**
138    * Returns the Object registry.
139    * @return A reference to the Object registry
140    */
141   ObjectRegistry& GetObjectRegistry();
142
143   /**
144    * @brief Gets the event thread services.
145    * @return A reference to the event thread services
146    */
147   EventThreadServices& GetEventThreadServices();
148
149   /**
150    * @brief Gets the property notification manager.
151    * @return A reference to the property notification manager
152    */
153   PropertyNotificationManager& GetPropertyNotificationManager();
154
155   /**
156    * @brief Gets the animation play list.
157    * @return A reference to the animation play list
158    */
159   AnimationPlaylist& GetAnimationPlaylist();
160
161   /**
162    * Add a Scene to the Core.
163    * This is only used by the Scene to add itself to the core when the Scene is created.
164    * @param[in] scene The Scene.
165    */
166   void AddScene( Scene* scene );
167
168   /**
169    * Remove a Scene from the Core.
170    * This is only used by the Scene to remove itself from the core when the Scene is destroyed.
171    * @param[in] scene The Scene.
172    */
173   void RemoveScene( Scene* scene );
174
175 private:
176
177   Core* mCore;                                              ///< reference to core
178
179 };
180
181 } // namespace Internal
182
183 } // namespace Dali
184
185 #endif // DALI_INTERNAL_THREAD_LOCAL_STORAGE_H