Commit 3a586d8a authored by Thierry Geraud's avatar Thierry Geraud
Browse files

2006-09-25 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>

	Add morpher capabilities to topology classes.
	
	* oln/automatic/topology_having_bbox.hh: New.
	* oln/automatic/topology_being_random_accessible.hh: New.
	* oln/automatic/topology_having_neighborhood.hh: New.
	* oln/core/abstract/topology_having_neighborhood.hh: New.
	* oln/core/gen/topo_add_nbh.hh: New.
	* oln/core/internal/topology_morpher.hh: New.
	* oln/automatic/image_having_neighborhood.hh: Fix typo in guards.
	Fix comment.
	Fix delegation code.
	* oln/core/topology_entry.hh (neighborhood_type, morpher_type):
	New.
	* oln/core/abstract/topology_hierarchies.hh
	(topology_hierarchy_wrt_neighborhood): New.
	Update include.
	* oln/core/abstract/topology_having_bbox.hh: Inherit from
	automatic::impl.
	* oln/core/abstract/topology_being_random_accessible.hh: Likewise.
	* oln/core/abstract/topology.hh (neighborhood): New vtype.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@564 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 7235443a
2006-09-25 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Add morpher capabilities to topology classes.
* oln/automatic/topology_having_bbox.hh: New.
* oln/automatic/topology_being_random_accessible.hh: New.
* oln/automatic/topology_having_neighborhood.hh: New.
* oln/core/abstract/topology_having_neighborhood.hh: New.
* oln/core/gen/topo_add_nbh.hh: New.
* oln/core/internal/topology_morpher.hh: New.
* oln/automatic/image_having_neighborhood.hh: Fix typo in guards.
Fix comment.
Fix delegation code.
* oln/core/topology_entry.hh (neighborhood_type, morpher_type):
New.
* oln/core/abstract/topology_hierarchies.hh
(topology_hierarchy_wrt_neighborhood): New.
Update include.
* oln/core/abstract/topology_having_bbox.hh: Inherit from
automatic::impl.
* oln/core/abstract/topology_being_random_accessible.hh: Likewise.
* oln/core/abstract/topology.hh (neighborhood): New vtype.
2006-09-25 Roland Levillain <roland@lrde.epita.fr>
Fix the distribution (again).
......
......@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
# define OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
#ifndef OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORHOOD_HH
# define OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORHOOD_HH
# include <oln/core/typedefs.hh>
# include <oln/morpher/tags.hh>
......@@ -45,7 +45,7 @@ namespace oln
namespace automatic
{
/// Implementation corresponding to the interface
/// oln::abstract::image1d for an identity morpher.
/// oln::abstract::image_having_neighborhood for an identity morpher.
template <typename E>
class impl< abstract::image_having_neighborhood,
morpher::tag::identity,
......@@ -59,7 +59,7 @@ namespace oln
/// Accessor delegation.
neighborhood_t impl_neighborhood() const
{
return this->exact().delegate().impl_neighborhood();
return this->exact().delegate().neighborhood();
}
};
......@@ -67,4 +67,4 @@ namespace oln
} // end of namespace oln
#endif // ! OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
#endif // ! OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORHOOD_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_AUTOMATIC_TOPOLOGY_BEING_RANDOM_ACCESSIBLE_HH
# define OLENA_AUTOMATIC_TOPOLOGY_BEING_RANDOM_ACCESSIBLE_HH
# include <oln/core/typedefs.hh>
# include <oln/morpher/tags.hh>
namespace oln
{
// Forward declaration.
namespace abstract
{
template <typename E> class topology_being_random_accessible;
} // end of namespace oln::abstract
namespace automatic
{
/// Implementation corresponding to the interface
/// oln::abstract::topology_being_random_accessible for an identity morpher.
template <typename E>
class impl< abstract::topology_being_random_accessible,
morpher::tag::identity,
E> :
public virtual stc::any__simple<E>
{
private:
typedef oln_type_of(E, point) point_t;
public:
bool impl_has(const point_t& p) const
{
return this->exact().delegate().has(p);
}
bool impl_has_large(const point_t& p) const
{
return this->exact().delegate().has_large(p);
}
};
} // end of namespace oln::automatic
} // end of namespace oln
#endif // ! OLENA_AUTOMATIC_TOPOLOGY_BEING_RANDOM_ACCESSIBLE_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_AUTOMATIC_TOPOLOGY_HAVING_BBOX_HH
# define OLENA_AUTOMATIC_TOPOLOGY_HAVING_BBOX_HH
# include <oln/core/typedefs.hh>
# include <oln/morpher/tags.hh>
namespace oln
{
// Forward declaration.
namespace abstract
{
template <typename E> class topology_having_bbox;
} // end of namespace oln::abstract
namespace automatic
{
/// Implementation corresponding to the interface
/// oln::abstract::topology_having_bbox for an identity morpher.
template <typename E>
class impl< abstract::topology_having_bbox,
morpher::tag::identity,
E> :
public virtual stc::any__simple<E>
{
private:
typedef oln_type_of(E, bbox) bbox_t;
public:
const bbox_t& impl_bbox() const
{
return this->exact().delegate().bbox();
}
};
} // end of namespace oln::automatic
} // end of namespace oln
#endif // ! OLENA_AUTOMATIC_TOPOLOGY_HAVING_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_AUTOMATIC_TOPOLOGY_HAVING_NEIGHBORHOOD_HH
# define OLENA_AUTOMATIC_TOPOLOGY_HAVING_NEIGHBORHOOD_HH
# include <oln/core/typedefs.hh>
# include <oln/morpher/tags.hh>
namespace oln
{
// Forward declaration.
namespace abstract
{
template <typename E> class topology_having_neighborhood;
} // end of namespace oln::abstract
namespace automatic
{
/// Implementation corresponding to the interface
/// oln::abstract::topology_having_neighborhood for an identity morpher.
template <typename E>
class impl< abstract::topology_having_neighborhood,
morpher::tag::identity,
E> :
public virtual stc::any__simple<E>
{
private:
typedef oln_type_of(E, neighborhood) neighborhood_t;
public:
const neighborhood_t& impl_neighborhood() const
{
return this->exact().delegate().neighborhood();
}
};
} // end of namespace oln::automatic
} // end of namespace oln
#endif // ! OLENA_AUTOMATIC_TOPOLOGY_HAVING_NEIGHBORHOOD_HH
......@@ -55,6 +55,9 @@ namespace oln
// provides .has(p) and .has_large(p)
stc_virtual_typedef(point);
stc_virtual_typedef(neighborhood);
stc_virtual_typedef(morpher);
decl() {
// constraint:
......
......@@ -29,6 +29,7 @@
# define OLENA_CORE_ABSTRACT_TOPOLOGY_BEING_RANDOM_ACCESSIBLE_HH
# include <oln/core/abstract/topology.hh>
# include <oln/automatic/topology_being_random_accessible.hh>
......@@ -40,7 +41,11 @@ namespace oln
template <typename E>
class topology_being_random_accessible : public virtual topology<E>
class topology_being_random_accessible
: public virtual topology<E>,
public automatic::impl< topology_being_random_accessible,
oln_type_of(E, morpher),
E >
{
typedef oln_type_of(E, point) point_t;
......@@ -51,6 +56,11 @@ namespace oln
return this->exact().impl_has(p);
}
bool has_large(const point_t& p) const
{
return this->exact().impl_has_large(p);
}
protected:
topology_being_random_accessible()
......
......@@ -29,6 +29,7 @@
# define OLENA_CORE_ABSTRACT_TOPOLOGY_HAVING_BBOX_HH
# include <oln/core/abstract/topology.hh>
# include <oln/automatic/topology_having_bbox.hh>
namespace oln
......@@ -39,7 +40,11 @@ namespace oln
template <typename E>
class topology_having_bbox : public virtual topology<E>
class topology_having_bbox
: public virtual topology<E>,
public automatic::impl< topology_having_bbox,
oln_type_of(E, morpher),
E >
{
typedef oln_type_of(E, bbox) bbox_t;
......
// 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_TOPOLOGY_HAVING_NEIGHBORHOOD_HH
# define OLENA_CORE_ABSTRACT_TOPOLOGY_HAVING_NEIGHBORHOOD_HH
# include <oln/core/abstract/topology.hh>
# include <oln/automatic/topology_having_neighborhood.hh>
namespace oln
{
namespace abstract
{
template <typename E>
class topology_having_neighborhood
: public virtual topology<E>,
public automatic::impl< topology_having_neighborhood,
oln_type_of(E, morpher),
E >
{
typedef oln_type_of(E, neighborhood) neighborhood_t;
public:
// abstract
const neighborhood_t& neighborhood() const
{
return this->exact().impl_neighborhood();
}
// concrete
operator neighborhood_t() const
{
return this->neighborhood();
}
protected:
topology_having_neighborhood()
{}
};
} // end of namespace oln::abstract
template <typename E>
struct case_ < topology_hierarchy_wrt_neighborhood, E, 1 >
: where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::none > >
{
typedef abstract::topology_having_neighborhood<E> ret;
};
} // end of namespace oln
#endif // ! OLENA_CORE_ABSTRACT_TOPOLOGY_HAVING_NEIGHBORHOOD_HH
......@@ -36,6 +36,7 @@ namespace oln
typedef hierarchy< abstract::topology, 1 > topology_hierarchy_wrt_accessibility;
typedef hierarchy< abstract::topology, 2 > topology_hierarchy_wrt_bbox;
typedef hierarchy< abstract::topology, 3 > topology_hierarchy_wrt_neighborhood;
} // end of namespace oln
......@@ -43,9 +44,12 @@ namespace oln
// Hierarchy 1: topology w.r.t. accessibility.
# include <oln/core/abstract/topology_being_random_accessible.hh>
// Hierarchy 2: topology w.r.t. bbox.
// Hierarchy 2: topology w.r.t. bounding box.
# include <oln/core/abstract/topology_having_bbox.hh>
// Hierarchy 2: topology w.r.t. neighborhood.
# include <oln/core/abstract/topology_having_neighborhood.hh>
#endif // ! OLENA_CORE_ABSTRACT_TOPOLOGY_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_GEN_TOPO_ADD_NBH_HH
# define OLENA_CORE_GEN_TOPO_ADD_NBH_HH
# include <oln/core/internal/topology_morpher.hh>
namespace oln
{
// Forward declarations.
template <typename topo, typename nbh> class topo_add_nbh;
// Super type declaration.
template <typename topo, typename nbh>
struct set_super_type< topo_add_nbh<topo, nbh> >
{
typedef topo_add_nbh<topo, nbh> self_t;
typedef internal::topology_morpher<topo, self_t> ret;
};
/// Virtual types associated to oln::bbox_<point>.
template <typename topo, typename nbh>
struct vtypes< topo_add_nbh<topo, nbh> >
{
typedef nbh neighborhood_type;
};
template <typename topo, typename nbh>
struct single_vtype< topo_add_nbh<topo, nbh>, typedef_::delegated_type >
{
typedef topo ret;
};
/// Bounding box topology based on a point class.
template <typename topo_t, typename nbh_t>
class topo_add_nbh : public internal::topology_morpher<topo_t, topo_add_nbh<topo_t, nbh_t> >
{
public:
topo_add_nbh()
{
}
topo_add_nbh(const topo_t& topo, const nbh_t& nbh)
: topo_(topo),
nbh_(nbh)
{
}
const nbh_t& impl_neighborhood() const
{
return nbh_;
}
const topo_t& delegate() const
{
return topo_;
}
protected:
topo_t topo_;
nbh_t nbh_;
};
} // end of namespace oln
#endif // ! OLENA_CORE_GEN_TOPO_ADD_NBH_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_INTERNAL_TOPOLOGY_MORPHER_HH
# define OLENA_CORE_INTERNAL_TOPOLOGY_MORPHER_HH
# include <oln/core/topology_entry.hh>
namespace oln
{
namespace internal
{
template <typename Topo, typename E>
struct topology_morpher;
} // end of namespace oln::internal
template <typename Topo, typename E>
struct set_pseudosuper_type< internal::topology_morpher<Topo, E> >
{
typedef Topo ret;
};
template <typename Topo, typename E>
struct single_vtype< internal::topology_morpher<Topo