Commit 4c3a9698 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

2006-09-07 Thierry GERAUD <theo@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.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@526 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent a9e56bc2
2006-09-07 Thierry GERAUD <theo@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.
* 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.
* oln/core/pset_entry.hh
* oln/basics2d.hh
2006-09-06 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Update abstract::pset hierarchy to final SCOOP-2 design.
......
......@@ -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
......@@ -38,6 +38,7 @@ namespace oln
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 @@ namespace oln
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;
......
......@@ -53,6 +53,7 @@ namespace oln
{
typedef mlc::true_ ra_type;
typedef mlc::true_ fixed_type;
typedef mlc::true_ cnx_type;
typedef E bbox_type;
};
......
......@@ -45,7 +45,10 @@ namespace oln
{
public:
// ...
bool is_valid() const
{
return this->exact().impl_is_valid();
}
struct decl
{
......@@ -53,13 +56,15 @@ namespace oln
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:
......
......@@ -55,11 +55,6 @@ namespace oln
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 @@ namespace oln
} // 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 @@ namespace oln
#endif // ! OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
// 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
......@@ -37,6 +37,7 @@ 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;
typedef hierarchy< abstract::pset, 4 > pset_cnx_hierarchy;
} // end of namespace oln
......@@ -44,6 +45,7 @@ namespace oln
# 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>
......
// 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
// 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
// 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
// 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
// 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
......@@ -79,6 +79,14 @@ namespace oln
};
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
......
// 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