OMKIConvertor.inl

Go to the documentation of this file.
00001 
00002 /************************************************************************/
00003 /* This file is part of openMask(c) INRIA, CNRS, Universite de Rennes 1 */
00004 /* 1993-2002, thereinafter the Software                                 */
00005 /*                                                                      */
00006 /* The Software has been developped within the Siames Project.          */
00007 /* INRIA, the University of Rennes 1 and CNRS jointly hold intellectual */
00008 /* property rights                                                      */
00009 /*                                                                      */
00010 /* The Software has been registered with the Agence pour la Protection  */
00011 /* des Programmes (APP) under registration number                       */
00012 /* IDDN.FR.001.510008.00.S.P.2001.000.41200                             */
00013 /*                                                                      */
00014 /* This file may be distributed under the terms of the Q Public License */
00015 /* version 1.0 as defined by Trolltech AS of Norway and appearing in    */
00016 /* the file LICENSE.QPL included in the packaging of this file.         */
00017 /*                                                                      */
00018 /* Licensees holding valid specific licenses issued by INRIA, CNRS or   */
00019 /* Universite Rennes 1 for the software may use this file in            */
00020 /* acordance with that specific license                                 */
00021 /************************************************************************/
00022                 
00023 #if !defined OMK_III_ICONVERTORS_INL
00024 #define OMK_III_ICONVERTORS_INL
00025 
00026 #include "OMKIConvertor.h"
00027 #include "OMKParametersAccessor.inl"
00028 #include "OMKMultipleConfigurationParameter.h"
00029 
00030 namespace OMK  
00031 {
00032   namespace Iii
00033   {
00034 
00035 template< typename TypeOut, typename TypeIn >
00036 IConvertorT< TypeOut, TypeIn >* IConvertorT< TypeOut, TypeIn >::create( const ConfigurationParameterDescriptor* node ) 
00037 {
00038   IConvertorT< TypeOut, TypeIn >* convertor = 0 ;
00039   std::string convertorClassId ;
00040   const MultipleConfigurationParameter* convertorNode = dynamic_cast< const MultipleConfigurationParameter* >( node->getSubDescriptorByName( "Convertor" ) ) ;
00041   if( !convertorNode && ParametersAccessor::get( node, "Convertor", convertorClassId ) )
00042   {
00043     convertor = OBT::Singleton< ConvertorFactoryT< TypeOut, TypeIn > >::getInstance().create( convertorClassId )( node ) ;
00044     OMASSERTM( convertor, "Unable to create the convertor \"" << convertorClassId << "\", may be not registered !" ) ;
00045   }
00046   else if( convertorNode )
00047   { 
00048     if( ParametersAccessor::get( convertorNode, "Class", convertorClassId ) )
00049     {
00050       convertor = OBT::Singleton< ConvertorFactoryT< TypeOut, TypeIn > >::getInstance().create( convertorClassId )( convertorNode ) ;
00051       OMASSERTM( convertor, "Unable to create the convertor \"" << convertorClassId << "\", may be not registered !" ) ;
00052     }
00053     else
00054     {
00055       OMASSERTM( false, "Unable to create the convertor because the \"Class\" cannot be found in the \"Convertor\" node of" << std::endl << *node ) ;
00056     }
00057   }
00058   return convertor ;
00059 }
00060 
00061 
00062   }// namespace Iii
00063 }// namespace OMK
00064 
00065 #endif // defined OMK_III_ICONVERTORS_INL

logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007