1 #ifndef __DALI_INTERNAL_THREAD_LOCAL_STORAGE_H__
2 #define __DALI_INTERNAL_THREAD_LOCAL_STORAGE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/internal/event/common/stage-def.h>
23 #ifdef DYNAMICS_SUPPORT
24 #include <dali/internal/event/dynamics/dynamics-world-impl.h>
34 class PlatformAbstraction;
41 class NotificationManager;
43 class ResourceManager;
46 class GestureEventProcessor;
47 class RelayoutController;
55 * Class to store a pointer to core in thread local storage.
58 class ThreadLocalStorage
64 * Creates the TLS and adds a pointer to core
65 * @param [in] core reference to core
67 ThreadLocalStorage(Core* core);
72 ~ThreadLocalStorage();
75 * Remove core pointer.
76 * Prevents the core pointer being automatically deleted when the thread exits.
82 * @return reference to the TLS
84 static ThreadLocalStorage& Get();
87 * Checks if the TLS has been created
88 * @return if the TLS has been created
90 static bool Created();
93 * Get a pointer to the TLS or NULL if not initialized
94 * @return pointer to the TLS
96 static ThreadLocalStorage* GetInternal();
99 * get platform abstraction
100 * @return reference to core
102 Dali::Integration::PlatformAbstraction& GetPlatformAbstraction();
104 #ifdef DYNAMICS_SUPPORT
106 * Get DynamicsWorld instance
107 * @return A pointer to the current DynamicsWorld.
109 Dali::Internal::DynamicsWorldPtr GetDynamicsWorldInstance();
113 * Retrieve the update manager
114 * @return reference to update manager
116 SceneGraph::UpdateManager& GetUpdateManager();
119 * Returns the Notification Manager
120 * @return reference to the Notification Manager
122 NotificationManager& GetNotificationManager();
125 * Returns the Resource Manager
126 * @return reference to the Resource Manager
128 ResourceManager& GetResourceManager();
131 * Returns the Resource Client
132 * @return reference to the Resource Client
134 ResourceClient& GetResourceClient();
137 * Returns the Image Factory
138 * @return reference to the Image Factory
140 ImageFactory& GetImageFactory();
143 * Returns the Shader Factory
144 * @return reference to the Shader Factory
146 ShaderFactory& GetShaderFactory();
149 * Returns the current stage.
150 * @return A pointer to the current stage.
152 StagePtr GetCurrentStage();
155 * Returns the gesture event processor.
156 * @return A reference to the gesture event processor.
158 GestureEventProcessor& GetGestureEventProcessor();
161 * Return the relayout controller
162 * @Return Return a reference to the relayout controller
164 RelayoutController& GetRelayoutController();
168 Core* mCore; ///< reference to core
169 #ifdef DYNAMICS_SUPPORT
170 Dali::Internal::DynamicsWorldPtr mDynamicsWorldInstance; ///< Instance of DynamicsWorld (This does not need to be in core)
175 } // namespace Internal
179 #endif // __DALI_INTERNAL_THREAD_LOCAL_STORAGE_H__