From f75ad83b078274c7c84abebdcff218daf73a8799 Mon Sep 17 00:00:00 2001 From: jhumeau Date: Mon, 9 Mar 2009 10:26:07 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1487 331e1502-861f-0410-8da2-ba01fb791d7f --- .../paradiseo-peo/src/peoPopEval.h | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/tags/paradiseo1.2/paradiseo-peo/src/peoPopEval.h b/tags/paradiseo1.2/paradiseo-peo/src/peoPopEval.h index bcc760940..258f7ea60 100644 --- a/tags/paradiseo1.2/paradiseo-peo/src/peoPopEval.h +++ b/tags/paradiseo1.2/paradiseo-peo/src/peoPopEval.h @@ -39,6 +39,8 @@ #include #include +#include +#include #include "core/messaging.h" #include "core/peo_debug.h" @@ -217,10 +219,56 @@ template< class EOT > void peoPopEval< EOT > :: packResult() template< class EOT > void peoPopEval< EOT > :: unpackResult() { typename EOT :: Fitness fit; - - /* Unpacking the computed fitness */ - unpack( fit ); - + /* Built in types : int, short, long int, long long int, + * unsigned int, unsigend short, unsigned long int, unsigned long long int, + * float, double, long double + */ + char types [11] = {'i','s','l','x','j','t','m','y', 'f', 'd','e'}; + const char* type = typeid(fit).name(); + int length = strlen(type); + int position = 18; + if ( length == 1) + { + position = 0; + length = 2; + } + if ( length > 1 && position < length) + { + if ( type[position] == types[0]) + { + int __fit; unpack( __fit );fit = __fit; + } + if ( type[position] == types[1]) + { + short int __fit; unpack( __fit );fit = __fit; + } + if ( type[position] == types[2]) + { + long int __fit; unpack( __fit );fit = __fit; + } + if ( type[position] == types[4]) + { + unsigned int __fit; unpack( __fit );fit = __fit; + } + if ( type[position] == types[5]) + { + unsigned short __fit; unpack( __fit );fit = __fit; + } + if ( type[position] == types[6]) + { + unsigned long __fit; unpack( __fit );fit = __fit; + } + if ( type[position] == types[8]) + { + float __fit; unpack( __fit );fit = __fit; + } + if ( type[position] == types[9]) + { + double __fit; unpack( __fit );fit = __fit; + } + } + + /* Unpacking the @ of the associated individual */ unpack( ad_sol );