Dali 3D User Interface Engine
message.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_MESSAGE_H__
2 #define __DALI_INTERNAL_MESSAGE_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 // INTERNAL INCLUDES
25 
26 namespace Dali
27 {
28 
29 namespace Internal
30 {
31 
38 {
39 public:
40 
45  {
46  }
47 
51  virtual ~MessageBase()
52  {
53  }
54 
59  virtual void Process( BufferIndex bufferIndex ) = 0;
60 
61 private:
62 };
63 
69 template< typename T >
70 class Message : public MessageBase
71 {
72 public:
73 
74  typedef void(T::*MemberFunction)();
75 
83  Message( const T* obj, MemberFunction member )
84  : MessageBase(),
85  object( const_cast< T* >( obj ) ),
86  memberFunction( member )
87  {
88  }
89 
93  virtual ~Message()
94  {
95  }
96 
100  virtual void Process( BufferIndex /*bufferIndex*/ )
101  {
102  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
103  (object->*memberFunction)();
104  }
105 
106 private:
107 
108  T* object;
110 
111 };
112 
119 template< typename T, typename P >
121 {
122 public:
123 
124  typedef void(T::*MemberFunction)( typename ParameterType< P >::PassingType );
125 
134  MessageValue1( const T* obj,
135  MemberFunction member,
137  : MessageBase(),
138  object( const_cast< T* >( obj ) ),
139  memberFunction( member ),
140  param1( p1 )
141  {
142  }
143 
147  virtual ~MessageValue1()
148  {
149  }
150 
154  virtual void Process( BufferIndex /*bufferIndex*/ )
155  {
156  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
158  }
159 
160 private:
161 
162  T* object;
165 
166 };
167 
175 template< typename T, typename P1, typename P2 >
177 {
178 public:
179 
180  typedef void(T::*MemberFunction)(
183 
193  MessageValue2( const T* obj,
194  MemberFunction member,
197  : MessageBase(),
198  object( const_cast< T* >( obj ) ),
199  memberFunction( member ),
200  param1( p1 ),
201  param2( p2 )
202  {
203  }
204 
208  virtual ~MessageValue2()
209  {
210  }
211 
215  virtual void Process( BufferIndex /*bufferIndex*/ )
216  {
217  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
218  (object->*memberFunction)(
221  }
222 
223 private:
224 
225  T* object;
229 
230 };
231 
238 template< typename T, typename P1, typename P2, typename P3 >
240 {
241 public:
242 
243  typedef void(T::*MemberFunction)(
247 
258  MessageValue3( const T* obj,
259  MemberFunction member,
263  : MessageBase(),
264  object( const_cast< T* >( obj ) ),
265  memberFunction( member ),
266  param1( p1 ),
267  param2( p2 ),
268  param3( p3 )
269  {
270  }
271 
275  virtual ~MessageValue3()
276  {
277  }
278 
282  virtual void Process( BufferIndex /*bufferIndex*/ )
283  {
284  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
285  (object->*memberFunction)(
289  }
290 
291 private:
292 
293  T* object;
298 
299 };
300 
307 template< typename T, typename P1, typename P2, typename P3, typename P4 >
309 {
310 public:
311 
312  typedef void(T::*MemberFunction)(
317 
329  MessageValue4( const T* obj,
330  MemberFunction member,
335  : MessageBase(),
336  object( const_cast< T* >( obj ) ),
337  memberFunction( member ),
338  param1( p1 ),
339  param2( p2 ),
340  param3( p3 ),
341  param4( p4 )
342  {
343  }
344 
348  virtual ~MessageValue4()
349  {
350  }
351 
355  virtual void Process( BufferIndex /*bufferIndex*/ )
356  {
357  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
358  (object->*memberFunction)(
363  }
364 
365 private:
366 
367  T* object;
373 
374 };
375 
382 template< typename T, typename P1, typename P2, typename P3, typename P4, typename P5 >
384 {
385 public:
386 
387  typedef void(T::*MemberFunction)(
393 
406  MessageValue5( const T* obj,
407  MemberFunction member,
413  : MessageBase(),
414  object( const_cast< T* >( obj ) ),
415  memberFunction( member ),
416  param1( p1 ),
417  param2( p2 ),
418  param3( p3 ),
419  param4( p4 ),
420  param5( p5 )
421  {
422  }
423 
427  virtual ~MessageValue5()
428  {
429  }
430 
434  virtual void Process( BufferIndex /*bufferIndex*/ )
435  {
436  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
437  (object->*memberFunction)(
443 
444  }
445 
446 private:
447 
448  T* object;
455 
456 };
457 
464 template< typename T, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6 >
466 {
467 public:
468 
469  typedef void(T::*MemberFunction)(
476 
490  MessageValue6( const T* obj,
491  MemberFunction member,
498  : MessageBase(),
499  object( const_cast< T* >( obj ) ),
500  memberFunction( member ),
501  param1( p1 ),
502  param2( p2 ),
503  param3( p3 ),
504  param4( p4 ),
505  param5( p5 ),
506  param6( p6 )
507  {
508  }
509 
513  virtual ~MessageValue6()
514  {
515  }
516 
520  virtual void Process( BufferIndex /*bufferIndex*/ )
521  {
522  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
523  (object->*memberFunction)(
530 
531  }
532 
533 private:
534 
535  T* object;
543 
544 };
545 
550 template< typename T >
552 {
553 public:
554 
555  typedef void(T::*MemberFunction)( BufferIndex );
556 
564  MessageDoubleBuffered0( const T* obj, MemberFunction member )
565  : MessageBase(),
566  object( const_cast< T* >( obj ) ),
567  memberFunction( member )
568  {
569  }
570 
575  {
576  }
577 
581  virtual void Process( BufferIndex bufferIndex )
582  {
583  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
584  (object->*memberFunction)( bufferIndex );
585  }
586 
587 private:
588 
589  T* object;
591 
592 };
593 
594 
601 template< typename T, typename P >
603 {
604 public:
605 
606  typedef void(T::*MemberFunction)(
607  BufferIndex,
609 
618  MessageDoubleBuffered1( const T* obj,
619  MemberFunction member,
621  : MessageBase(),
622  object( const_cast< T* >( obj ) ),
623  memberFunction( member ),
624  param( p )
625  {
626  }
627 
632  {
633  }
634 
638  virtual void Process( BufferIndex bufferIndex )
639  {
640  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
641  (object->*memberFunction)(
642  bufferIndex,
644  }
645 
646 private:
647 
648  T* object;
651 
652 };
653 
660 template< typename T, typename P2, typename P3 >
662 {
663 public:
664 
665  typedef void(T::*MemberFunction)(
666  BufferIndex,
669 
679  MessageDoubleBuffered2( const T* obj,
680  MemberFunction member,
683  : MessageBase(),
684  object( const_cast< T* >( obj ) ),
685  memberFunction( member ),
686  param2( p2 ),
687  param3( p3 )
688  {
689  }
690 
695  {
696  }
697 
701  virtual void Process( BufferIndex bufferIndex )
702  {
703  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
704  (object->*memberFunction)(
705  bufferIndex,
708  }
709 
710 private:
711 
712  T* object;
716 
717 };
718 
719 
726 template< typename T, typename P2, typename P3, typename P4 >
728 {
729 public:
730 
731  typedef void(T::*MemberFunction)(
732  BufferIndex,
736 
747  MessageDoubleBuffered3( const T* obj,
748  MemberFunction member,
752  : MessageBase(),
753  object( const_cast< T* >( obj ) ),
754  memberFunction( member ),
755  param2( p2 ),
756  param3( p3 ),
757  param4( p4 )
758  {
759  }
760 
765  {
766  }
767 
771  virtual void Process( BufferIndex bufferIndex )
772  {
773  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
774  (object->*memberFunction)(
775  bufferIndex,
779  }
780 
781 private:
782 
783  T* object;
788 
789 };
790 
797 template< typename T, typename P2, typename P3, typename P4, typename P5 >
799 {
800 public:
801 
802  typedef void(T::*MemberFunction)(
803  BufferIndex,
808 
820  MessageDoubleBuffered4( const T* obj,
821  MemberFunction member,
826  : MessageBase(),
827  object( const_cast< T* >( obj ) ),
828  memberFunction( member ),
829  param2( p2 ),
830  param3( p3 ),
831  param4( p4 ),
832  param5( p5 )
833  {
834  }
835 
840  {
841  }
842 
846  virtual void Process( BufferIndex bufferIndex )
847  {
848  DALI_ASSERT_DEBUG( object && "Message does not have an object" );
849  (object->*memberFunction)(
850  bufferIndex,
855  }
856 
857 private:
858 
859  T* object;
865 
866 };
867 
868 } // namespace Internal
869 
870 } // namespace Dali
871 
872 #endif // __DALI_INTERNAL_MESSAGE_H__
Dali Docs Home
Read more about Dali