Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / common / event-to-update.h
1 #ifndef __DALI_INTERNAL_EVENT_TO_UPDATE_H__
2 #define __DALI_INTERNAL_EVENT_TO_UPDATE_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/common/buffer-index.h>
22 #include <dali/internal/common/message.h>
23 #include <dali/internal/update/common/scene-graph-buffers.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 /**
32  * Abstract interface for accessing update-thread data from the event-thread.
33  * Used for queueing messages during the event-thread for the next update.
34  * Allows the event-thread to read double-buffered property values.
35  */
36 class EventToUpdate
37 {
38 public:
39
40   /**
41    * Virtual destructor
42    */
43   virtual ~EventToUpdate()
44   {
45   }
46
47   /**
48    * Called by the event-thread to signal that FlushQueue will be called
49    * e.g. when it has finished event processing.
50    */
51   virtual void EventProcessingStarted() = 0;
52
53   /**
54    * Reserve space for another message in the queue; this must then be initialized by the caller.
55    * The message will be read from the update-thread after the next FlushMessages is called.
56    * @post Calling this method may invalidate any previously returned slots.
57    * @param[in] size The message size with respect to the size of type "char".
58    * @param[in] updateScene A flag, when true denotes that the message will cause the scene-graph node tree to require an update.
59    * @return A pointer to the first char allocated for the message.
60    */
61   virtual unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene = true ) = 0;
62
63   /**
64    * Retrieve the current event-buffer index.
65    */
66   virtual BufferIndex GetEventBufferIndex() const  = 0;
67
68   /**
69    * Flush the set of messages, which were previously stored with QueueMessage().
70    * Calls to this thread-safe method should be minimized, to avoid thread blocking.
71    *
72    * @return True if there are messages to process.
73    */
74   virtual bool FlushQueue() = 0;
75 };
76
77 } // namespace Internal
78
79 } // namespace Dali
80
81 #endif // __DALI_INTERNAL_EVENT_TO_UPDATE_H__