[dali_1.2.40] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / render / data-providers / property-buffer-data-provider.h
1 #ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H
2 #define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H
3
4 /*
5  * Copyright (c) 2017 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 // EXTERNAL INCLUDES
21 #include <string>
22
23 // INTERNAL INCLUDES
24 #include <dali/public-api/object/property.h>
25 #include <dali/internal/common/buffer-index.h>
26
27 namespace Dali
28 {
29 namespace Internal
30 {
31 namespace SceneGraph
32 {
33
34 class PropertyBufferDataProvider
35 {
36 public:
37
38   /**
39    * Type for the data contained in the buffer
40    */
41   typedef Dali::Vector< char > BufferType;
42
43 public:
44   /**
45    * Constructor
46    */
47   PropertyBufferDataProvider()
48   {
49   }
50
51   /**
52    * Get the number of attributes
53    * @param[in] bufferIndex Index to access double buffered values
54    * @return the number of attributes
55    */
56   virtual unsigned int GetAttributeCount( BufferIndex bufferIndex ) const = 0;
57
58   /**
59    * Get the name of an attribute
60    * @param[in] bufferIndex Index to access double buffered values
61    * @param[in] index Index of the attribute
62    * @return the name of the attribute
63    */
64   virtual const std::string& GetAttributeName( BufferIndex bufferIndex, unsigned int index ) const = 0;
65
66   /**
67    * Get the byte size of an attribute
68    * @param[in] bufferIndex Index to access double buffered values
69    * @param[in] index Index of the attribute
70    * @return the byte size of the attribute
71    */
72   virtual size_t GetAttributeSize( BufferIndex bufferIndex, unsigned int index ) const = 0;
73
74   /**
75    * Get the type of an attribute
76    * @param[in] bufferIndex Index to access double buffered values
77    * @param[in] index Index of the attribute
78    * @return the type of the attribute
79    */
80   virtual Property::Type GetAttributeType( BufferIndex bufferIndex, unsigned int index ) const = 0;
81
82   /**
83    * Get the byte offset of an attribute
84    * @param[in] bufferIndex Index to access double buffered values
85    * @param[in] index Index of the attribute
86    * @return the byte offset of the attribute
87    */
88   virtual size_t GetAttributeOffset( BufferIndex bufferIndex, unsigned int index ) const = 0;
89
90   /**
91    * Get the property buffer data
92    * @param[in] bufferIndex Index to access double buffered values
93    * @return the property buffer's data array
94    */
95   virtual const BufferType& GetData( BufferIndex bufferIndex ) const = 0;
96
97   /**
98    * Get the size of the property buffer in bytes
99    * @param[in] bufferIndex Index to access double buffered values
100    * @return the size in bytes
101    */
102   virtual size_t GetDataSize( BufferIndex bufferIndex ) const = 0;
103
104   /**
105    * Get the size of an element of the buffer in bytes
106    * @param[in] bufferIndex Index to access double buffered values
107    * @return the element size in bytes
108    */
109   virtual size_t GetElementSize( BufferIndex bufferIndex ) const = 0;
110
111   /**
112    * Get the number of elements
113    * @param[in] bufferIndex Index to access double buffered values
114    * @return the number of elements
115    */
116   virtual unsigned int GetElementCount( BufferIndex bufferIndex ) const = 0;
117
118   /**
119    * Get Id of the GPU buffer associated with this propertyBuffer
120    * @param[in] bufferIndex Index to access double buffered values
121    * @return the Id
122    */
123   virtual unsigned int GetGpuBufferId( BufferIndex bufferIndex ) const = 0;
124
125   /**
126    * Checks if data in the PropertyBuffer has changed repect previous frame
127    * @param[in] bufferIndex Index to access double buffered values
128    * @return true if data has changed, false otherwise
129    */
130   virtual bool HasDataChanged( BufferIndex bufferIndex ) const = 0;
131
132 protected:
133   /**
134    * No deletion through this interface
135    */
136   virtual ~PropertyBufferDataProvider()
137   {
138   }
139 };
140
141 } // namespace SceneGraph
142 } // namespace Internal
143 } // namespace Dali
144
145 #endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_BUFFER_DATA_PROVIDER_H