00001 /* 00002 * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software 00003 * 00004 * The Software has been developped within the Siames Project. 00005 * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 00015 * for the software may use this file in accordance with that specific license 00016 * 00017 */ 00018 #ifndef PsInputConnectionEventListenerHEADER 00019 #define PsInputConnectionEventListenerHEADER 00020 00021 #include "PsEventListener.h" 00022 00030 template <typename Type> 00031 class PsInputConnectionEventListener : public PsEventListener 00032 { 00033 public: 00038 PsInputConnectionEventListener(PsSimulatedObject & owner , 00039 PsInput<Type> * associatedInput); 00040 00042 virtual ~PsInputConnectionEventListener() ; 00043 00045 virtual void registerEvents() ; 00046 00048 virtual bool processEvent (PsEvent * event) ; 00049 00050 protected: 00052 PsInput<Type> * _associatedInput ; 00053 00054 }; 00055 00056 00057 00058 template <typename Type> 00059 PsInputConnectionEventListener<Type>:: 00060 PsInputConnectionEventListener(PsSimulatedObject & owner, 00061 PsInput<Type> * associatedInput) : 00062 PsEventListener ( owner ), 00063 _associatedInput( associatedInput ) 00064 { 00065 00066 } 00067 00068 00069 00070 template <typename Type> 00071 PsInputConnectionEventListener<Type>:: 00072 ~PsInputConnectionEventListener() 00073 { 00074 00075 } 00076 00077 00078 template <typename Type> 00079 void PsInputConnectionEventListener<Type>::registerEvents() 00080 { 00081 _owner.registerEventListenerForEvent ( *this, _associatedInput->getConnectionEventId() ) ; 00082 _owner.registerEventListenerForEvent ( *this, _associatedInput->getConnectionToControlParameterEventId() ) ; 00083 } 00084 00085 00086 template <typename Type> 00087 bool PsInputConnectionEventListener<Type>::processEvent (PsEvent * event) 00088 { 00089 PsValuedEvent<PsName > * realEvent = dynamic_cast<PsValuedEvent<PsName > *>(event) ; 00090 assert ( realEvent != NULL ); 00091 if ( realEvent->eventId == _associatedInput->getConnectionEventId() ) 00092 { 00093 _associatedInput-> connect ( realEvent->sender, realEvent->value ) ; 00094 } 00095 else 00096 { 00097 _associatedInput-> connectToControlParameter ( realEvent->sender, realEvent->value ) ; 00098 } 00099 return true ; 00100 } 00101 00102 00103 #endif
| Documentation generated on Mon Nov 25 15:25:00 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |