OMKConvertors.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_CONVERTORS_INL
00024 #define OMK_III_CONVERTORS_INL
00025 
00026 // methods implementation
00027 #include "OMKConvertors.h"
00028 #include "OMKIConvertor.inl"
00029 
00030 namespace OMK  
00031 {
00032   namespace Iii
00033   {
00034 
00035 //=============================================================================
00036 // AverageT< Type >
00037 //=============================================================================
00038 
00039 template< typename Type >
00040 AverageT< Type >::AverageT( const ConfigurationParameterDescriptor* node ) 
00041 : IConvertorT< Type, std::vector< Type > >()
00042 {
00043 }
00044 //-----------------------------------------------------------------------------
00045 
00046 template< typename Type >
00047 AverageT< Type >::~AverageT() 
00048 {
00049 }
00050 //-----------------------------------------------------------------------------
00051 
00052 template< typename Type >
00053 void AverageT< Type >::convert( Type& value, const std::vector< Type >& values )
00054 {
00055   // average value of values
00056   Type tmp = 0.0f ;
00057   // The sum...
00058   for( size_t i = 0 ; i < values.size(); i++ ) 
00059   {
00060     tmp += values[ i ] ;
00061   }
00062   // ... to divide
00063   value = tmp / (float)values.size() ; 
00064 }
00065 
00066 //-----------------------------------------------------------------------------
00067 
00068 //=============================================================================
00069 // IntegratorT< Type >
00070 //=============================================================================
00071 
00072 template< typename Type >
00073 IntegratorT< Type >::IntegratorT( const ConfigurationParameterDescriptor* node ) 
00074 : IConvertorT< Type, Type >()
00075 {
00076 }
00077 
00078 //-----------------------------------------------------------------------------
00079 
00080 template< typename Type >
00081 IntegratorT< Type >::~IntegratorT() 
00082 {
00083 }
00084 //-----------------------------------------------------------------------------
00085 
00086 template< typename Type >
00087 void IntegratorT< Type >::convert( Type& value,  const Type& inc )
00088 {
00089   // increments the value
00090   value += inc ;
00091 }
00092 //-----------------------------------------------------------------------------
00093 
00094   }// namespace Iii
00095 }// namespace OMK
00096 
00097 #endif // defined OMK_III_CONVERTORS_INL

logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007