Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-instruction-container.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_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/owner-container.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace SceneGraph
31 {
32 class RenderInstruction;
33
34 /**
35  * Class to encapsulate double buffered render instruction data
36  */
37 class RenderInstructionContainer
38 {
39 public:
40
41   /**
42    * Constructor
43    */
44   RenderInstructionContainer();
45
46   /**
47    * Destructor
48    */
49   ~RenderInstructionContainer();
50
51   /**
52    * Reset the container index and reserve space in the container if needed
53    * @param bufferIndex to reset
54    * @param capacityRequired in the container
55    */
56   void ResetAndReserve( BufferIndex bufferIndex, size_t capacityRequired );
57
58   /**
59    * Return the count of instructions in the container
60    * @param bufferIndex to use
61    * @return the count of elements
62    */
63   size_t Count( BufferIndex bufferIndex );
64
65   /**
66    * Get a reference to the next instruction
67    * @param bufferIndex to use
68    */
69   RenderInstruction& GetNextInstruction( BufferIndex bufferIndex );
70
71   /**
72    * Get a reference to the instruction at index
73    * @param bufferIndex to use
74    * @param index to use
75    */
76   RenderInstruction& At( BufferIndex bufferIndex, size_t index );
77
78 private:
79
80   unsigned int mIndex[ 2 ]; ///< count of the elements that have been added
81   typedef OwnerContainer< RenderInstruction* > InstructionContainer;
82   InstructionContainer mInstructions[ 2 ]; /// Double buffered instruction lists
83
84 };
85
86 } // namespace SceneGraph
87
88 } // namespace Internal
89
90 } // namespace Dali
91
92 #endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H__