#define __DALI_INTERNAL_MESSAGE_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)( ParameterType< P >::PassObject( param1 ) );
+ (object->*memberFunction)( param1 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ) );
+ (object->*memberFunction)( param1, param2 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ) );
+ (object->*memberFunction)( param1, param2, param3 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ) );
+ (object->*memberFunction)( param1, param2, param3, param4 );
}
private:
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ),
- ParameterType< P5 >::PassObject( param5 ) );
+ (object->*memberFunction)( param1, param2, param3, param4, param5 );
}
virtual void Process( BufferIndex /*bufferIndex*/ )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- ParameterType< P1 >::PassObject( param1 ),
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ),
- ParameterType< P5 >::PassObject( param5 ),
- ParameterType< P6 >::PassObject( param6 ) );
+ (object->*memberFunction)( param1, param2, param3, param4, param5, param6 );
}
/**
* Templated message which calls a member function of an object.
+ * This overload passes just the buffer index to the method, no parameters.
+ */
+template< typename T >
+class MessageDoubleBuffered0 : public MessageBase
+{
+public:
+
+ typedef void(T::*MemberFunction)( BufferIndex );
+
+ /**
+ * Create a message.
+ * @note The object is expected to be const in the thread which sends this message.
+ * However it can be modified when Process() is called in a different thread.
+ * @param[in] obj The object.
+ * @param[in] member The member function of the object.
+ */
+ MessageDoubleBuffered0( const T* obj, MemberFunction member )
+ : MessageBase(),
+ object( const_cast< T* >( obj ) ),
+ memberFunction( member )
+ {
+ }
+
+ /**
+ * Virtual destructor
+ */
+ virtual ~MessageDoubleBuffered0()
+ {
+ }
+
+ /**
+ * @copydoc MessageBase::Process
+ */
+ virtual void Process( BufferIndex bufferIndex )
+ {
+ DALI_ASSERT_DEBUG( object && "Message does not have an object" );
+ (object->*memberFunction)( bufferIndex );
+ }
+
+private:
+
+ T* object;
+ MemberFunction memberFunction;
+
+};
+
+
+/**
+ * Templated message which calls a member function of an object.
* This overload passes a value-type to set a double-buffered property.
* Template parameters need to match the MemberFunction!
* The message will contain copy of the value (in case of & or const&)
virtual void Process( BufferIndex bufferIndex )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- bufferIndex,
- ParameterType< P >::PassObject( param ) );
+ (object->*memberFunction)( bufferIndex, param );
}
private:
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
(object->*memberFunction)(
- bufferIndex,
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ) );
+ bufferIndex, param2, param3 );
}
private:
virtual void Process( BufferIndex bufferIndex )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- bufferIndex,
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ) );
+ (object->*memberFunction)( bufferIndex, param2, param3, param4 );
}
private:
virtual void Process( BufferIndex bufferIndex )
{
DALI_ASSERT_DEBUG( object && "Message does not have an object" );
- (object->*memberFunction)(
- bufferIndex,
- ParameterType< P2 >::PassObject( param2 ),
- ParameterType< P3 >::PassObject( param3 ),
- ParameterType< P4 >::PassObject( param4 ),
- ParameterType< P5 >::PassObject( param5 ) );
+ (object->*memberFunction)( bufferIndex, param2, param3, param4, param5 );
}
private: