00001 /************************************************************************/ 00002 /* This file is part of openMask(c) INRIA, CNRS, Universite de Rennes 1 */ 00003 /* 1993-2002, thereinafter the Software */ 00004 /* */ 00005 /* The Software has been developped within the Siames Project. */ 00006 /* INRIA, the University of Rennes 1 and CNRS jointly hold intellectual */ 00007 /* property rights */ 00008 /* */ 00009 /* The Software has been registered with the Agence pour la Protection */ 00010 /* des Programmes (APP) under registration number */ 00011 /* IDDN.FR.001.510008.00.S.P.2001.000.41200 */ 00012 /* */ 00013 /* This file may be distributed under the terms of the Q Public License */ 00014 /* version 1.0 as defined by Trolltech AS of Norway and appearing in */ 00015 /* the file LICENSE.QPL included in the packaging of this file. */ 00016 /* */ 00017 /* Licensees holding valid specific licenses issued by INRIA, CNRS or */ 00018 /* Universite Rennes 1 for the software may use this file in */ 00019 /* acordance with that specific license */ 00020 /************************************************************************/ 00021 #ifndef OMK_VIS_ANIMATOREVENTPLUGT_H 00022 #define OMK_VIS_ANIMATOREVENTPLUGT_H 00023 00024 #include "OMKAnimatorPlugT.h" 00025 #include "OMKIAnimatorEventPlug.h" 00026 #include "OMKValuedEvent.h" 00027 00028 namespace OMK 00029 { 00030 class Event ; 00031 namespace Vis 00032 { 00043 template< typename T > 00044 class AnimatorEventPlugT : public AnimatorPlugT< T >, public IAnimatorEventPlug 00045 { 00046 public: 00047 00049 00050 00051 AnimatorEventPlugT( VisBase& vis, const EventIdentifier& eventId ) ; 00052 00054 virtual ~AnimatorEventPlugT() ; 00056 00058 00059 00060 00061 00062 00063 00064 virtual void setEvent( const Event* event ) ; 00066 00068 00069 00070 00071 00072 00073 00074 virtual const T& getTypedValue() const ; 00078 virtual bool isValueChanged() const 00079 { 00080 bool tmp = _updatedValue ; 00081 _updatedValue = false ; 00082 return tmp ; 00083 } 00085 00086 protected: 00087 00090 T _value ; 00091 }; 00092 00093 //------------------------------------------------------------------------- 00094 // constructor 00095 //------------------------------------------------------------------------- 00096 template< typename T > 00097 AnimatorEventPlugT<T>::AnimatorEventPlugT( VisBase& vis, const EventIdentifier& eventId ) : 00098 AnimatorPlugT<T>(), 00099 IAnimatorEventPlug( vis, eventId ), 00100 _value() // default value 00101 { 00102 } 00103 00104 //------------------------------------------------------------------------- 00105 // destructor 00106 //------------------------------------------------------------------------- 00107 template< typename T > 00108 AnimatorEventPlugT<T>::~AnimatorEventPlugT() 00109 { 00110 } 00111 00112 //------------------------------------------------------------------------- 00113 // setEvent 00114 //------------------------------------------------------------------------- 00115 template< typename T > 00116 void 00117 AnimatorEventPlugT<T>::setEvent( const Event* event ) 00118 { 00119 const ValuedEvent< T >* valuedEvent = dynamic_cast< const ValuedEvent< T >* >( event ) ; 00120 OMASSERT( valuedEvent && "Bad type cast for the event" ) ; 00121 // Copy the value 00122 _value = valuedEvent->value ; 00123 _updatedValue = true ; 00124 } 00125 00126 //------------------------------------------------------------------------- 00127 // getTypedValue 00128 //------------------------------------------------------------------------- 00129 template< typename T > 00130 const T& 00131 AnimatorEventPlugT<T>::getTypedValue() const 00132 { 00133 return _value ; 00134 } 00135 00136 }// namespace Vis 00137 }// namespace OMK 00138 00139 #endif // OMK_VIS_ANIMATOREVENTPLUGT_H
Documentation generated on Mon Jun 9 11:45:55 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |