Commit e6708a33 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

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

	Add some abstract image sub-hierarchies.
	
	* oln/automatic/image_being_mutable.hh: New.
	* oln/core/abstract/image/mutability/hierarchy.hh: New.
	* oln/core/abstract/image/accessibility/hierarchy.hh: New.
	* oln/core/abstract/image/bbox/hierarchy.hh: New.
	* oln/core/typedefs.hh (lvalue_type, is_mutable_type): New.
	* oln/core/macros.hh (oln_deduce_type_of): New.
	* oln/core/abstract/image.hh: Cosmetics.
	* oln/core/abstract/image/hierarchies.hh
	(image_hierarchy_wrt_bbox): New.
	(image_hierarchy_wrt_accessibility): New.
	(image_hierarchy_wrt_mutability): New.
	(include): Update.	
	* oln/core/abstract/image/neighborhood/hierarchy.hh (decl): New.
	(~image_having_neighborhood): New.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@574 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent ec151f2f
2006-09-26 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Add some abstract image sub-hierarchies.
* oln/automatic/image_being_mutable.hh: New.
* oln/core/abstract/image/mutability/hierarchy.hh: New.
* oln/core/abstract/image/accessibility/hierarchy.hh: New.
* oln/core/abstract/image/bbox/hierarchy.hh: New.
* oln/core/typedefs.hh (lvalue_type, is_mutable_type): New.
* oln/core/macros.hh (oln_deduce_type_of): New.
* oln/core/abstract/image.hh: Cosmetics.
* oln/core/abstract/image/hierarchies.hh
(image_hierarchy_wrt_bbox): New.
(image_hierarchy_wrt_accessibility): New.
(image_hierarchy_wrt_mutability): New.
(include): Update.
* oln/core/abstract/image/neighborhood/hierarchy.hh (decl): New.
(~image_having_neighborhood): New.
2006-09-26 Roland Levillain <roland@lrde.epita.fr>
* oln/core/typedefs.hh: Catch up with changes in Static's
......
// 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_IMAGE_BEING_MUTABLE_HH
# define OLENA_AUTOMATIC_IMAGE_BEING_MUTABLE_HH
# include <oln/core/typedefs.hh>
# include <oln/morpher/tags.hh>
namespace oln
{
// Forward declaration.
namespace abstract
{
template <typename E> class image_being_mutable;
} // end of namespace oln::abstract
namespace automatic
{
/// Implementation corresponding to the interface
/// oln::abstract::image_being_mutable for an identity morpher.
template <typename E>
class impl< abstract::image_being_mutable, morpher::tag::identity, E> :
public virtual stc::any__simple<E>
{
private:
typedef oln_type_of(E, lvalue) lvalue_t;
typedef oln_type_of(E, psite) psite_t;
public:
/// Accessor delegation.
lvalue_t& impl_op_readwrite(const psite_t& p) const
{
return this->exact().delegate().operator()(p);
}
};
} // end of namespace oln::automatic
} // end of namespace oln
#endif // ! OLENA_AUTOMATIC_IMAGE_BEING_MUTABLE_HH
......@@ -55,9 +55,7 @@ namespace oln
template <typename E>
struct image : public virtual stc::any__simple<E>,
public virtual oln::type,
public automatic::impl< image,
oln_type_of(E, morpher),
E >
public automatic::impl< image, oln_type_of(E, morpher), E >
{
public:
......
// 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_IMAGE_ACCESSIBILITY_HIERARCHY_HH
# define OLENA_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
namespace oln
{
/*-------------------------.
| Dimension abstractions. |
`-------------------------*/
namespace abstract
{
/// Image having a accessibility.
template <typename E>
struct image_being_random_accessible :
public virtual image<E>,
public automatic::impl< image_being_random_accessible, oln_type_of(E, morpher), E >
{
typedef oln_type_of(E, point) point_t;
public:
// Concrete method.
bool has(const point_t& p) const
{
return this->topo().has(p);
}
// Concrete method.
bool has_large(const point_t& p) const
{
return this->topo().has_large(p);
}
protected:
/// Constructor (protected, empty).
image_being_random_accessible() {}
};
} // end of namespace oln::abstract
/*-------------------.
| Dimension switch. |
`-------------------*/
/// With accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_accessibility, E, 1 > :
where_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ > >
{
typedef abstract::image_being_random_accessible<E> ret;
};
} // end of namespace oln
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_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_IMAGE_BBOX_HIERARCHY_HH
# define OLENA_CORE_ABSTRACT_IMAGE_BBOX_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
namespace oln
{
/*-------------------------.
| Dimension abstractions. |
`-------------------------*/
namespace abstract
{
/// Image having a bbox.
template <typename E>
struct image_having_bbox :
public virtual image<E>,
public automatic::impl< image_having_bbox, oln_type_of(E, morpher), E >
{
private:
typedef oln_type_of(E, bbox) bbox_t;
public:
struct decl {
stc_virtual_typedef(bbox);
};
// Concrete method.
bbox_t bbox() const
{
return this->topo().bbox();
}
protected:
/// Constructor (protected, empty).
image_having_bbox() {}
/// Destructor.
virtual ~image_having_bbox() { decl(); }
};
} // end of namespace oln::abstract
/*-------------------.
| Dimension switch. |
`-------------------*/
/// With bbox.
template <typename E>
struct case_< image_hierarchy_wrt_bbox, E, 1 > :
where_< mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > >
{
typedef abstract::image_having_bbox<E> ret;
};
template <typename E> struct image_entry;
template <typename E>
struct single_vtype< image_entry<E>, typedef_::bbox_type >
{
private:
typedef oln_type_of(E, topo) topo_t;
public:
typedef oln_type_of(topo_t, bbox) ret;
};
} // end of namespace oln
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_BBOX_HIERARCHY_HH
......@@ -37,11 +37,14 @@ namespace oln
typedef hierarchy<abstract::image, 1> image_hierarchy_wrt_dimension;
typedef hierarchy<abstract::image, 2> image_hierarchy_wrt_type;
typedef hierarchy<abstract::image, 3> image_hierarchy_wrt_neighborhood;
typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_bbox;
typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_accessibility;
typedef hierarchy<abstract::image, 6> image_hierarchy_wrt_mutability;
// FIXME: To be continued.
#if 0
typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_value;
typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_data_retrieval;
typedef hierarchy<abstract::image, 7> image_hierarchy_wrt_value;
typedef hierarchy<abstract::image, 8> image_hierarchy_wrt_data_retrieval;
// ...
#endif
......@@ -57,5 +60,14 @@ namespace oln
// Hierarchy 3: topology w.r.t. neighborhood.
# include <oln/core/abstract/image/neighborhood/hierarchy.hh>
// Hierarchy 4: topology w.r.t. bounding box.
# include <oln/core/abstract/image/bbox/hierarchy.hh>
// Hierarchy 5: topology w.r.t. accessibility.
# include <oln/core/abstract/image/accessibility/hierarchy.hh>
// // // Hierarchy 6: topology w.r.t. data mutability.
# include <oln/core/abstract/image/mutability/hierarchy.hh>
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_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_IMAGE_MUTABILITY_HIERARCHY_HH
# define OLENA_CORE_ABSTRACT_IMAGE_MUTABILITY_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
// Automatically-inherited implementations.
# include <oln/automatic/image_being_mutable.hh>
namespace oln
{
/*-------------------------.
| Dimension abstractions. |
`-------------------------*/
namespace abstract
{
/// Image being mutable.
template <typename E>
struct image_being_mutable :
public virtual image<E>,
public automatic::impl< image_being_mutable, oln_type_of(E, morpher), E >
{
private:
typedef oln_type_of(E, lvalue) lvalue_t;
typedef oln_type_of(E, psite) psite_t;
public:
struct decl {
stc_virtual_typedef(lvalue);
};
/*! \brief Gives writable access to the value stored at \a p in
** the current image.
*/
lvalue_t& operator()(const psite_t& p) const
{
return this->exact().impl_op_readwrite(p);
}
protected:
/// Constructor (protected, empty).
image_being_mutable() {}
/// Destructor (protected).
image_being_mutable() { decl(); }
};
} // end of namespace oln::abstract
/*-------------------.
| Dimension switch. |
`-------------------*/
/// With mutability.
template <typename E>
struct case_< image_hierarchy_wrt_mutability, E, 1 > :
where_< mlc::eq_< oln_type_of(E, is_mutable), mlc::true_ > >
{
typedef abstract::image_being_mutable<E> ret;
};
} // end of namespace oln
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_MUTABILITY_HIERARCHY_HH
......@@ -67,14 +67,26 @@ namespace oln
typedef oln_type_of(E, neighborhood) neighborhood_t;
public:
struct decl {
// FIXME: Uncomment.
// stc_virtual_typedef(fwd_niter);
// stc_virtual_typedef(bkd_niter);
};
neighborhood_t neighborhood() const
{
return this->topo().neighborhood();
}
protected:
/// Constructor (protected, empty).
image_having_neighborhood() {}
/// Destructor (protected).
~image_having_neighborhood() { decl(); }
};
} // end of namespace oln::abstract
......
......@@ -40,6 +40,14 @@
# define oln_type_of(OlnType, Alias) \
stc_type_of(oln, void, OlnType, Alias)
/// FIXME: Temporary macro to be able to perform "oln_type_of(oln_type_of(A, B), C)".
# define oln_deduce_type_of(OlnType, Alias1, Alias2) \
typename oln::type_of_<void, \
typename oln::type_of_<void, OlnType, oln::typedef_::Alias1##_type >::ret, \
oln::typedef_::Alias2##_type >::ret
/// \def oln_type_of(OlnType, Alias)
///
/// Macro to retrieve an associated type \a Alias from the exact type of
......
......@@ -120,6 +120,8 @@ namespace oln
// --------------------------------------------------------------------
mlc_decl_typedef(value_type);
mlc_decl_typedef(rvalue_type);
mlc_decl_typedef(lvalue_type);
mlc_decl_typedef(is_mutable_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment