9417afe6fa5ee7db1201aa1b09df3acaffcbfe6a
[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) 2021 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/devel-api/common/owner-container.h>
23 #include <dali/internal/common/buffer-index.h>
24 #include <dali/public-api/common/vector-wrapper.h>
25
26 namespace Dali
27 {
28 namespace Internal
29 {
30 namespace SceneGraph
31 {
32 class RenderInstruction;
33
34 /**
35  * Class to hold ordered list of current frame's render instructions.
36  * Does not own the instructions.
37  */
38 class RenderInstructionContainer
39 {
40 public:
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, uint32_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   uint32_t Count(BufferIndex bufferIndex);
64
65   /**
66    * Get a reference to the instruction at index
67    * @param bufferIndex to use
68    * @param index to use
69    */
70   RenderInstruction& At(BufferIndex bufferIndex, uint32_t index);
71
72   /**
73    * Add an instruction to the end of the container
74    * @param bufferIndex to use
75    */
76   void PushBack(BufferIndex index, RenderInstruction* renderInstruction);
77
78 private:
79   std::vector<RenderInstruction*> mInstructions;
80 };
81
82 } // namespace SceneGraph
83
84 } // namespace Internal
85
86 } // namespace Dali
87
88 #endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_INSTRUCTION_CONTAINER_H