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