From 0f557acd75718834b154220e782861bd3e3f5534 Mon Sep 17 00:00:00 2001 From: legrand Date: Thu, 17 Jan 2008 08:56:02 +0000 Subject: [PATCH] added peoPop inheriting from eoPop git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@891 331e1502-861f-0410-8da2-ba01fb791d7f --- trunk/paradiseo-peo/src/peoPop.h | 95 ++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 trunk/paradiseo-peo/src/peoPop.h diff --git a/trunk/paradiseo-peo/src/peoPop.h b/trunk/paradiseo-peo/src/peoPop.h new file mode 100644 index 000000000..9dee25cc9 --- /dev/null +++ b/trunk/paradiseo-peo/src/peoPop.h @@ -0,0 +1,95 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +//----------------------------------------------------------------------------- +// peoPop.h +// (c) GeNeura Team, 1998 +/* + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: todos@geneura.ugr.es, http://geneura.ugr.es + */ +//----------------------------------------------------------------------------- + +#ifndef _peoPop_H +#define _peoPop_H + +#include +#include +#include // needed for GCC 3.2 +#include + +// EO includes +#include // for eoInit +#include +#include +#include // for shuffle method + +#include + +//#include "core/eoPop_mesg.h" + +#include "core/eoVector_mesg.h" +#include "core/messaging.h" + + +template +class peoPop: public data, public eoPop +{ +public: + + virtual void pack () + { + std::cout << "[peoPop][pack]" << std::endl; + + //::pack((*this)); + ::pack ((unsigned) this->size ()); + for (unsigned i = 0; i < this->size (); i ++) + ::pack ((*this)[i]); + } + + virtual void unpack () + { + // ::unpack((*this)); + + unsigned n; + + ::unpack (n); + this->resize (n); + for (unsigned i = 0; i < n; i ++) + ::unpack ((*this)[i]); + } + +}; + +/* +template void pack (const peoPop & __pop) { + + pack ((unsigned) __pop.size ()); + for (unsigned i = 0; i < __pop.size (); i ++) + pack (__pop [i]); +} + +template void unpack (peoPop & __pop) { + + unsigned n; + + unpack (n); + __pop.resize (n); + for (unsigned i = 0; i < n; i ++) + unpack (__pop [i]); +} +*/ +#endif +