Removed model loading and lighting
[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 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-impl.h>
23
24 namespace Dali
25 {
26
27 struct Vector2;
28
29 namespace Integration
30 {
31 class PlatformAbstraction;
32 }
33
34 namespace Internal
35 {
36
37 class Core;
38 class NotificationManager;
39 class ResourceClient;
40 class ResourceManager;
41 class ImageFactory;
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 a pointer to the TLS or NULL if not initialized
93    * @return pointer to the TLS
94    */
95   static ThreadLocalStorage* GetInternal();
96
97   /**
98    * get platform abstraction
99    * @return reference to core
100    */
101   Dali::Integration::PlatformAbstraction& GetPlatformAbstraction();
102
103   /**
104    * Retrieve the update manager
105    * @return reference to update manager
106    */
107   SceneGraph::UpdateManager& GetUpdateManager();
108
109   /**
110    * Returns the Notification Manager
111    * @return reference to the Notification Manager
112    */
113   NotificationManager& GetNotificationManager();
114
115   /**
116    * Returns the Resource Manager
117    * @return reference to the Resource Manager
118    */
119   ResourceManager& GetResourceManager();
120
121   /**
122    * Returns the Resource Client
123    * @return reference to the Resource Client
124    */
125   ResourceClient& GetResourceClient();
126
127   /**
128    * Returns the Image Factory
129    * @return reference to the Image Factory
130    */
131   ImageFactory& GetImageFactory();
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__