milena r1736: Work on conditional inheritance done

URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2008-02-18 Michel Pellegrin <pellegrin@lrde.epita.fr> Work on conditional inheritance done. * sandbox/pellegrin/cond_inheritance: Folder containing my work. * sandbox/pellegrin/cond_inheritance/Makefile: Compile the test. * sandbox/pellegrin/cond_inheritance/concept: New. * sandbox/pellegrin/cond_inheritance/concept/point_set.hh: New. * sandbox/pellegrin/cond_inheritance/internal: New. * sandbox/pellegrin/cond_inheritance/internal/multi_set.hh: New. * sandbox/pellegrin/cond_inheritance/internal/point_set_base.hh: New. * sandbox/pellegrin/cond_inheritance/internal/uni_set.hh: New. * sandbox/pellegrin/cond_inheritance/p_array.hh: Definition of a p_array. * sandbox/pellegrin/cond_inheritance/p_set.hh: Definition of a p_set. * sandbox/pellegrin/cond_inheritance/test_cond_inherit.cc: Test file. --- Makefile | 26 ++++++++++++ concept/point_set.hh | 72 +++++++++++++++++++++++++++++++++ internal/multi_set.hh | 72 +++++++++++++++++++++++++++++++++ internal/point_set_base.hh | 97 +++++++++++++++++++++++++++++++++++++++++++++ internal/uni_set.hh | 70 ++++++++++++++++++++++++++++++++ p_array.hh | 72 +++++++++++++++++++++++++++++++++ p_set.hh | 72 +++++++++++++++++++++++++++++++++ test_cond_inherit.cc | 61 ++++++++++++++++++++++++++++ 8 files changed, 542 insertions(+) Index: trunk/milena/sandbox/pellegrin/cond_inheritance/test_cond_inherit.cc =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/test_cond_inherit.cc (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/test_cond_inherit.cc (revision 1736) @@ -0,0 +1,61 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file sandbox/pellegrin/cond_inheritance/test_cond_inherit.cc + * + * \brief test my work on conditional inheritance. + */ + +#include <iostream> +#include <string> +#include <mln/core/image2d.hh> +#include <mln/io/pgm/load.hh> + +#include "p_set.hh" +#include "p_array.hh" + + +int main () +{ + //const std::string file ("../../../img/lena.pgm"); + //mln::image2d<mln::value::int_u8> I = mln::io::pgm::load (file); + //mln::image2d<mln::value::int_u8>::fwd_piter p (I.domain ()); + + //for_all (p) + //{ + //} + std::cout << __FILE__ << ": construction d'un objet p_array<int>" + << std::endl; + mln::p_array<int> int_array; + + std::cout << '\n' << __FILE__ << ": construction d'un objet p_set<int>" + << std::endl; + mln::p_set<int> int_set; + + std::cout << "\nEnd of test on conditional inheritance" << std::endl; +} + Index: trunk/milena/sandbox/pellegrin/cond_inheritance/p_set.hh =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/p_set.hh (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/p_set.hh (revision 1736) @@ -0,0 +1,72 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + + +#ifndef P_SET_HH +# define P_SET_HH + +/*! \file sandbox/pellegrin/cond_inheritance/p_set.hh + * + * \brief Definition of p_set class. + */ + +# include "internal/point_set_base.hh" + + +namespace mln +{ + + /*! \brief Point set class. + * + * This is a mathematical uni-set of points. The + * parameter \p P shall be a Point type. + * + * \todo All. + */ + template <typename E> + class p_set: public internal::point_set_base<p_set<E>, E> + { + public: + p_set (); + }; + +# ifndef MLN_INCLUDE_ONLY + + template <typename E> + inline + p_set<E>::p_set () + { + std::cout << " " << __FILE__ << ": constructeur mln::p_set<E>" + << std::endl; + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + + +#endif // ! P_SET_HH Index: trunk/milena/sandbox/pellegrin/cond_inheritance/concept/point_set.hh =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/concept/point_set.hh (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/concept/point_set.hh (revision 1736) @@ -0,0 +1,72 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + + +#ifndef POINT_SET_HH +# define POINT_SET_HH + +/*! \file sandbox/pellegrin/cond_inheritance/concept/point_set.hh + * + * \brief Definition of point_set class. + */ + +# include <iostream> +# include <vector> + + +namespace mln +{ + namespace concept + { + /*! \brief Point set class. + */ + template <typename E> + class point_set + { + std::vector<E> data; + protected: + point_set (); + }; + +# ifndef MLN_INCLUDE_ONLY + + template <typename E> + inline + point_set<E>::point_set () + { + std::cout << " " << __FILE__ + << ": constructeur mln::concept::point_set<E>" << std::endl; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace concept + +} // end of namespace mln + + +#endif // ! POINT_SET_HH Index: trunk/milena/sandbox/pellegrin/cond_inheritance/p_array.hh =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/p_array.hh (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/p_array.hh (revision 1736) @@ -0,0 +1,72 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + + +#ifndef P_ARRAY_HH +# define P_ARRAY_HH + +/*! \file sandbox/pellegrin/cond_inheritance/p_array.hh + * + * \brief Definition of p_array class. + */ + +# include "internal/point_set_base.hh" + + +namespace mln +{ + + /*! \brief Point set class. + * + * This is a mathematical multi-set of points. The + * parameter \p P shall be a Point type. + * + * \todo All. + */ + template <typename E> + class p_array : public internal::point_set_base<p_array<E>, E> + { + public: + p_array (); + }; + +# ifndef MLN_INCLUDE_ONLY + + template <typename E> + inline + p_array<E>::p_array () + { + std::cout << " " << __FILE__ << ": constructeur mln::p_array<E>" + << std::endl; + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + + +#endif // ! P_ARRAY_HH Index: trunk/milena/sandbox/pellegrin/cond_inheritance/internal/multi_set.hh =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/internal/multi_set.hh (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/internal/multi_set.hh (revision 1736) @@ -0,0 +1,72 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + + +#ifndef MULTI_SET_HH +# define MULTI_SET_HH + +/*! \file sandbox/pellegrin/cond_inheritance/internal/multi_set.hh + * + * \brief Definition of multi_set class. + */ + +# include <iostream> + +# include "concept/point_set.hh" + + +namespace mln +{ + namespace internal + { + /*! \brief Multi set class. + */ + template <typename E> + class multi_set: public concept::point_set<E> + { + protected: + multi_set (); + }; + +# ifndef MLN_INCLUDE_ONLY + + template <typename E> + inline + multi_set<E>::multi_set () + { + std::cout << " " << __FILE__ + << ": constructeur mln::internal::multi_set<E>" << std::endl; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace internal + +} // end of namespace mln + + +#endif // ! MULTI_SET_HH Index: trunk/milena/sandbox/pellegrin/cond_inheritance/internal/uni_set.hh =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/internal/uni_set.hh (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/internal/uni_set.hh (revision 1736) @@ -0,0 +1,70 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + + +#ifndef UNI_SET_HH +# define UNI_SET_HH + +/*! \file sandbox/pellegrin/cond_inheritance/internal/uni_set.hh + * + * \brief Definition of uni_set class. + */ + +# include "concept/point_set.hh" + + +namespace mln +{ + namespace internal + { + /*! \brief Uni set class. + */ + template <typename E> + class uni_set: public concept::point_set<E> + { + protected: + uni_set (); + }; + +# ifndef MLN_INCLUDE_ONLY + + template <typename E> + inline + uni_set<E>::uni_set () + { + std::cout << " " << __FILE__ + << ": constructeur mln::internal::uni_set<E>" << std::endl; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace internal + +} // end of namespace mln + + +#endif // ! UNI_SET_HH Index: trunk/milena/sandbox/pellegrin/cond_inheritance/internal/point_set_base.hh =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/internal/point_set_base.hh (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/internal/point_set_base.hh (revision 1736) @@ -0,0 +1,97 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + + +#ifndef POINT_SET_BASE_HH +# define POINT_SET_BASE_HH + +/*! \file sandbox/pellegrin/cond_inheritance/internal/point_set_base.hh + * + * \brief Definition of point_set_base class. + */ + +# include "internal/uni_set.hh" +# include "internal/multi_set.hh" + + +namespace mln +{ + // fwd declaration + template <typename E> + class p_set; + template <typename E> + class p_array; + + namespace internal + { + /*! \brief Point set base class. + */ + template <typename T, typename E> + class point_set_base; + + template <typename E> + class point_set_base<p_set<E>, E>: public uni_set<E> + { + protected: + point_set_base (); + }; + + template <typename E> + class point_set_base<p_array<E>, E>: public multi_set<E> + { + protected: + point_set_base (); + }; + +# ifndef MLN_INCLUDE_ONLY + + template <typename E> + inline + point_set_base<p_set<E>, E>::point_set_base () + { + std::cout << " " << __FILE__ + << ": constructeur mln::internal::point_set_base<p_set<E>, E>" + << std::endl; + } + + template <typename E> + inline + point_set_base<p_array<E>, E>::point_set_base () + { + std::cout << " " << __FILE__ + << ": constructeur " + "mln::internal::point_set_base<p_array<E>, E>" + << std::endl; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace internal + +} // end of namespace mln + +#endif // ! POINT_SET_BASE_HH Index: trunk/milena/sandbox/pellegrin/cond_inheritance/Makefile =================================================================== --- trunk/milena/sandbox/pellegrin/cond_inheritance/Makefile (revision 0) +++ trunk/milena/sandbox/pellegrin/cond_inheritance/Makefile (revision 1736) @@ -0,0 +1,26 @@ +All_warnings = -ansi -pedantic -Wabi -Wctor-dtor-privacy -Wnon-virtual-dtor \ + -Wreorder -Weffc++ -Wno-deprecated -Wstrict-null-sentinel \ + -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual \ + -Wno-pmf-conversions -Wsign-promo -fsyntax-only-pedantic-errors \ + -w -Wextra -Wall -Waddress -Waggregate-return -Wno-attributes \ + -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion \ + -Wno-deprecated-declarations -Wdisabled-optimization -Wno-div-by-zero \ + -Wno-endif-labels -Werror -Wfatal-errors -Wfloat-equal -Wformat \ + -Wformat=2 -Wno-format-extra-args -Wformat-nonliteral \ + -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Wno-import \ + -Winit-self -Winline -Wno-invalid-offsetof -Winvalid-pch \ + -Wlarger-than-1 -Wunsafe-loop-optimizations -Wlong-long \ + -Wmissing-braces -Wmissing-field-initializers \ + -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn \ + -Wno-multichar -Wno-overflow -Woverlength-strings -Wpacked -Wpadded \ + -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type \ + -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector \ + -Wstrict-aliasing -Wstrict-overflow -Wswitch -Wswitch-default \ + -Wswitch-enum -Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized \ + -Wunknown-pragmas -Wno-pragmas -Wunreachable-code -Wunused \ + -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value \ + -Wunused-variable -Wvariadic-macros -Wvolatile-register-var \ + -Wwrite-strings \ + +all: + g++-4.2 -ansi -pedantic -I../../.. -I. test_cond_inherit.cc -o test
participants (1)
-
Michel Pellegrin