From 10ef92ed601bc66db4c5392dcaa6df608ccc6567 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 12:00:08 +0200 Subject: [PATCH 1/8] * eoParserLogger.h: added editor parameters header --- eo/src/utils/eoParserLogger.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eo/src/utils/eoParserLogger.h b/eo/src/utils/eoParserLogger.h index 48cb53ec..5486fe13 100644 --- a/eo/src/utils/eoParserLogger.h +++ b/eo/src/utils/eoParserLogger.h @@ -1,3 +1,5 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + /* (c) Thales group, 2010 @@ -17,7 +19,7 @@ Contact: http://eodev.sourceforge.net Authors: - Johann Dréo + Johann Dréo Caner Candan */ From e103f4f29e88ee6000c7610d8603c3f3fd4fe51d Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 12:06:54 +0200 Subject: [PATCH 2/8] * eoLogger.h: indentation --- eo/src/utils/eoLogger.h | 63 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/eo/src/utils/eoLogger.h b/eo/src/utils/eoLogger.h index 11b0cbee..c9b85060 100644 --- a/eo/src/utils/eoLogger.h +++ b/eo/src/utils/eoLogger.h @@ -40,7 +40,7 @@ Caner Candan { // We are declaring first an overload of eoParser class using Logger // component. - eoParserLogger parser(ac, av); + eoParserLogger parser(ac, av); // This call is important to allow -v parameter to change user level. make_verbose(parser); @@ -98,7 +98,7 @@ Caner Candan # include "eoObject.h" -namespace eo +namespace eo { /** * Levels contents all the available levels in eoLogger @@ -117,7 +117,7 @@ namespace eo * file * this structure combined with the friend operator<< below is an easy way to select a file as output. */ - struct file + struct file { file(const std::string f); const std::string _f; @@ -127,7 +127,7 @@ namespace eo * setlevel * this structure combined with the friend operator<< below is an easy way to set a verbose level. */ - struct setlevel + struct setlevel { setlevel(const std::string v); setlevel(const Levels lvl); @@ -141,14 +141,14 @@ namespace eo * Class providing a verbose management through EO * Use of a global variable eo::log to easily use the logger like std::cout */ -class eoLogger : public eoObject, - public std::ostream +class eoLogger : public eoObject, + public std::ostream { public: eoLogger(); ~eoLogger(); - virtual std::string className() const; + virtual std::string className() const; //! Print the available levels on the standard output void printLevels() const; @@ -158,107 +158,104 @@ public: * Use this function if you want to be able to compare selected levels to a given one, like: * if( eo::log.getLevelSelected() >= eo::progress ) {...} */ - eo::Levels getLevelSelected() const { return _selectedLevel; } + inline eo::Levels getLevelSelected() const { return _selectedLevel; } /*! Returns the current level of the context * the one given when you output message with the logger */ - eo::Levels getLevelContext() const { return _contextLevel; } + inline eo::Levels getLevelContext() const { return _contextLevel; } protected: - void addLevel(std::string name, eo::Levels level); + void addLevel(std::string name, eo::Levels level); private: /** * outbuf * this class inherits from std::streambuf which is used by eoLogger to write the buffer in an output stream */ - class outbuf : public std::streambuf + class outbuf : public std::streambuf { public: - outbuf(const int& fd, - const eo::Levels& contexlvl, - const eo::Levels& selectedlvl); + outbuf(const int& fd, const eo::Levels& contexlvl, const eo::Levels& selectedlvl); protected: - virtual int overflow(int_type c); + virtual int overflow(int_type c); private: - const int& _fd; - const eo::Levels& _contextLevel; - const eo::Levels& _selectedLevel; + const int& _fd; + const eo::Levels& _contextLevel; + const eo::Levels& _selectedLevel; }; private: /** * MapLevel is the type used by the map member _levels. */ - typedef std::map MapLevel; + typedef std::map MapLevel; public: /** * operator<< used there to set a verbose mode. */ - friend eoLogger& operator<<(eoLogger&, const eo::Levels); + friend eoLogger& operator<<(eoLogger&, const eo::Levels); /** * operator<< used there to set a filename through the class file. */ - friend eoLogger& operator<<(eoLogger&, eo::file); + friend eoLogger& operator<<(eoLogger&, eo::file); /** * operator<< used there to set a verbose level through the class setlevel. */ - friend eoLogger& operator<<(eoLogger&, eo::setlevel); + friend eoLogger& operator<<(eoLogger&, eo::setlevel); /** * operator<< used there to be able to use std::cout to say that we wish to redirect back the buffer to a standard output. */ - friend eoLogger& operator<<(eoLogger&, std::ostream&); + friend eoLogger& operator<<(eoLogger&, std::ostream&); private: /** * _selectedLevel is the member storing verbose level setted by the user thanks to operator() */ - eo::Levels _selectedLevel; - eo::Levels _contextLevel; + eo::Levels _selectedLevel; + eo::Levels _contextLevel; /** * _fd in storing the file descriptor at this place we can disable easily the buffer in * changing the value at -1. It is used by operator <<. */ - int _fd; + int _fd; /** * _obuf std::ostream mandates to use a buffer. _obuf is a outbuf inheriting of std::streambuf. */ - outbuf _obuf; + outbuf _obuf; /** * _levels contains all the existing level order by position */ - MapLevel _levels; + MapLevel _levels; /** * _levelsOrder is just a list to keep the order of levels */ - std::vector _sortedLevels; + std::vector _sortedLevels; /** * _standard_io_streams */ - std::map< std::ostream*, int > _standard_io_streams; + std::map< std::ostream*, int > _standard_io_streams; }; /** @example t-eoLogger.cpp */ -namespace eo +namespace eo { /** * log is an external global variable defined to easily use a same way than std::cout to write a log. */ - extern eoLogger log; + extern eoLogger log; } - /** @} */ #endif // !eoLogger_h From 7d9151e2f4a2b9120861aed6f4e0e48ec06cc746 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 14:47:35 +0200 Subject: [PATCH 3/8] ticker #11 fixed: Merge eoParser and eoParserLogger --- eo/src/utils/CMakeLists.txt | 36 +++++++------- eo/src/utils/eoLogger.cpp | 85 ++++++++++++++++++++++++++------- eo/src/utils/eoLogger.h | 27 +++++++---- eo/src/utils/eoParserLogger.cpp | 80 ------------------------------- eo/src/utils/eoParserLogger.h | 64 ------------------------- 5 files changed, 103 insertions(+), 189 deletions(-) delete mode 100644 eo/src/utils/eoParserLogger.cpp delete mode 100644 eo/src/utils/eoParserLogger.h diff --git a/eo/src/utils/CMakeLists.txt b/eo/src/utils/CMakeLists.txt index 94f994d2..010c6d41 100644 --- a/eo/src/utils/CMakeLists.txt +++ b/eo/src/utils/CMakeLists.txt @@ -12,24 +12,24 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET(EOUTILS_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib) SET(LIBRARY_OUTPUT_PATH ${EOUTILS_LIB_OUTPUT_PATH}) -SET (EOUTILS_SOURCES eoData.cpp - eoFileMonitor.cpp - eoGnuplot.cpp - eoGnuplot1DMonitor.cpp - eoGnuplot1DSnapshot.cpp - eoIntBounds.cpp - eoParser.cpp - eoRealBounds.cpp - eoRNG.cpp - eoState.cpp - eoOStreamMonitor.cpp - eoUpdater.cpp - make_help.cpp - pipecom.cpp - eoLogger.cpp - eoParserLogger.cpp - eoParallel.cpp) - +SET(EOUTILS_SOURCES + eoData.cpp + eoFileMonitor.cpp + eoGnuplot.cpp + eoGnuplot1DMonitor.cpp + eoGnuplot1DSnapshot.cpp + eoIntBounds.cpp + eoParser.cpp + eoRealBounds.cpp + eoRNG.cpp + eoState.cpp + eoOStreamMonitor.cpp + eoUpdater.cpp + make_help.cpp + pipecom.cpp + eoLogger.cpp + eoParallel.cpp + ) ADD_LIBRARY(eoutils STATIC ${EOUTILS_SOURCES}) INSTALL(TARGETS eoutils ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/eo/src/utils/eoLogger.cpp b/eo/src/utils/eoLogger.cpp index b3002f46..1a486459 100644 --- a/eo/src/utils/eoLogger.cpp +++ b/eo/src/utils/eoLogger.cpp @@ -37,19 +37,20 @@ Authors: #include // used to define EOF #include -#include -#include -#include -#include #include "eoLogger.h" -eoLogger eo::log; +eoLogger::eoLogger() : + std::ostream(&_obuf), -eoLogger::eoLogger() - : std::ostream(&_obuf), - _selectedLevel(eo::progress), _contextLevel(eo::quiet), - _fd(2), _obuf(_fd, _contextLevel, _selectedLevel) + _verbose("quiet", "verbose", "Set the verbose level", 'v'), + _printVerboseLevels(false, "print-verbose-levels", "Print verbose levels", 'l'), + _output("", "output", "Redirect a standard output to a file", 'o'), + + _selectedLevel(eo::progress), + _contextLevel(eo::quiet), + _fd(2), + _obuf(_fd, _contextLevel, _selectedLevel) { _standard_io_streams[&std::cout] = 1; _standard_io_streams[&std::clog] = 2; @@ -71,18 +72,56 @@ eoLogger::~eoLogger() if (_fd > 2) { ::close(_fd); } } -std::string eoLogger::className() const +void eoLogger::_createParameters( eoParser& parser ) +{ + //------------------------------------------------------------------ + // we are saying to eoParser to create the parameters created above. + //------------------------------------------------------------------ + + std::string section("Logger"); + parser.processParam(_verbose, section); + parser.processParam(_printVerboseLevels, section); + parser.processParam(_output, section); + + //------------------------------------------------------------------ + + + //------------------------------------------------------------------ + // we're gonna redirect the log to the given filename if -o is used. + //------------------------------------------------------------------ + + if ( ! _output.value().empty() ) + { + eo::log << eo::file( _output.value() ); + } + + //------------------------------------------------------------------ + + + //------------------------------------------------------------------ + // // we're gonna print the list of levels if -l parameter is used. + //------------------------------------------------------------------ + + if ( _printVerboseLevels.value() ) + { + eo::log.printLevels(); + } + + //------------------------------------------------------------------ +} + +std::string eoLogger::className() const { return ("eoLogger"); } -void eoLogger::addLevel(std::string name, eo::Levels level) +void eoLogger::addLevel(std::string name, eo::Levels level) { _levels[name] = level; _sortedLevels.push_back(name); } -void eoLogger::printLevels() const +void eoLogger::printLevels() const { std::cout << "Available verbose levels:" << std::endl; @@ -95,25 +134,25 @@ void eoLogger::printLevels() const ::exit(0); } -eoLogger& operator<<(eoLogger& l, const eo::Levels lvl) +eoLogger& operator<<(eoLogger& l, const eo::Levels lvl) { l._contextLevel = lvl; return l; } -eoLogger& operator<<(eoLogger& l, eo::file f) +eoLogger& operator<<(eoLogger& l, eo::file f) { l._fd = ::open(f._f.c_str(), O_WRONLY | O_APPEND | O_CREAT, 0644); return l; } -eoLogger& operator<<(eoLogger& l, eo::setlevel v) +eoLogger& operator<<(eoLogger& l, eo::setlevel v) { l._selectedLevel = (v._lvl < 0 ? l._levels[v._v] : v._lvl); return l; } -eoLogger& operator<<(eoLogger& l, std::ostream& os) +eoLogger& operator<<(eoLogger& l, std::ostream& os) { if (l._standard_io_streams.find(&os) != l._standard_io_streams.end()) { @@ -128,7 +167,7 @@ eoLogger::outbuf::outbuf(const int& fd, : _fd(fd), _contextLevel(contexlvl), _selectedLevel(selectedlvl) {} -int eoLogger::outbuf::overflow(int_type c) +int eoLogger::outbuf::overflow(int_type c) { if (_selectedLevel >= _contextLevel) { @@ -141,7 +180,7 @@ int eoLogger::outbuf::overflow(int_type c) return c; } -namespace eo +namespace eo { file::file(const std::string f) : _f(f) @@ -155,3 +194,13 @@ namespace eo : _v(std::string("")), _lvl(lvl) {} } + +//! make_verbose gets level of verbose and sets it in eoLogger +void make_verbose(eoParser& parser) +{ + eo::log._createParameters( parser ); + + eo::log << eo::setlevel(eo::log._verbose.value()); +} + +eoLogger eo::log; diff --git a/eo/src/utils/eoLogger.h b/eo/src/utils/eoLogger.h index c9b85060..9e13e965 100644 --- a/eo/src/utils/eoLogger.h +++ b/eo/src/utils/eoLogger.h @@ -34,13 +34,13 @@ Caner Candan \code #include #include - #include + #include int main(int ac, char** av) { // We are declaring first an overload of eoParser class using Logger // component. - eoParserLogger parser(ac, av); + eoParser parser(ac, av); // This call is important to allow -v parameter to change user level. make_verbose(parser); @@ -88,15 +88,15 @@ Caner Candan */ #ifndef eoLogger_h -# define eoLogger_h +#define eoLogger_h -# include -# include -# include -# include - -# include "eoObject.h" +#include +#include +#include +#include +#include "eoObject.h" +#include "eoParser.h" namespace eo { @@ -168,6 +168,9 @@ public: protected: void addLevel(std::string name, eo::Levels level); +private: + void _createParameters( eoParser& ); + private: /** * outbuf @@ -213,6 +216,12 @@ public: friend eoLogger& operator<<(eoLogger&, std::ostream&); private: + friend void make_verbose(eoParser&); + + eoValueParam _verbose; + eoValueParam _printVerboseLevels; + eoValueParam _output; + /** * _selectedLevel is the member storing verbose level setted by the user thanks to operator() */ diff --git a/eo/src/utils/eoParserLogger.cpp b/eo/src/utils/eoParserLogger.cpp deleted file mode 100644 index df70589a..00000000 --- a/eo/src/utils/eoParserLogger.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - -(c) Thales group, 2010 - - 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; version 2 of the license. - - 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: http://eodev.sourceforge.net - -Authors: -Johann Dreo -Caner Candan - -*/ - -#include "eoParserLogger.h" - -eoParserLogger::eoParserLogger(unsigned _argc, char** _argv, - std::string _programDescription /*= ""*/ - , - std::string _lFileParamName /*= "param-file"*/, - char _shortHand /*= 'p'*/) - : eoParser(_argc, _argv, _programDescription, _lFileParamName, _shortHand), - _verbose("quiet", "verbose", "Set the verbose level", 'v'), - _printVerboseLevels(false, "print-verbose-levels", "Print verbose levels", 'l'), - _output("", "output", "Redirect a standard output to a file", 'o') -{ - //------------------------------------------------------------------ - // we are saying to eoParser to create the parameters created above. - //------------------------------------------------------------------ - - processParam(_verbose); - processParam(_printVerboseLevels); - processParam(_output); - - //------------------------------------------------------------------ - - - //------------------------------------------------------------------ - // we're gonna redirect the log to the given filename if -o is used. - //------------------------------------------------------------------ - - if ( ! _output.value().empty() ) - { - eo::log << eo::file( _output.value() ); - } - - //------------------------------------------------------------------ - - - //------------------------------------------------------------------ - // // we're gonna print the list of levels if -l parameter is used. - //------------------------------------------------------------------ - - if ( _printVerboseLevels.value() ) - { - eo::log.printLevels(); - } - - //------------------------------------------------------------------ - -} - -eoParserLogger::~eoParserLogger() -{} - -//! make_verbose gets level of verbose and sets it in eoLogger -void make_verbose(eoParserLogger& _parser) -{ - eo::log << eo::setlevel(_parser._verbose.value()); -} diff --git a/eo/src/utils/eoParserLogger.h b/eo/src/utils/eoParserLogger.h deleted file mode 100644 index 5486fe13..00000000 --- a/eo/src/utils/eoParserLogger.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- - -/* - -(c) Thales group, 2010 - - 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; version 2 of the license. - - 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: http://eodev.sourceforge.net - -Authors: - Johann Dréo - Caner Candan -*/ - -#ifndef EO_PARSER_LOGGER_H -#define EO_PARSER_LOGGER_H - -#include "eoParser.h" -#include "eoLogger.h" - -/** - * A parser that use the advanced logging system (@see eoLogger) - * - * @ingroup Parameters - * @ingroup Logging - */ -class eoParserLogger : public eoParser -{ -public: - eoParserLogger(unsigned _argc, char** _argv, - std::string _programDescription = "", - std::string _lFileParamName = "param-file", - char _shortHand = 'p'); - ~eoParserLogger(); - -private: - friend void make_verbose(eoParserLogger&); - eoValueParam _verbose; - eoValueParam _printVerboseLevels; - eoValueParam _output; -}; - -void make_verbose(eoParserLogger&); - -#endif // !EO_PARSER_LOGGER_H - -// Local Variables: -// coding: iso-8859-1 -// mode: C++ -// c-file-offsets: ((c . 0)) -// c-file-style: "Stroustrup" -// fill-column: 80 -// End: From e2c833e23ecf434422db74b8eeed437e40b21bb2 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 14:49:42 +0200 Subject: [PATCH 4/8] * eoLogger: replaced _INTERIX by _WIN32 in order to use io.h header --- eo/src/utils/eoLogger.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eo/src/utils/eoLogger.cpp b/eo/src/utils/eoLogger.cpp index 1a486459..1dfcc2ea 100644 --- a/eo/src/utils/eoLogger.cpp +++ b/eo/src/utils/eoLogger.cpp @@ -26,11 +26,11 @@ Authors: */ -#ifdef _INTERIX +#ifdef _WIN32 #include -#else // _INTERIX +#else // _WIN32 #include -#endif // ! _INTERIX +#endif // ! _WIN32 #include #include From f27b5149eea8d20b6a5ea6f9ef60916216d1145c Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 14:52:24 +0200 Subject: [PATCH 5/8] a small update on build tutorial script file --- eo/build_gcc_linux_tutorial | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/build_gcc_linux_tutorial b/eo/build_gcc_linux_tutorial index f4168fd3..2908e875 100755 --- a/eo/build_gcc_linux_tutorial +++ b/eo/build_gcc_linux_tutorial @@ -1,6 +1,6 @@ #!/usr/bin/env sh -mkdir release +mkdir -p release cd release cmake -DENABLE_EO_TUTORIAL=1 .. make From 83413762477b45c21817f2f80163392b6311c828 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 14:56:47 +0200 Subject: [PATCH 6/8] * eoLogger: replaced ssize_t to size_t fixing compatibility issue on Windows --- eo/src/utils/eoLogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/utils/eoLogger.cpp b/eo/src/utils/eoLogger.cpp index 1dfcc2ea..39107612 100644 --- a/eo/src/utils/eoLogger.cpp +++ b/eo/src/utils/eoLogger.cpp @@ -173,7 +173,7 @@ int eoLogger::outbuf::overflow(int_type c) { if (_fd >= 0 && c != EOF) { - ssize_t num; + size_t num; num = ::write(_fd, &c, 1); } } From e8f6c5f21b51f51ba73f57ac2197078205fd9d1b Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 15:28:41 +0200 Subject: [PATCH 7/8] * indentation, whitespace cleanup --- eo/src/apply.h | 8 ++++---- eo/src/es/CMakeLists.txt | 42 +++++++++++++++++++++------------------- eo/src/ga/CMakeLists.txt | 18 ++++++++--------- eo/src/gp/CMakeLists.txt | 1 - 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/eo/src/apply.h b/eo/src/apply.h index 4c09e685..23a52245 100644 --- a/eo/src/apply.h +++ b/eo/src/apply.h @@ -3,7 +3,7 @@ //----------------------------------------------------------------------------- // eoApply.h // (c) Maarten Keijzer 2000 -/* +/* 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 @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: todos@geneura.ugr.es, http://geneura.ugr.es - mak@dhi.dk + mak@dhi.dk */ //----------------------------------------------------------------------------- @@ -94,7 +94,7 @@ void omp_apply(eoUF& _proc, std::vector& _pop) //default(none) shared(_proc, _pop, size) for (size_t i = 0; i < size; ++i) { - _proc(_pop[i]); + _proc(_pop[i]); } } @@ -112,7 +112,7 @@ void omp_dynamic_apply(eoUF& _proc, std::vector& _pop) //default(none) shared(_proc, _pop, size) for (size_t i = 0; i < size; ++i) { - _proc(_pop[i]); + _proc(_pop[i]); } } diff --git a/eo/src/es/CMakeLists.txt b/eo/src/es/CMakeLists.txt index e7b24901..9b052413 100644 --- a/eo/src/es/CMakeLists.txt +++ b/eo/src/es/CMakeLists.txt @@ -14,26 +14,29 @@ SET(CMA_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib) SET(LIBRARY_OUTPUT_PATH ${ES_LIB_OUTPUT_PATH}) # the same output for the two libs -SET (ES_SOURCES make_algo_scalar_es.cpp - make_algo_scalar_real.cpp - make_checkpoint_es.cpp - make_checkpoint_real.cpp - make_continue_es.cpp - make_continue_real.cpp - make_genotype_es.cpp - make_genotype_real.cpp - make_op_es.cpp - make_op_real.cpp - make_pop_es.cpp - make_pop_real.cpp - make_run_es.cpp - make_run_real.cpp) - -SET (CMA_SOURCES eig.cpp - CMAState.cpp - CMAParams.cpp) +SET(ES_SOURCES + make_algo_scalar_es.cpp + make_algo_scalar_real.cpp + make_checkpoint_es.cpp + make_checkpoint_real.cpp + make_continue_es.cpp + make_continue_real.cpp + make_genotype_es.cpp + make_genotype_real.cpp + make_op_es.cpp + make_op_real.cpp + make_pop_es.cpp + make_pop_real.cpp + make_run_es.cpp + make_run_real.cpp + ) + +SET(CMA_SOURCES + eig.cpp + CMAState.cpp + CMAParams.cpp + ) - ADD_LIBRARY(es STATIC ${ES_SOURCES}) INSTALL(TARGETS es ARCHIVE DESTINATION lib COMPONENT libraries) @@ -54,4 +57,3 @@ SET(CMA_VERSION ${GLOBAL_VERSION}) SET_TARGET_PROPERTIES(cma PROPERTIES VERSION "${CMA_VERSION}") ###################################################################################### - diff --git a/eo/src/ga/CMakeLists.txt b/eo/src/ga/CMakeLists.txt index 7d048b6c..a463735c 100644 --- a/eo/src/ga/CMakeLists.txt +++ b/eo/src/ga/CMakeLists.txt @@ -12,14 +12,15 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET(GA_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib) SET(LIBRARY_OUTPUT_PATH ${GA_LIB_OUTPUT_PATH}) -SET (GA_SOURCES make_algo_scalar_ga.cpp - make_checkpoint_ga.cpp - make_continue_ga.cpp - make_genotype_ga.cpp - make_op_ga.cpp - make_pop_ga.cpp - make_run_ga.cpp) - +SET(GA_SOURCES + make_algo_scalar_ga.cpp + make_checkpoint_ga.cpp + make_continue_ga.cpp + make_genotype_ga.cpp + make_op_ga.cpp + make_pop_ga.cpp + make_run_ga.cpp + ) ADD_LIBRARY(ga STATIC ${GA_SOURCES}) INSTALL(TARGETS ga ARCHIVE DESTINATION lib COMPONENT libraries) @@ -35,4 +36,3 @@ SET(GA_VERSION ${GLOBAL_VERSION}) SET_TARGET_PROPERTIES(ga PROPERTIES VERSION "${GA_VERSION}") ###################################################################################### - diff --git a/eo/src/gp/CMakeLists.txt b/eo/src/gp/CMakeLists.txt index c0ae8aff..44195d5f 100644 --- a/eo/src/gp/CMakeLists.txt +++ b/eo/src/gp/CMakeLists.txt @@ -1,3 +1,2 @@ FILE(GLOB HDRS *.h) INSTALL(FILES ${HDRS} DESTINATION include/eo/gp COMPONENT headers) - From 25f675bac2c9a9affe10c43abb406fd22c046341 Mon Sep 17 00:00:00 2001 From: Caner Candan Date: Wed, 11 May 2011 15:29:29 +0200 Subject: [PATCH 8/8] * eoLogger: last issues fixed --- eo/src/eo | 41 ++++++++++++++++++++--------------------- eo/src/utils/eoLogger.h | 11 +++++------ eo/test/t-eoLogger.cpp | 8 ++------ eo/test/t-openmp.cpp | 5 +---- 4 files changed, 28 insertions(+), 37 deletions(-) diff --git a/eo/src/eo b/eo/src/eo index 18e91d60..8cebd23a 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -1,7 +1,7 @@ //----------------------------------------------------------------------------- // eo // (c) GeNeura Team 1998 - 2000 -/* +/* 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 @@ -23,7 +23,7 @@ #ifdef _MSC_VER // to avoid long name warnings #pragma warning(disable:4786) -#endif +#endif #ifndef _eo_ #define _eo_ @@ -62,7 +62,7 @@ // combinations of simple eoOps (eoMonOp and eoQuadOp) #include // didactic (mimics SGA-like variation into an eoGenOp) -// calls crossover and mutation sequentially, +// calls crossover and mutation sequentially, // with their respective mutation rates #include // its dual: crossover, mutation (and copy) - proportional choice @@ -100,7 +100,7 @@ #include #include #include -// Embedding truncation selection +// Embedding truncation selection #include // the batch selection - from an eoSelectOne @@ -165,45 +165,44 @@ // velocities #include #include -#include -#include +#include +#include #include #include #include -#include +#include // flights #include -#include +#include #include -#include -#include +#include +#include // topologies #include #include #include #include -#include -#include - -// PS algorithms -#include -#include -#include +#include +#include + +// PS algorithms +#include +#include +#include // utils #include #include #include #include -#include - -#include +#include +#include #include -#endif +#endif // Local Variables: // mode: C++ diff --git a/eo/src/utils/eoLogger.h b/eo/src/utils/eoLogger.h index 9e13e965..50369d35 100644 --- a/eo/src/utils/eoLogger.h +++ b/eo/src/utils/eoLogger.h @@ -32,14 +32,11 @@ Caner Candan Here's an example explaning how to use eoLogger: \code - #include - #include - #include + #include int main(int ac, char** av) { - // We are declaring first an overload of eoParser class using Logger - // component. + // We are declaring the usual eoParser class eoParser parser(ac, av); // This call is important to allow -v parameter to change user level. @@ -216,7 +213,7 @@ public: friend eoLogger& operator<<(eoLogger&, std::ostream&); private: - friend void make_verbose(eoParser&); + friend void make_verbose(eoParser&); eoValueParam _verbose; eoValueParam _printVerboseLevels; @@ -257,6 +254,8 @@ private: /** @example t-eoLogger.cpp */ +void make_verbose(eoParser&); + namespace eo { /** diff --git a/eo/test/t-eoLogger.cpp b/eo/test/t-eoLogger.cpp index c087e2a2..198a8872 100644 --- a/eo/test/t-eoLogger.cpp +++ b/eo/test/t-eoLogger.cpp @@ -2,17 +2,13 @@ // t-eoLogger.cpp //----------------------------------------------------------------------------- -#include -#include -#include - #include //----------------------------------------------------------------------------- -int main(int ac, char** av) +int main(int ac, char** av) { - eoParserLogger parser(ac, av); + eoParser parser(ac, av); if (parser.userNeedsHelp()) { diff --git a/eo/test/t-openmp.cpp b/eo/test/t-openmp.cpp index cd345080..a1d68087 100644 --- a/eo/test/t-openmp.cpp +++ b/eo/test/t-openmp.cpp @@ -32,9 +32,6 @@ Caner Candan #include #include -#include -#include - #include #include @@ -114,7 +111,7 @@ void measure( size_t p, int main(int ac, char** av) { - eoParserLogger parser(ac, av); + eoParser parser(ac, av); unsigned int popMin = parser.getORcreateParam((unsigned int)1, "popMin", "Population Min", 'p', "Evolution Engine").value(); unsigned int popStep = parser.getORcreateParam((unsigned int)1, "popStep", "Population Step", 0, "Evolution Engine").value();