OMKAnimator.cpp

Go to the documentation of this file.
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 #include "OMKParametersAccessor.inl"
00022 #include "OMKVisBase.h"
00023 #include "OMKAnimator.h"
00024 #include "OMKAnimatorEventPlug.h"
00025 #include "OMKVisualObject.h"
00026 
00027 using namespace OMK ;
00028 using namespace OMK::Vis ;
00029 
00030 std::string OMK::Vis::debugMsg( const OMK::Vis::Animator* anim ) 
00031 {
00032   std::ostringstream txt ;
00033   txt << "animator \"" << (anim ? anim->getId().getString() : std::string( "null" ) ) 
00034     << "\" of visual object \"" << (anim ? anim->getVisualObject().getId().getCString() : "unknow" ) << "\"" ;
00035   return txt.str() ;
00036 }
00037 
00038 
00039 //-------------------------------------------------------------------------
00040 // constructor
00041 //-------------------------------------------------------------------------
00042 Animator::Animator( VisualObject& visualObject, const Name& id, const ConfigurationParameterDescriptor& node ) 
00043         : _plugUpdate( 0 ),
00044         _id( id ) ,
00045         _visualObject( visualObject ),
00046   _tNode (NULL)
00047 {
00048   OMTRACEID( OMK_DEBUG_VIS_EXEC, "Construction of " << debugMsg( this ) );
00049   std::string eventId = id.getString() ;
00050         
00051   // If configFile is not providing the EventId, EventId will be the id
00052   ParametersAccessor::get( &node, "ListenedEvent", eventId ) ;
00053   std::string emitter ;
00054   ParametersAccessor::get( &node, "Emitter", emitter ) ;
00055   _plugUpdate = new AnimatorEventPlug( visualObject.touchVis(), EventIdentifier( eventId ) ) ;
00056   visualObject.touchVis().registerEventPlug( EventIdentifier( eventId ), emitter, static_cast<AnimatorEventPlug*>( _plugUpdate ) );
00057 }
00058 
00059 //-------------------------------------------------------------------------
00060 // constructor AnimatorT 
00061 //-------------------------------------------------------------------------
00062 Animator::Animator( VisualObject& visualObject, const Name& id )
00063         : _plugUpdate( 0 ),
00064         _id( id ),
00065         _visualObject( visualObject ),
00066   _tNode ( NULL )
00067 {
00068   OMTRACEID( OMK_DEBUG_VIS_EXEC, "Construction of " << debugMsg( this ) );
00069 }
00070 
00071 //-------------------------------------------------------------------------
00072 // destructor
00073 //-------------------------------------------------------------------------
00074 Animator::~Animator()
00075 {
00076   OMTRACEID( OMK_DEBUG_VIS_EXEC, "Destruction of " << debugMsg( this ) );
00077   delete _plugUpdate ;
00078 }
00079 
00080 //-------------------------------------------------------------------------
00081 // processVis
00082 //-------------------------------------------------------------------------
00083 void 
00084 Animator::processVis() 
00085 {
00086         OMASSERTM( _plugUpdate, "Cannot be null, must be valid a valid plug" ) ;
00087         if( _plugUpdate->isValueChanged() )
00088         {
00089                 selfProcessVis() ;
00090         }
00091 }

logo OpenMask

Documentation generated on Mon Jun 9 11:45:55 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007