Remove forceProcess and forceUpdate flag
[platform/core/uifw/dali-core.git] / dali / internal / event / common / event-thread-services.h
1 #ifndef DALI_INTERNAL_EVENT_THREAD_SERVICES_H
2 #define DALI_INTERNAL_EVENT_THREAD_SERVICES_H
3
4 /*
5  * Copyright (c) 2023 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 // EXTERNAL INCLUDES
22 #include <cstddef>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/common/buffer-index.h>
26
27 namespace Dali
28 {
29 class BaseObject;
30
31 namespace Integration
32 {
33 class RenderController;
34 }
35
36 namespace Internal
37 {
38 namespace SceneGraph
39 {
40 class UpdateManager;
41 }
42
43 /**
44  * Abstract interface of services for event-thread objects.
45  * Used for registering objects, queueing messages during the event-thread for the next update.
46  * Allows the event-thread to read double-buffered property values.
47  */
48 class EventThreadServices
49 {
50 public:
51   /**
52    * Virtual destructor
53    */
54   virtual ~EventThreadServices() = default;
55
56   /**
57    * Get the EventThreadServices
58    * @return reference to the EventThreadServices
59    */
60   static EventThreadServices& Get();
61
62   /**
63    * @brief Registers the object as created with the Object registry.
64    *
65    * @param[in] object to register
66    */
67   virtual void RegisterObject(BaseObject* object) = 0;
68
69   /**
70    * @brief Unregisters the object from Object registry.
71    *
72    * @param[in] object to unregister
73    */
74   virtual void UnregisterObject(BaseObject* object) = 0;
75
76   /**
77    * @brief Get a reference to the UpdateManager
78    *
79    * @return the update manager
80    */
81   virtual SceneGraph::UpdateManager& GetUpdateManager() = 0;
82
83   /**
84    * @brief Get a reference to the RenderController
85    *
86    * @return the render controller
87    */
88   virtual Integration::RenderController& GetRenderController() = 0;
89
90   /**
91    * Reserve space for another message in the queue; this must then be initialized by the caller.
92    * The message will be read from the update-thread after the next FlushMessages is called.
93    * @post Calling this method may invalidate any previously returned slots.
94    * @param[in] size The message size with respect to the size of type "char".
95    * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
96    * @return A pointer to the first char allocated for the message.
97    */
98   virtual uint32_t* ReserveMessageSlot(uint32_t size, bool updateScene = true) = 0;
99
100   /**
101    * @return the current event-buffer index.
102    */
103   virtual BufferIndex GetEventBufferIndex() const = 0;
104
105   /**
106    * @return true if core is still running and we can send messages
107    * @note It returns false if it is called from a thread other than the main thread.
108    */
109   static bool IsCoreRunning();
110
111   /**
112    * @brief Check if the event thread service is shutting down.
113    *
114    * @return true if the event thread service is shutting down.
115    * @note It returns false if the core hasn't been initialised yet.
116    */
117   static bool IsShuttingDown();
118 };
119
120 } // namespace Internal
121
122 } // namespace Dali
123
124 #endif // DALI_INTERNAL_EVENT_THREAD_SERVICES_H