Revert "License conversion from Flora to Apache 2.0"
[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) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali/internal/event/common/stage-impl.h>
22
23 namespace Dali
24 {
25
26 struct Vector2;
27
28 namespace Integration
29 {
30 class PlatformAbstraction;
31 }
32
33 namespace Internal
34 {
35
36 class Core;
37 class NotificationManager;
38 class ResourceClient;
39 class ResourceManager;
40 class ImageFactory;
41 class ModelFactory;
42 class FontFactory;
43 class ShaderFactory;
44 class EventToUpdate;
45 class GestureEventProcessor;
46 class EmojiFactory;
47
48 namespace SceneGraph
49 {
50 class UpdateManager;
51 }
52
53 /**
54  * Class to store a pointer to core in thread local storage.
55  *
56  */
57 class ThreadLocalStorage
58 {
59 public:
60
61   /**
62    * Constructor
63    * Creates the TLS and adds a pointer to core
64    * @param [in] core reference to core
65    */
66   ThreadLocalStorage(Core* core);
67
68   /**
69    * Destructor.
70    */
71   ~ThreadLocalStorage();
72
73   /**
74    * Remove core pointer.
75    * Prevents the core pointer being automatically deleted when the thread exits.
76    */
77   void Remove();
78
79   /**
80    * Get the TLS
81    * @return reference to the TLS
82    */
83   static ThreadLocalStorage& Get();
84
85   /**
86    * Checks if the TLS has been created
87    * @return if the TLS has been created
88    */
89   static bool Created();
90
91   /**
92    * get platform abstraction
93    * @return reference to core
94    */
95   Dali::Integration::PlatformAbstraction& GetPlatformAbstraction();
96
97   /**
98    * Retrieve the update manager
99    * @return reference to update manager
100    */
101   SceneGraph::UpdateManager& GetUpdateManager();
102
103   /**
104    * Returns the Notification Manager
105    * @return reference to the Notification Manager
106    */
107   NotificationManager& GetNotificationManager();
108
109   /**
110    * Returns the Resource Manager
111    * @return reference to the Resource Manager
112    */
113   ResourceManager& GetResourceManager();
114
115   /**
116    * Returns the Resource Client
117    * @return reference to the Resource Client
118    */
119   ResourceClient& GetResourceClient();
120
121   /**
122    * Returns the Image Factory
123    * @return reference to the Image Factory
124    */
125   ImageFactory& GetImageFactory();
126
127   /**
128    * Returns the Model Factory
129    * @return reference to the Image Factory
130    */
131   ModelFactory& GetModelFactory();
132
133   /**
134    * Returns the Font Factory
135    * @return reference to the Font Factory
136    */
137   FontFactory& GetFontFactory();
138
139   /**
140    * Returns the Shader Factory
141    * @return reference to the Shader Factory
142    */
143   ShaderFactory& GetShaderFactory();
144
145   /**
146    * Returns the current stage.
147    * @return A smart-pointer to the current stage.
148    */
149   StagePtr GetCurrentStage();
150
151   /**
152    * Return the message controller
153    * @return A reference to the message controller
154    */
155   EventToUpdate& GetEventToUpdate();
156
157   /**
158    * Returns the gesture event processor.
159    * @return A reference to the gesture event processor.
160    */
161   GestureEventProcessor& GetGestureEventProcessor();
162
163   /**
164    * Returns the Emoji factory.
165    * @return a reference to the Emoji factory.
166    */
167   EmojiFactory& GetEmojiFactory();
168
169 private:
170
171   Core* mCore;                            ///< reference to core
172
173 };
174
175 } // namespace Internal
176
177 } // namespace Dali
178
179 #endif // __DALI_INTERNAL_THREAD_LOCAL_STORAGE_H__