Dali 3D User Interface Engine
property-input-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__
2 #define __DALI_INTERNAL_PROPERTY_INPUT_IMPL_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 // EXTERNAL INCLUDES
22 #include <iostream>
23 
24 // INTERNAL INCLUDES
33 
34 namespace Dali
35 {
36 
37 namespace Internal
38 {
39 
45 {
46 public:
47 
52  {
53  }
54 
59  virtual Property::Type GetType() const = 0;
60 
65  virtual bool InputInitialized() const = 0;
66 
71  virtual bool InputChanged() const = 0;
72 
79  virtual const bool& GetBoolean( BufferIndex bufferIndex ) const
80  {
81  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
82  // the return will never be executed due to assert above so just keep the compiler happy
83  return reinterpret_cast<const bool&>(*this);
84  }
85 
92  virtual const int& GetInteger( BufferIndex bufferIndex ) const
93  {
94  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
95  // the return will never be executed due to assert above so just keep the compiler happy
96  return reinterpret_cast<const int&>(*this);
97  }
98 
105  virtual const float& GetFloat( BufferIndex bufferIndex ) const
106  {
107  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
108  // the return will never be executed due to assert above so just keep the compiler happy
109  return reinterpret_cast<const float&>(*this);
110  }
111 
118  virtual const Vector2& GetVector2( BufferIndex bufferIndex ) const
119  {
120  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
121  // the return will never be executed due to assert above so just keep the compiler happy
122  return reinterpret_cast<const Vector2&>(*this);
123  }
124 
131  virtual const Vector3& GetVector3( BufferIndex bufferIndex ) const
132  {
133  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
134  // the return will never be executed due to assert above so just keep the compiler happy
135  return reinterpret_cast<const Vector3&>(*this);
136  }
137 
144  virtual const Vector4& GetVector4( BufferIndex bufferIndex ) const
145  {
146  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
147  // the return will never be executed due to assert above so just keep the compiler happy
148  return reinterpret_cast<const Vector4&>(*this);
149  }
150 
157  virtual const Quaternion& GetQuaternion( BufferIndex bufferIndex ) const
158  {
159  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
160  // the return will never be executed due to assert above so just keep the compiler happy
161  return reinterpret_cast<const Quaternion&>(*this);
162  }
163 
170  virtual const Matrix3& GetMatrix3( BufferIndex bufferIndex ) const
171  {
172  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
173  // the return will never be executed due to assert above so just keep the compiler happy
174  return reinterpret_cast<const Matrix3&>(*this);
175  }
176 
183  virtual const Matrix& GetMatrix( BufferIndex bufferIndex ) const
184  {
185  DALI_ASSERT_ALWAYS( false && "Property type mismatch" );
186  // the return will never be executed due to assert above so just keep the compiler happy
187  return reinterpret_cast<const Matrix&>(*this);
188  }
189 
190  // Accessors for Constraint functions
191 
200  virtual const bool& GetConstraintInputBoolean( BufferIndex updateBufferIndex ) const
201  {
202  return GetBoolean( updateBufferIndex );
203  }
204 
213  virtual const int& GetConstraintInputInteger( BufferIndex updateBufferIndex ) const
214  {
215  return GetInteger( updateBufferIndex );
216  }
217 
226  virtual const float& GetConstraintInputFloat( BufferIndex updateBufferIndex ) const
227  {
228  return GetFloat( updateBufferIndex );
229  }
230 
239  virtual const Vector2& GetConstraintInputVector2( BufferIndex updateBufferIndex ) const
240  {
241  return GetVector2( updateBufferIndex );
242  }
243 
252  virtual const Vector3& GetConstraintInputVector3( BufferIndex updateBufferIndex ) const
253  {
254  return GetVector3( updateBufferIndex );
255  }
256 
265  virtual const Vector4& GetConstraintInputVector4( BufferIndex updateBufferIndex ) const
266  {
267  return GetVector4( updateBufferIndex );
268  }
269 
278  virtual const Quaternion& GetConstraintInputQuaternion( BufferIndex updateBufferIndex ) const
279  {
280  return GetQuaternion( updateBufferIndex );
281  }
282 
291  virtual const Matrix3& GetConstraintInputMatrix3( BufferIndex updateBufferIndex ) const
292  {
293  return GetMatrix3( updateBufferIndex );
294  }
295 
304  virtual const Matrix& GetConstraintInputMatrix( BufferIndex updateBufferIndex ) const
305  {
306  return GetMatrix( updateBufferIndex );
307  }
308 
315  void DebugPrint( std::ostream& debugStream, BufferIndex bufferIndex ) const
316  {
317  switch ( GetType() )
318  {
319  case Property::BOOLEAN:
320  {
321  debugStream << GetBoolean( bufferIndex );
322  break;
323  }
324 
325  case Property::INTEGER:
326  {
327  debugStream << GetInteger( bufferIndex );
328  break;
329  }
330 
331  case Property::FLOAT:
332  {
333  debugStream << GetFloat( bufferIndex );
334  break;
335  }
336 
337  case Property::VECTOR2:
338  {
339  debugStream << GetVector2( bufferIndex );
340  break;
341  }
342 
343  case Property::VECTOR3:
344  {
345  debugStream << GetVector3( bufferIndex );
346  break;
347  }
348 
349  case Property::VECTOR4:
350  {
351  debugStream << GetVector4( bufferIndex );
352  break;
353  }
354 
355  case Property::ROTATION:
356  {
357  debugStream << GetQuaternion( bufferIndex );
358  break;
359  }
360 
361  case Property::MATRIX:
362  {
363  debugStream << GetMatrix( bufferIndex );
364  break;
365  }
366 
367  case Property::MATRIX3:
368  {
369  debugStream << GetMatrix3( bufferIndex );
370  break;
371  }
372 
373  default:
374  break; // print nothing
375  }
376  }
377 };
378 
379 } // namespace Internal
380 
381 } // namespace Dali
382 
383 #endif // __DALI_INTERNAL_PROPERTY_INPUT_IMPL_H__
Dali Docs Home
Read more about Dali