OMKSignalRegistrationLoader.h

Go to the documentation of this file.
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 #if !defined OMK_SIGNAL_REGISTRATION_LOADER_H
00019 #define OMK_SIGNAL_REGISTRATION_LOADER_H
00020 
00021 #include "OMKParametersAccessor.h"
00022 
00023 namespace OMK
00024 {
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079   inline void loadSignalRegistrationParameters( const OMK::ConfigurationParameterDescriptor *node, OMK::SimulatedObject *owner, 
00080                                                 const OMK::EventIdentifier& eventId, const std::string& cfgName )
00081   {
00082     bool activate = false ;
00083     std::vector< OMK::Name > emitters ;
00084     if( OMK::ParametersAccessor::get( node, cfgName, activate ) && activate ) 
00085     {
00086       owner->registerForSignal( eventId ) ;
00087     }
00088     else if( OMK::ParametersAccessor::get( node, cfgName, emitters ) )
00089     {
00090       for( size_t i = 0 ; i < emitters.size() ; i++ ) owner->registerForSignalBy( eventId, emitters[ i ] ) ;
00091     }
00092   }
00166   template< class CallerClass, class ListenerCallBack >
00167   inline ListenerCallBack* createListenerAndLoadSignalRegistrationParameters( 
00168             const OMK::ConfigurationParameterDescriptor *node, OMK::SimulatedObject *owner, 
00169             CallerClass *callerInstance, typename ListenerCallBack::CallBackFct callBackFct, 
00170             const OMK::EventIdentifier& eventId, const std::string& cfgName )
00171   {
00172     ListenerCallBack* eventListener = new ListenerCallBack( *owner, callerInstance, callBackFct, eventId ) ;
00173     loadSignalRegistrationParameters( node, owner, eventId, cfgName ) ;
00174     return eventListener ;
00175   }
00193   template< class CallerClass, class ListenerCallBack >
00194   inline ListenerCallBack* createListenerAndLoadSignalRegistrationParameters( 
00195             const OMK::ConfigurationParameterDescriptor *node, 
00196             CallerClass * callerInstance, typename ListenerCallBack::CallBackFct callBackFct, 
00197             const OMK::EventIdentifier& eventId, const std::string& cfgName )
00198   {
00199     return createListenerAndLoadSignalRegistrationParameters< CallerClass, ListenerCallBack >( node, callerInstance, callerInstance, callBackFct, eventId, cfgName ) ;
00200   }
00202 }
00203 # endif //defined OMK_SIGNAL_REGISTRATION_LOADER_H

logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007