[PATCH 3/7] Add a tautology and an antilogy p2b functors.

* mln/fun/p2b/tautology.hh, * mln/fun/p2b/antilogy.hh: New files. Include them... * mln/fun/p2b/all.hh: ...here. --- milena/ChangeLog | 10 +++++ milena/mln/fun/p2b/all.hh | 5 ++- milena/mln/fun/p2b/{all.hh => antilogy.hh} | 51 +++++++++++++++++++------- milena/mln/fun/p2b/{all.hh => tautology.hh} | 51 +++++++++++++++++++------- 4 files changed, 88 insertions(+), 29 deletions(-) copy milena/mln/fun/p2b/{all.hh => antilogy.hh} (57%) copy milena/mln/fun/p2b/{all.hh => tautology.hh} (57%) diff --git a/milena/ChangeLog b/milena/ChangeLog index fb1e5da..b637f0a 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,15 @@ 2009-04-07 Roland Levillain <roland@lrde.epita.fr> + Add a tautology and an antilogy p2b functors. + + * mln/fun/p2b/tautology.hh, + * mln/fun/p2b/antilogy.hh: + New files. + Include them... + * mln/fun/p2b/all.hh: ...here. + +2009-04-07 Roland Levillain <roland@lrde.epita.fr> + Add minima simplification to apps/statues/mesh-complex-skel. * apps/statues/mesh-complex-skel.cc (main): Take the second diff --git a/milena/mln/fun/p2b/all.hh b/milena/mln/fun/p2b/all.hh index ed6e926..e1c75f3 100644 --- a/milena/mln/fun/p2b/all.hh +++ b/milena/mln/fun/p2b/all.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -51,6 +52,8 @@ namespace mln # include <mln/fun/p2b/chess.hh> # include <mln/fun/p2b/has.hh> +# include <mln/fun/p2b/tautology.hh> +# include <mln/fun/p2b/antilogy.hh> diff --git a/milena/mln/fun/p2b/all.hh b/milena/mln/fun/p2b/antilogy.hh similarity index 57% copy from milena/mln/fun/p2b/all.hh copy to milena/mln/fun/p2b/antilogy.hh index ed6e926..5a7744f 100644 --- a/milena/mln/fun/p2b/all.hh +++ b/milena/mln/fun/p2b/antilogy.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -25,13 +25,14 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_FUN_P2B_ALL_HH -# define MLN_FUN_P2B_ALL_HH +#ifndef MLN_FUN_P2B_ANTILOGY_HH +# define MLN_FUN_P2B_ANTILOGY_HH -/*! \file mln/fun/p2b/all.hh - * - * \brief File that includes all functions from point to boolean. - */ +/// \file mln/fun/p2b/antilogy.hh +/// \brief Definition of a p2b function always returning \c false. + +# include <mln/core/concept/function.hh> +# include <mln/core/alias/point2d.hh> namespace mln @@ -40,18 +41,40 @@ namespace mln namespace fun { - /// Namespace of functions from point to boolean. namespace p2b { - } - } -} + /// \brief A p2b function always returning \c false. + /// + /// A simpler name would be `false', but this is not a valid C++ + /// identifier, as \c false is a keyword of the language. + struct antilogy : public Function_p2b< antilogy > + { + typedef bool result; + + template <typename P> + bool operator()(const P& p) const; + }; + + +# ifndef MLN_INCLUDE_ONLY + + template <typename P> + inline + bool + antilogy::operator()(const P& /* p */) const + { + return false; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::fun::p2b -# include <mln/fun/p2b/chess.hh> -# include <mln/fun/p2b/has.hh> + } // end of namespace mln::fun +} // end of namespace mln -#endif // ! MLN_FUN_P2B_ALL_HH +#endif // ! MLN_FUN_P2B_ANTILOGY_HH diff --git a/milena/mln/fun/p2b/all.hh b/milena/mln/fun/p2b/tautology.hh similarity index 57% copy from milena/mln/fun/p2b/all.hh copy to milena/mln/fun/p2b/tautology.hh index ed6e926..20d03d5 100644 --- a/milena/mln/fun/p2b/all.hh +++ b/milena/mln/fun/p2b/tautology.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -25,13 +25,14 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef MLN_FUN_P2B_ALL_HH -# define MLN_FUN_P2B_ALL_HH +#ifndef MLN_FUN_P2B_TAUTOLOGY_HH +# define MLN_FUN_P2B_TAUTOLOGY_HH -/*! \file mln/fun/p2b/all.hh - * - * \brief File that includes all functions from point to boolean. - */ +/// \file mln/fun/p2b/tautology.hh +/// \brief Definition of a p2b function always returning \c true. + +# include <mln/core/concept/function.hh> +# include <mln/core/alias/point2d.hh> namespace mln @@ -40,18 +41,40 @@ namespace mln namespace fun { - /// Namespace of functions from point to boolean. namespace p2b { - } - } -} + /// \brief A p2b function always returning \c true. + /// + /// A simpler name would be `true', but this is not a valid C++ + /// identifier, as \c true is a keyword of the language. + struct tautology : public Function_p2b< tautology > + { + typedef bool result; + + template <typename P> + bool operator()(const P& p) const; + }; + + +# ifndef MLN_INCLUDE_ONLY + + template <typename P> + inline + bool + tautology::operator()(const P& /* p */) const + { + return true; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::fun::p2b -# include <mln/fun/p2b/chess.hh> -# include <mln/fun/p2b/has.hh> + } // end of namespace mln::fun +} // end of namespace mln -#endif // ! MLN_FUN_P2B_ALL_HH +#endif // ! MLN_FUN_P2B_TAUTOLOGY_HH -- 1.6.1.2
participants (1)
-
Roland Levillain