/**
* Templated class for a double-buffered value.
- * This simplifies init code, and forces explicit initialization.
*/
template <typename T>
class DoubleBuffered
{
public:
- DoubleBuffered(const T& val)
- : mValue1(val),
- mValue2(val)
- {
- }
-
- inline T& operator[](const size_t i)
- {
- DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
- return *(&mValue1+i);
- }
-
- inline const T& operator[](const size_t i) const
+ DoubleBuffered()
+ : mValue1(),
+ mValue2()
{
- DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
- return *(&mValue1+i);
}
-private:
-
- // Undefined
- DoubleBuffered<T>(const DoubleBuffered<T>&);
-
- // Undefined
- DoubleBuffered<T>& operator=(const DoubleBuffered<T>& rhs);
-
-private:
-
- T mValue1;
- T mValue2;
-};
-
-/**
- * Templated class for a double-buffered value, initialized with 3 value parameters.
- * This simplifies init code, and forces explicit initialization.
- */
-template <typename T, typename P>
-class DoubleBuffered3
-{
-public:
-
- DoubleBuffered3(const T& val)
- : mValue1(val),
- mValue2(val)
- {
- }
-
- DoubleBuffered3(P val1, P val2, P val3)
- : mValue1(val1, val2, val3),
- mValue2(val1, val2, val3)
- {
- }
-
- inline T& operator[](const size_t i)
- {
- DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
- return *(&mValue1+i);
- }
-
- inline const T& operator[](const size_t i) const
- {
- DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
-
- return *(&mValue1+i);
- }
-
-private:
-
- // Undefined
- DoubleBuffered3<T,P>(const DoubleBuffered3<T,P>&);
-
- // Undefined
- DoubleBuffered3<T,P>& operator=(const DoubleBuffered3<T,P>& rhs);
-
-private:
-
- T mValue1;
- T mValue2;
-};
-
-/**
- * Templated class for a double-buffered value, initialized with 4 value parameters.
- * This simplifies init code, and forces explicit initialization.
- */
-template <typename T, typename P>
-class DoubleBuffered4
-{
-public:
-
- DoubleBuffered4(const T& val)
+ DoubleBuffered(const T& val)
: mValue1(val),
mValue2(val)
{
}
- DoubleBuffered4(P val1, P val2, P val3, P val4)
- : mValue1(val1, val2, val3, val4),
- mValue2(val1, val2, val3, val4)
- {
- }
-
inline T& operator[](const size_t i)
{
DALI_ASSERT_DEBUG(i < NUM_SCENE_GRAPH_BUFFERS);
private:
// Undefined
- DoubleBuffered4<T,P>(const DoubleBuffered4<T,P>&);
+ DoubleBuffered<T>(const DoubleBuffered<T>&);
// Undefined
- DoubleBuffered4<T,P>& operator=(const DoubleBuffered4<T,P>& rhs);
+ DoubleBuffered<T>& operator=(const DoubleBuffered<T>& rhs);
private:
T mValue2;
};
-typedef DoubleBuffered<int> DoubleBufferedInt;
-typedef DoubleBuffered<float> DoubleBufferedFloat;
-typedef DoubleBuffered<bool> DoubleBufferedBool;
-
-typedef DoubleBuffered3<Vector3,float> DoubleBufferedVector3;
-typedef DoubleBuffered4<Vector4,float> DoubleBufferedVector4;
-
-typedef DoubleBuffered4<Quaternion, float> DoubleBufferedQuaternion;
-
-typedef DoubleBuffered<Matrix> DoubleBufferedMatrix;
-
} // namespace SceneGraph
} // namespace Internal