1 #ifndef DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
2 #define DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
5 * Copyright (c) 2019 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 #include <dali/internal/event/common/scene-impl.h>
32 class PlatformAbstraction;
39 class NotificationManager;
41 class GestureEventProcessor;
42 class RelayoutController;
44 class EventThreadServices;
52 * Class to store a pointer to core in thread local storage.
55 class ThreadLocalStorage
61 * Creates the TLS and adds a pointer to core
62 * @param [in] core reference to core
64 ThreadLocalStorage(Core* core);
69 ~ThreadLocalStorage();
72 * Remove core pointer.
73 * Prevents the core pointer being automatically deleted when the thread exits.
79 * @return reference to the TLS
81 static ThreadLocalStorage& Get();
84 * Checks if the TLS has been created
85 * @return if the TLS has been created
87 static bool Created();
90 * Get a pointer to the TLS or NULL if not initialized
91 * @return pointer to the TLS
93 static ThreadLocalStorage* GetInternal();
96 * get platform abstraction
97 * @return reference to core
99 Dali::Integration::PlatformAbstraction& GetPlatformAbstraction();
102 * Retrieve the update manager
103 * @return reference to update manager
105 SceneGraph::UpdateManager& GetUpdateManager();
108 * Returns the Notification Manager
109 * @return reference to the Notification Manager
111 NotificationManager& GetNotificationManager();
114 * Returns the Shader Factory
115 * @return reference to the Shader Factory
117 ShaderFactory& GetShaderFactory();
120 * Returns the current stage.
121 * @return A pointer to the current stage.
123 StagePtr GetCurrentStage();
126 * Returns the gesture event processor.
127 * @return A reference to the gesture event processor.
129 GestureEventProcessor& GetGestureEventProcessor();
132 * Return the relayout controller
133 * @Return Return a reference to the relayout controller
135 RelayoutController& GetRelayoutController();
138 * Returns the Object registry.
139 * @return A reference to the Object registry
141 ObjectRegistry& GetObjectRegistry();
144 * @brief Gets the event thread services.
145 * @return A reference to the event thread services
147 EventThreadServices& GetEventThreadServices();
150 * @brief Gets the property notification manager.
151 * @return A reference to the property notification manager
153 PropertyNotificationManager& GetPropertyNotificationManager();
156 * @brief Gets the animation play list.
157 * @return A reference to the animation play list
159 AnimationPlaylist& GetAnimationPlaylist();
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.
166 void AddScene( Scene* scene );
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.
173 void RemoveScene( Scene* scene );
177 Core* mCore; ///< reference to core
181 } // namespace Internal
185 #endif // DALI_INTERNAL_THREAD_LOCAL_STORAGE_H