2006-09-07 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Start the topology hierarchy.
* oln/core/topo_entry.hh: New.
* oln/core/abstract/topo.hh: New.
* oln/core/abstract/topo_hierarchies.hh: New.
* oln/core/abstract/topo_with_bbox.hh: New.
* oln/core/abstract/topo_ra.hh: New.
* oln/core/gen/bbox_topo.hh: New.
* oln/core/2d/aliases.hh (topo2d): New.
Add a new sub-hierarchy to abstract::pset.
* oln/core/abstract/pset_cnx.hh: New.
* oln/core/typedefs.hh (cnx_type): New.
* oln/core/abstract/pset_hierarchies.hh (pset_cnx_hierarchy): New.
* oln/core/abstract/bbox.hh (cnx_type): New.
* oln/core/abstract/pset_bboxed.hh (is_valid): Move this method into...
* oln/core/abstract/pset.hh (pset): ...this class.
(dim): New vtype.
* oln/core/pset_entry.hh (single_vtype): Add vtype dim.
* oln/basics2d.hh: Include oln/core/gen/bbox_topo.hh.
Index: oln/core/topo_entry.hh
===================================================================
--- oln/core/topo_entry.hh (revision 0)
+++ oln/core/topo_entry.hh (revision 0)
@@ -0,0 +1,66 @@
+// Copyright (C) 2006 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 OLENA_CORE_TOPO_ENTRY_HH
+# define OLENA_CORE_TOPO_ENTRY_HH
+
+# include <oln/core/abstract/entry.hh>
+# include <oln/core/abstract/topo.hh>
+
+
+
+namespace oln
+{
+
+
+ /// Entry class for point sets: topo_entry<E> is an alias for
+ /// entry< abstract::topo, E>.
+
+ template <typename E>
+ struct topo_entry : public entry< abstract::topo, E>
+ {
+ protected:
+ topo_entry() {}
+ };
+
+
+ /// Virtual types associated to topo_entry<E>.
+
+ template <typename E>
+ struct vtypes< topo_entry<E> >
+ {
+ typedef mlc::undefined bbox_type;
+ typedef mlc::undefined ra_type;
+
+ typedef mlc::undefined point_type;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_TOPO_ENTRY_HH
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 525)
+++ oln/core/typedefs.hh (working copy)
@@ -115,6 +115,7 @@
mlc_decl_typedef(fixed_type);
mlc_decl_typedef(ra_type);
+ mlc_decl_typedef(cnx_type);
/*------------------.
Index: oln/core/abstract/topo.hh
===================================================================
--- oln/core/abstract/topo.hh (revision 0)
+++ oln/core/abstract/topo.hh (revision 0)
@@ -0,0 +1,88 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_TOPO_HH
+# define OLENA_CORE_ABSTRACT_TOPO_HH
+
+# include <oln/core/typedefs.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ /// Abstract point class.
+ template <typename E>
+ class topo : public virtual stc::any__simple<E>,
+ public virtual oln::type
+ {
+ public:
+
+ struct decl
+ {
+ stc_virtual_typedef(bbox); // for being bboxed; provides .bbox()
+ stc_virtual_typedef(ra); // for random access; provides .has(p)
+
+ stc_virtual_typedef(point);
+
+ decl() {
+ // constraint:
+ mlc::assert_< mlc::implies_< mlc::neq_< bbox, mlc::none >,
+ mlc_is_a(bbox, abstract::bbox) > >::check();
+ }
+ };
+
+ const oln_type_of(E, bbox)& bbox() const
+ {
+ return this->exact().impl_bbox();
+ }
+
+ protected:
+
+ topo()
+ {}
+
+ ~topo() { decl(); }
+
+ }; // end of class oln::abstract::topo<E>
+
+
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+
+# include <oln/core/abstract/topo_hierarchies.hh>
+
+
+
+#endif // ! OLENA_CORE_ABSTRACT_TOPO_HH
Index: oln/core/abstract/pset_hierarchies.hh
===================================================================
--- oln/core/abstract/pset_hierarchies.hh (revision 525)
+++ oln/core/abstract/pset_hierarchies.hh (working copy)
@@ -37,6 +37,7 @@
typedef hierarchy< abstract::pset, 1 > pset_fixed_hierarchy;
typedef hierarchy< abstract::pset, 2 > pset_ra_hierarchy;
typedef hierarchy< abstract::pset, 3 > pset_bboxed_hierarchy;
+ typedef hierarchy< abstract::pset, 4 > pset_cnx_hierarchy;
} // end of namespace oln
@@ -44,6 +45,7 @@
# include <oln/core/abstract/pset_fixed.hh>
# include <oln/core/abstract/pset_ra.hh>
# include <oln/core/abstract/pset_bboxed.hh>
+# include <oln/core/abstract/pset_cnx.hh>
Index: oln/core/abstract/pset_cnx.hh
===================================================================
--- oln/core/abstract/pset_cnx.hh (revision 0)
+++ oln/core/abstract/pset_cnx.hh (revision 0)
@@ -0,0 +1,83 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_PSET_CNX_HH
+# define OLENA_CORE_ABSTRACT_PSET_CNX_HH
+
+# include <oln/core/abstract/pset.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ template <typename E>
+ class cnx2d_pset : public virtual abstract::pset<E>
+ {
+ public:
+
+ unsigned nrows() const
+ {
+ precondition(this->is_valid());
+ return this->exact().len(0);
+ }
+
+ unsigned ncols() const
+ {
+ precondition(this->is_valid());
+ return this->exact().len(1);
+ }
+
+ protected:
+
+ cnx2d_pset()
+ {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+
+
+ template <typename E>
+ struct case_ < pset_cnx_hierarchy, E, 1 >
+ : where_< mlc::and_list_< mlc::neq_< oln_type_of(E, bbox), mlc::none >,
+ mlc::eq_< oln_type_of(E, cnx), mlc::true_ >,
+ mlc::eq_< oln_type_of(E, grid), grid2d > > >
+ {
+ typedef abstract::cnx2d_pset<E> ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_PSET_CNX_HH
+
Index: oln/core/abstract/topo_with_bbox.hh
===================================================================
--- oln/core/abstract/topo_with_bbox.hh (revision 0)
+++ oln/core/abstract/topo_with_bbox.hh (revision 0)
@@ -0,0 +1,81 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_TOPO_WITH_BBOX_HH
+# define OLENA_CORE_ABSTRACT_TOPO_WITH_BBOX_HH
+
+# include <oln/core/abstract/topo.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ template <typename E>
+ class topo_with_bbox : public virtual topo<E>
+ {
+ typedef oln_type_of(E, bbox) bbox_t;
+
+ public:
+
+ // abstract
+ const bbox_t& bbox() const
+ {
+ return this->exact().impl_box();
+ }
+
+ // concrete
+ operator bbox_t() const
+ {
+ return this->bbox();
+ }
+
+ protected:
+
+ topo_with_bbox()
+ {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+
+ template <typename E>
+ struct case_ < topo_with_bbox_hierarchy, E, 1 >
+ : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
+ {
+ typedef abstract::topo_with_bbox<E> ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_TOPO_WITH_BBOX_HH
Index: oln/core/abstract/topo_hierarchies.hh
===================================================================
--- oln/core/abstract/topo_hierarchies.hh (revision 0)
+++ oln/core/abstract/topo_hierarchies.hh (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_TOPO_HIERARCHIES_HH
+# define OLENA_CORE_ABSTRACT_TOPO_HIERARCHIES_HH
+
+# include <oln/core/abstract/topo.hh>
+
+
+namespace oln
+{
+
+ typedef hierarchy< abstract::topo, 1 > topo_ra_hierarchy;
+ typedef hierarchy< abstract::topo, 2 > topo_with_bbox_hierarchy;
+
+} // end of namespace oln
+
+
+# include <oln/core/abstract/topo_ra.hh>
+# include <oln/core/abstract/topo_with_bbox.hh>
+
+
+
+#endif // ! OLENA_CORE_ABSTRACT_TOPO_HIERARCHIES_HH
+
Index: oln/core/abstract/bbox.hh
===================================================================
--- oln/core/abstract/bbox.hh (revision 525)
+++ oln/core/abstract/bbox.hh (working copy)
@@ -53,6 +53,7 @@
{
typedef mlc::true_ ra_type;
typedef mlc::true_ fixed_type;
+ typedef mlc::true_ cnx_type;
typedef E bbox_type;
};
Index: oln/core/abstract/pset_bboxed.hh
===================================================================
--- oln/core/abstract/pset_bboxed.hh (revision 525)
+++ oln/core/abstract/pset_bboxed.hh (working copy)
@@ -55,11 +55,6 @@
return this->exact().impl_box();
}
- bool is_valid() const
- {
- return this->exact().impl_is_valid();
- }
-
const point_t& pmin() const
{
precondition(this->is_valid());
@@ -102,7 +97,6 @@
} // end of namespace oln::abstract
-
template <typename E>
struct case_ < pset_bboxed_hierarchy, E, 1 >
: where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
@@ -115,4 +109,3 @@
#endif // ! OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
-
Index: oln/core/abstract/topo_ra.hh
===================================================================
--- oln/core/abstract/topo_ra.hh (revision 0)
+++ oln/core/abstract/topo_ra.hh (revision 0)
@@ -0,0 +1,74 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_PSET_RA_HH
+# define OLENA_CORE_ABSTRACT_PSET_RA_HH
+
+# include <oln/core/abstract/pset.hh>
+
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ template <typename E>
+ class ra_pset : public virtual pset<E>
+ {
+ typedef oln_type_of(E, point) point_t;
+
+ public:
+
+ bool has(const point_t& p) const
+ {
+ return this->exact().impl_has(p);
+ }
+
+ protected:
+ ra_pset()
+ {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+
+ template <typename E>
+ struct case_ < pset_ra_hierarchy, E, 1 >
+ : where_< mlc::eq_< oln_type_of(E, ra), mlc::true_ > >
+ {
+ typedef abstract::ra_pset<E> ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_PSET_RA_HH
Index: oln/core/abstract/pset.hh
===================================================================
--- oln/core/abstract/pset.hh (revision 525)
+++ oln/core/abstract/pset.hh (working copy)
@@ -45,7 +45,10 @@
{
public:
- // ...
+ bool is_valid() const
+ {
+ return this->exact().impl_is_valid();
+ }
struct decl
{
@@ -53,13 +56,15 @@
stc_virtual_typedef(fwd_piter);
stc_virtual_typedef(bkd_piter);
- stc_virtual_typedef(bbox);
- stc_virtual_typedef(ra);
- stc_virtual_typedef(fixed);
+ stc_virtual_typedef(bbox); // for being bboxed; provides .bbox()
+ stc_virtual_typedef(ra); // for random access; provides .has(p)
+ stc_virtual_typedef(fixed); // for fixed size; provides .npoints()
+ stc_virtual_typedef(cnx); // for connected; provides, e.g., .nrows()
// derived from point:
stc_virtual_typedef(coord);
stc_virtual_typedef(grid);
+ stc_virtual_typedef(dim);
decl() {
// coherence check:
Index: oln/core/2d/aliases.hh
===================================================================
--- oln/core/2d/aliases.hh (revision 525)
+++ oln/core/2d/aliases.hh (working copy)
@@ -38,6 +38,7 @@
template <typename C> class point2d_;
template <typename C> class dpoint2d_;
template <typename P> class bbox_;
+ template <typename P> class bbox_topo_;
template <typename P> class fwd_piter_;
template <typename P> class bkd_piter_;
class grid2d;
@@ -52,6 +53,7 @@
typedef bbox_<point2d> bbox2d;
typedef fwd_piter_<point2d> fwd_piter2d;
typedef bkd_piter_<point2d> bkd_piter2d;
+ typedef bbox_topo_<point2d> topo2d;
typedef point2d_<float> point2df;
typedef dpoint2d_<float> dpoint2df;
Index: oln/core/gen/bbox_topo.hh
===================================================================
--- oln/core/gen/bbox_topo.hh (revision 0)
+++ oln/core/gen/bbox_topo.hh (revision 0)
@@ -0,0 +1,95 @@
+// Copyright (C) 2006 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 OLENA_CORE_GEN_BBOX_TOPO_HH
+# define OLENA_CORE_GEN_BBOX_TOPO_HH
+
+# include <oln/core/topo_entry.hh>
+# include <oln/core/gen/bbox.hh>
+
+
+
+namespace oln
+{
+
+
+ // Forward declarations.
+ template <typename point> class bbox_topo_;
+
+
+ // Super type declaration.
+ template <typename point>
+ struct set_super_type< bbox_topo_<point> >
+ {
+ typedef bbox_topo_<point> self_t;
+ typedef topo_entry<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::bbox_<point>.
+ template <typename point>
+ struct vtypes< bbox_topo_<point> >
+ {
+ typedef bbox_<point> bbox_type;
+ typedef point point_type;
+ typedef mlc::true_ ra_type;
+ };
+
+
+ /// Bounding box topology based on a point class.
+ template <typename point>
+ class bbox_topo_ : public topo_entry< bbox_topo_<point> >
+ {
+ typedef bbox_<point> bbox_t;
+
+ public:
+
+ bbox_topo_()
+ {
+ }
+
+ bbox_topo_(const bbox_t& bb)
+ : bb_(bb)
+ {
+ }
+
+ const bbox_t& impl_bbox() const
+ {
+ return bb_;
+ }
+
+ protected:
+
+ bbox_<point> bb_;
+
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_GEN_BBOX_TOPO_HH
Index: oln/core/pset_entry.hh
===================================================================
--- oln/core/pset_entry.hh (revision 525)
+++ oln/core/pset_entry.hh (working copy)
@@ -79,6 +79,14 @@
};
+ template <typename E>
+ struct single_vtype< pset_entry<E>, typedef_::dim_type >
+ {
+ typedef oln_type_of(E, point) P;
+ typedef oln_type_of(P, dim) ret;
+ };
+
+
} // end of namespace oln
Index: oln/basics2d.hh
===================================================================
--- oln/basics2d.hh (revision 525)
+++ oln/basics2d.hh (working copy)
@@ -38,5 +38,7 @@
# include <oln/core/gen/fwd_piter.hh>
# include <oln/core/gen/bkd_piter.hh>
+# include <oln/core/gen/bbox_topo.hh>
+
#endif // ! OLENA_BASICS2D_HH
2006-09-06 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Update abstract::pset hierarchy to final SCOOP-2 design.
* oln/core/pset_entry.hh: New.
* oln/core/typedefs.hh: Include oln/core/abstract/entry.hh.
* oln/core/abstract/bbox.hh: Clean includes.
(set_super_type): Change from abstract::pset<E> to pset_entry<E>.
(bbox): Update.
* oln/core/abstract/entry.hh (set_super_type): New specialization.
* oln/core/abstract/pset.hh (Copyright): Fix years.
(vtypes, ext_vtype): Remove.
(fixed_pset, ra_pset, bboxed_pset): Move and dispatch to...
* oln/core/abstract/pset_fixed.hh: ...this new file.
* oln/core/abstract/pset_ra.hh: ...this new file.
* oln/core/abstract/pset_bboxed.hh: ...this new file.
* oln/core/abstract/pset.hh
(pset_fixed_hierarchy, pset_ra_hierarchy, pset_bboxed_hierarchy)
(case_): Move to...
* oln/core/abstract/pset_hierarchies.hh: ...this new file.
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 523)
+++ oln/core/typedefs.hh (working copy)
@@ -208,4 +208,7 @@
} // end of namespace oln
+# include <oln/core/abstract/entry.hh>
+
+
#endif // ! OLENA_CORE_TYPEDEFS_HH
Index: oln/core/abstract/pset_hierarchies.hh
===================================================================
--- oln/core/abstract/pset_hierarchies.hh (revision 0)
+++ oln/core/abstract/pset_hierarchies.hh (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
+# define OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
+
+# include <oln/core/abstract/pset.hh>
+
+
+namespace oln
+{
+
+ typedef hierarchy< abstract::pset, 1 > pset_fixed_hierarchy;
+ typedef hierarchy< abstract::pset, 2 > pset_ra_hierarchy;
+ typedef hierarchy< abstract::pset, 3 > pset_bboxed_hierarchy;
+
+} // end of namespace oln
+
+
+# include <oln/core/abstract/pset_fixed.hh>
+# include <oln/core/abstract/pset_ra.hh>
+# include <oln/core/abstract/pset_bboxed.hh>
+
+
+
+#endif // ! OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
+
Index: oln/core/abstract/bbox.hh
===================================================================
--- oln/core/abstract/bbox.hh (revision 523)
+++ oln/core/abstract/bbox.hh (working copy)
@@ -29,10 +29,7 @@
#ifndef OLENA_CORE_ABSTRACT_BBOX_HH
# define OLENA_CORE_ABSTRACT_BBOX_HH
-# include <mlc/value.hh>
-# include <oln/core/type.hh>
-# include <oln/core/typedefs.hh>
-# include <oln/core/abstract/pset.hh>
+# include <oln/core/pset_entry.hh>
namespace oln
@@ -46,7 +43,7 @@
template <typename E>
struct set_super_type< abstract::bbox<E> >
{
- typedef abstract::pset<E> ret;
+ typedef pset_entry<E> ret;
};
@@ -65,7 +62,7 @@
/// Abstract bbox (bounding box) class.
template <typename E>
- class bbox : public entry< abstract::pset, E> // NEW! former was: abstract::pset<E>
+ class bbox : public pset_entry<E>
{
typedef oln_type_of(E, point) point_t;
Index: oln/core/abstract/pset_fixed.hh
===================================================================
--- oln/core/abstract/pset_fixed.hh (revision 0)
+++ oln/core/abstract/pset_fixed.hh (revision 0)
@@ -0,0 +1,73 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_PSET_FIXED_HH
+# define OLENA_CORE_ABSTRACT_PSET_FIXED_HH
+
+# include <oln/core/abstract/pset.hh>
+
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ template <typename E>
+ class fixed_pset : public virtual pset<E>
+ {
+ public:
+
+ unsigned npoints() const
+ {
+ return this->exact().impl_npoints();
+ }
+
+ protected:
+ fixed_pset()
+ {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+
+ template <typename E>
+ struct case_ < pset_fixed_hierarchy, E, 1 >
+ : where_< mlc::eq_< oln_type_of(E, fixed), mlc::true_ > >
+ {
+ typedef abstract::fixed_pset<E> ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_PSET_FIXED_HH
+
Index: oln/core/abstract/pset_ra.hh
===================================================================
--- oln/core/abstract/pset_ra.hh (revision 0)
+++ oln/core/abstract/pset_ra.hh (revision 0)
@@ -0,0 +1,74 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_PSET_RA_HH
+# define OLENA_CORE_ABSTRACT_PSET_RA_HH
+
+# include <oln/core/abstract/pset.hh>
+
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ template <typename E>
+ class ra_pset : public virtual pset<E>
+ {
+ typedef oln_type_of(E, point) point_t;
+
+ public:
+
+ bool has(const point_t& p) const
+ {
+ return this->exact().impl_has(p);
+ }
+
+ protected:
+ ra_pset()
+ {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+
+ template <typename E>
+ struct case_ < pset_ra_hierarchy, E, 1 >
+ : where_< mlc::eq_< oln_type_of(E, ra), mlc::true_ > >
+ {
+ typedef abstract::ra_pset<E> ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_PSET_RA_HH
Index: oln/core/abstract/pset_bboxed.hh
===================================================================
--- oln/core/abstract/pset_bboxed.hh (revision 0)
+++ oln/core/abstract/pset_bboxed.hh (revision 0)
@@ -0,0 +1,118 @@
+// Copyright (C) 2006 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 OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
+# define OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
+
+# include <oln/core/abstract/pset.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ template <typename E>
+ class bboxed_pset : public virtual pset<E>
+ {
+ typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(E, bbox) bbox_t;
+
+ typedef oln_type_of(point_t, coord) coord_t;
+ typedef oln_type_of(point_t, dim) dim_t;
+ enum { n = mlc_value(dim_t) };
+
+ public:
+
+ const bbox_t& bbox() const
+ {
+ return this->exact().impl_box();
+ }
+
+ bool is_valid() const
+ {
+ return this->exact().impl_is_valid();
+ }
+
+ const point_t& pmin() const
+ {
+ precondition(this->is_valid());
+ return pmin_;
+ }
+
+ coord_t pmin(unsigned i) const
+ {
+ precondition(this->is_valid() and i < n);
+ return pmin_[i];
+ }
+
+ const point_t& pmax() const
+ {
+ precondition(this->is_valid());
+ return pmax_;
+ }
+
+ coord_t pmax(unsigned i) const
+ {
+ precondition(this->is_valid() and i < n);
+ return pmax_[i];
+ }
+
+ unsigned len(unsigned i) const
+ {
+ precondition(this->is_valid() and i < n);
+ return pmax_[i] - pmin_[i] + 1;
+ }
+
+ protected:
+
+ bboxed_pset()
+ {}
+
+ point_t pmin_, pmax_;
+ };
+
+
+ } // end of namespace oln::abstract
+
+
+
+ template <typename E>
+ struct case_ < pset_bboxed_hierarchy, E, 1 >
+ : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
+ {
+ typedef abstract::bboxed_pset<E> ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
+
Index: oln/core/abstract/entry.hh
===================================================================
--- oln/core/abstract/entry.hh (revision 523)
+++ oln/core/abstract/entry.hh (working copy)
@@ -112,6 +112,15 @@
};
+ // Super type declaration.
+ template < template <class> class abstraction,
+ typename E >
+ struct set_super_type< entry<abstraction, E> >
+ {
+ typedef abstraction<E> ret;
+ };
+
+
} // end of namespace oln
Index: oln/core/abstract/pset.hh
===================================================================
--- oln/core/abstract/pset.hh (revision 523)
+++ oln/core/abstract/pset.hh (working copy)
@@ -1,5 +1,4 @@
-// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
-// Development Laboratory
+// Copyright (C) 2006 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
@@ -29,53 +28,16 @@
#ifndef OLENA_CORE_ABSTRACT_PSET_HH
# define OLENA_CORE_ABSTRACT_PSET_HH
-# include <stc/any.hh>
-# include <oln/core/type.hh>
# include <oln/core/typedefs.hh>
-# include <oln/core/abstract/entry.hh> // NEW!
-
namespace oln
{
- /// Forward declaration.
- namespace abstract { template <typename E> class pset; }
-
-
-
- /// Virtual types associated to oln::bbox_nd<point>.
- template <typename E>
- struct vtypes< abstract::pset<E> >
- {
- typedef mlc::undefined point_type;
- typedef mlc::undefined fwd_piter_type;
- typedef mlc::undefined bkd_piter_type;
-
- typedef mlc::none bbox_type;
- typedef mlc::undefined ra_type;
- typedef mlc::undefined fixed_type;
- };
-
-
- template <typename E>
- struct ext_vtype< abstract::pset<E>, typedef_::coord_type >
- {
- typedef oln_type_of(E, point) P;
- typedef oln_type_of(P, coord) ret;
- };
-
- template <typename E>
- struct ext_vtype< abstract::pset<E>, typedef_::grid_type >
- {
- typedef oln_type_of(E, point) P;
- typedef oln_type_of(P, grid) ret;
- };
-
-
namespace abstract
{
+
/// Abstract point class.
template <typename E>
class pset : public virtual stc::any__simple<E>,
@@ -85,163 +47,48 @@
// ...
- protected:
-
- pset()
- {}
-
- ~pset()
+ struct decl
{
- mlc::assert_defined_< oln_type_of(E, point) >::check();
- mlc::assert_defined_< oln_type_of(E, fwd_piter) >::check();
- mlc::assert_defined_< oln_type_of(E, bkd_piter) >::check();
+ stc_virtual_typedef(point);
+ stc_virtual_typedef(fwd_piter);
+ stc_virtual_typedef(bkd_piter);
- mlc::assert_defined_< oln_type_of(E, coord) >::check();
- mlc::assert_defined_< oln_type_of(E, grid) >::check();
+ stc_virtual_typedef(bbox);
+ stc_virtual_typedef(ra);
+ stc_virtual_typedef(fixed);
-// mlc::assert_< mlc::eq_< oln_type_of(fwd_piter_t, grid),
-// oln_type_of(point_t, grid) > >::check();
+ // derived from point:
+ stc_virtual_typedef(coord);
+ stc_virtual_typedef(grid);
-// mlc::assert_< mlc::eq_< oln_type_of(bkd_piter_t, grid),
-// oln_type_of(point_t, grid) > >::check();
- }
+ decl() {
+ // coherence check:
+ mlc::assert_equal_< oln_type_of(fwd_piter, grid),
+ oln_type_of(point, grid) >::check();
+ mlc::assert_equal_< oln_type_of(bkd_piter, grid),
+ oln_type_of(point, grid) >::check();
+ }
+ };
- }; // end of class oln::abstract::pset<E>
-
-
-
- template <typename E>
- class fixed_pset : public virtual pset<E>
- {
- public:
-
- unsigned npoints() const
- {
- return this->exact().impl_npoints();
- }
-
protected:
- fixed_pset()
- {}
- };
-
-
- template <typename E>
- class ra_pset : public virtual pset<E>
- {
- typedef oln_type_of(E, point) point_t;
-
- public:
-
- bool has(const point_t& p) const
- {
- return this->exact().impl_has(p);
- }
-
- protected:
- ra_pset()
+ pset()
{}
- };
+ ~pset() { decl(); }
+ }; // end of class oln::abstract::pset<E>
- template <typename E>
- class bboxed_pset : public virtual pset<E>
- {
- typedef oln_type_of(E, point) point_t;
- typedef oln_type_of(E, bbox) bbox_t;
- typedef oln_type_of(point_t, coord) coord_t;
- typedef oln_type_of(point_t, dim) dim_t;
- enum { n = mlc_value(dim_t) };
-
- public:
- const bbox_t& bbox() const
- {
- return this->exact().impl_box();
- }
-
- bool is_valid() const
- {
- return this->exact().impl_is_valid();
- }
-
- const point_t& pmin() const
- {
- precondition(this->is_valid());
- return pmin_;
- }
-
- coord_t pmin(unsigned i) const
- {
- precondition(this->is_valid() and i < n);
- return pmin_[i];
- }
-
- const point_t& pmax() const
- {
- precondition(this->is_valid());
- return pmax_;
- }
-
- coord_t pmax(unsigned i) const
- {
- precondition(this->is_valid() and i < n);
- return pmax_[i];
- }
-
- unsigned len(unsigned i) const
- {
- precondition(this->is_valid() and i < n);
- return pmax_[i] - pmin_[i] + 1;
- }
-
- protected:
-
- bboxed_pset()
- {}
-
- point_t pmin_, pmax_;
- };
-
-
} // end of namespace oln::abstract
+} // end of namespace oln
- typedef hierarchy<abstract::pset, 1> pset_fixed_hierarchy;
- typedef hierarchy<abstract::pset, 2> pset_ra_hierarchy;
- typedef hierarchy<abstract::pset, 3> pset_bboxed_hierarchy;
+# include <oln/core/abstract/pset_hierarchies.hh>
- template <typename E>
- struct case_ < pset_fixed_hierarchy, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, fixed), mlc::true_ > >
- {
- typedef abstract::fixed_pset<E> ret;
- };
- template <typename E>
- struct case_ < pset_ra_hierarchy, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, ra), mlc::true_ > >
- {
- typedef abstract::ra_pset<E> ret;
- };
-
-
- template <typename E>
- struct case_ < pset_bboxed_hierarchy, E, 1 >
- : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
- {
- typedef abstract::bboxed_pset<E> ret;
- };
-
-
-
-} // end of namespace oln
-
-
#endif // ! OLENA_CORE_ABSTRACT_PSET_HH
Index: oln/core/pset_entry.hh
===================================================================
--- oln/core/pset_entry.hh (revision 0)
+++ oln/core/pset_entry.hh (revision 0)
@@ -0,0 +1,85 @@
+// Copyright (C) 2006 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 OLENA_CORE_PSET_ENTRY_HH
+# define OLENA_CORE_PSET_ENTRY_HH
+
+# include <oln/core/abstract/entry.hh>
+# include <oln/core/abstract/pset.hh>
+
+
+
+namespace oln
+{
+
+
+ /// Entry class for point sets: pset_entry<E> is an alias for
+ /// entry< abstract::pset, E>.
+
+ template <typename E>
+ struct pset_entry : public entry< abstract::pset, E>
+ {
+ protected:
+ pset_entry() {}
+ };
+
+
+ /// Virtual types associated to pset_entry<E>.
+
+ template <typename E>
+ struct vtypes< pset_entry<E> >
+ {
+ typedef mlc::undefined point_type;
+ typedef mlc::undefined fwd_piter_type;
+ typedef mlc::undefined bkd_piter_type;
+
+ typedef mlc::none bbox_type;
+ typedef mlc::undefined ra_type;
+ typedef mlc::undefined fixed_type;
+ };
+
+
+ template <typename E>
+ struct single_vtype< pset_entry<E>, typedef_::coord_type >
+ {
+ typedef oln_type_of(E, point) P;
+ typedef oln_type_of(P, coord) ret;
+ };
+
+
+ template <typename E>
+ struct single_vtype< pset_entry<E>, typedef_::grid_type >
+ {
+ typedef oln_type_of(E, point) P;
+ typedef oln_type_of(P, grid) ret;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_PSET_ENTRY_HH