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