Commit 5f554eed authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Update some abstractions and remove topology-related classes.

	* oln/core/abstract/value.hh: Rename as...
	* oln/core/concept/value.hh: ...this and update.
	* oln/core/abstract/iterator_on_values.hh: Rename as...
	* oln/core/concept/iterator_on_values.hh: ...this and update.
	* oln/core/abstract/topology/topology_having_bbox.hh,
	* oln/core/abstract/topology/hierarchies.hh,
	* oln/core/abstract/topology/all.hh,
	* oln/core/abstract/topology/topology_being_random_accessible.hh,
	* oln/core/abstract/topology/topology_having_subset.hh,
	* oln/core/abstract/topology/topology_having_neighborhood.hh:
	Remove.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@845 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 64b780e2
2007-03-05 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Update some abstractions and remove topology-related classes.
* oln/core/abstract/value.hh: Rename as...
* oln/core/concept/value.hh: ...this and update.
* oln/core/abstract/iterator_on_values.hh: Rename as...
* oln/core/concept/iterator_on_values.hh: ...this and update.
* oln/core/abstract/topology/topology_having_bbox.hh,
* oln/core/abstract/topology/hierarchies.hh,
* oln/core/abstract/topology/all.hh,
* oln/core/abstract/topology/topology_being_random_accessible.hh,
* oln/core/abstract/topology/topology_having_subset.hh,
* oln/core/abstract/topology/topology_having_neighborhood.hh:
Remove.
2007-03-05 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Cleaning point set classes.
......
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 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 OLN_CORE_ABSTRACT_ANY_HH
# define OLN_CORE_ABSTRACT_ANY_HH
# include <stc/any.hh>
# include <mlc/bool.hh>
# include <mlc/is_a.hh>
namespace oln {
namespace abstract {
template <typename E>
struct any : public stc::any<E, stc::dispatch_policy::simple>
{
protected:
typedef stc::any<E, stc::dispatch_policy::simple> super;
any(E* exact_ptr) : super(exact_ptr) {}
any() {}
};
template <typename E>
struct any_best_speed :
public stc::any<E, stc::dispatch_policy::best_speed>
{
protected:
typedef stc::any<E, stc::dispatch_policy::best_speed> super;
any_best_speed(E* exact_ptr = 0) : super(exact_ptr) {}
};
} // end of namespace oln::abstract
} // end of namespace oln
# define oln_is_any(Type) \
mlc::or_< mlc_is_a(Type, oln::abstract::any), \
mlc_is_a(Type, oln::abstract::any_best_speed) >
#endif // ! OLN_CORE_ABSTRACT_ANY_HH
// Copyright (C) 2005, 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 OLN_CORE_ABSTRACT_ENTRY_HH
# define OLN_CORE_ABSTRACT_ENTRY_HH
# include <oln/core/typedefs.hh>
# include <oln/core/case.hh>
namespace oln
{
template < template <class> class abstraction,
unsigned num >
struct hierarchy
{
};
namespace internal
{
// fwd decl
template < template <class> class abstraction, typename E, unsigned num >
struct entry_node;
template < template <class> class abstraction,
typename E,
unsigned num,
typename another_hierarchy = mlc::false_ >
struct next_entry_node
{
// here: no other hierarchy
};
template < template <class> class abstraction,
typename E >
struct next_entry_node < abstraction, E, 1, mlc::false_ >
: public abstraction<E>
{
};
template < template <class> class abstraction,
typename E,
unsigned num >
struct next_entry_node < abstraction,
E,
num,
mlc::true_>
: // plug to client sub-abstractions
public virtual oln::switch_< hierarchy<abstraction, num>, E >::ret,
// here: another hierarchy (number is 'num + 1')
public entry_node<abstraction, E, num + 1>
{
};
template < template <class> class abstraction,
typename E,
unsigned num >
struct entry_node
: public next_entry_node< abstraction,
E,
num,
typename mlc::is_defined_< oln::case_< oln::hierarchy<abstraction, num>,
E, 1 > >::eval >
{
~entry_node();
};
# ifndef OLN_INCLUDE_ONLY
template < template <class> class abstraction,
typename E,
unsigned num >
entry_node<abstraction, E, num>::~entry_node()
{
}
# endif
} // end of namespace oln::internal
template < template <class> class abstraction,
unsigned num,
typename E >
struct default_case_ < oln::hierarchy<abstraction, num>,
E >
{
typedef abstraction<E> ret;
};
template < template <class> class abstraction,
typename E >
struct entry : public internal::entry_node<abstraction, E, 1>
{
~entry();
protected:
entry();
};
# ifndef OLN_INCLUDE_ONLY
template < template <class> class abstraction,
typename E >
entry<abstraction, E>::entry()
{
}
template < template <class> class abstraction,
typename E >
entry<abstraction, E>::~entry()
{
}
# endif
// 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
#endif // ! OLN_CORE_ABSTRACT_ENTRY_HH
// Copyright (C) 2001, 2003, 2004, 2005, 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 OLN_CORE_ABSTRACT_ITERATOR_ON_VALUES_HH
# define OLN_CORE_ABSTRACT_ITERATOR_ON_VALUES_HH
# include <oln/core/abstract/iterator.hh>
namespace oln
{
// Forward declaration.
namespace abstract { template <typename E> class iterator_on_values; }
// Super type declaration.
template <typename E>
struct set_super_type< abstract::iterator_on_values<E> >
{
typedef abstract::iterator<E> ret;
};
/// Virtual types associated to abstract::iterator_on_values<E>.
template <typename E>
struct vtypes< abstract::iterator_on_values<E> >
{
typedef stc::abstract value_type;
};
namespace abstract
{
/// Abstract value iterator class.
template <typename E>
class iterator_on_values : public abstract::iterator<E>
{
public:
typedef oln_vtype(E, value) value_type;
value_type to_value() const;
// Concrete method.
operator value_type() const;
protected:
iterator_on_values();
~iterator_on_values();
}; // end of class oln::abstract::iterator_on_values<E>
template <typename E>
std::ostream& operator<<(std::ostream& ostr,
const iterator_on_values<E>& vit);
# ifndef OLN_INCLUDE_ONLY
template <typename E>
typename iterator_on_values<E>::value_type
iterator_on_values<E>::to_value() const
{
precondition(this->is_valid());
return this->exact().impl_to_value();
}
template <typename E>
// Concrete method.
iterator_on_values<E>::operator typename iterator_on_values<E>::value_type() const
{
precondition(this->is_valid());
return this->to_value();
}
template <typename E>
iterator_on_values<E>::iterator_on_values()
{
}
template <typename E>
iterator_on_values<E>::~iterator_on_values()
{
mlc::assert_defined_< typename iterator_on_values<E>::value_type >::check();
}
template <typename E>
std::ostream& operator<<(std::ostream& ostr,
const iterator_on_values<E>& vit)
{
return ostr << vit.to_value();
}
# endif
} // end of namespace oln::abstract
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_ITERATOR_ON_VALUES_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 OLN_CORE_ABSTRACT_TOPOLOGY_HH
# define OLN_CORE_ABSTRACT_TOPOLOGY_HH
# include <oln/core/typedefs.hh>
namespace oln
{
namespace abstract
{
/// Abstract topology class.
template <typename E>
class topology : public virtual stc::any__simple<E>,
public virtual oln::type
{
public:
struct decl
{
oln_virtual_typedef(bbox);
// for being bboxed; provides .bbox()
oln_virtual_typedef(is_random_accessible);
// provides .has(p) and .has_large(p)
oln_virtual_typedef(point);
oln_virtual_typedef(neighborhood);
oln_virtual_typedef(morpher);
decl();
};
protected:
topology();
~topology();
}; // end of class oln::abstract::topology<E>
# ifndef OLN_INCLUDE_ONLY
template <typename E>
topology<E>::decl::decl()
{
// constraint:
// mlc::assert_< mlc::implies_< mlc::neq_< bbox, mlc::none >,
// mlc_is_a(bbox, abstract::bbox) > >::check();
}
template <typename E>
topology<E>::topology()
{
}
template <typename E>
topology<E>::~topology()
{
decl();
}
# endif
} // end of namespace oln::abstract
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_TOPOLOGY_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 OLN_CORE_ABSTRACT_TOPOLOGY_ALL_HH
# define OLN_CORE_ABSTRACT_TOPOLOGY_ALL_HH
# include <oln/core/abstract/topology.hh>
# include <oln/core/abstract/topology/hierarchies.hh>
// Hierarchy 1: topology w.r.t. accessibility.
# include <oln/core/abstract/topology/topology_being_random_accessible.hh>
// Hierarchy 2: topology w.r.t. bounding box.
# include <oln/core/abstract/topology/topology_having_bbox.hh>
// Hierarchy 3: topology w.r.t. neighborhood.
# include <oln/core/abstract/topology/topology_having_neighborhood.hh>
// Hierarchy 4: topology w.r.t. subset.
# include <oln/core/abstract/topology/topology_having_subset.hh>
#endif // ! OLN_CORE_ABSTRACT_TOPOLOGY_ALL_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 OLN_CORE_ABSTRACT_TOPOLOGY_HIERARCHIES_HH
# define OLN_CORE_ABSTRACT_TOPOLOGY_HIERARCHIES_HH
# include <oln/core/abstract/entry.hh>
# include <oln/core/abstract/topology.hh>
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;
typedef hierarchy< abstract::topology, 4 > topology_hierarchy_wrt_subset;
} // end of namespace oln
#endif // ! OLN_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 OLN_CORE_ABSTRACT_TOPOLOGY_TOPOLOGY_BEING_RANDOM_ACCESSIBLE_HH
# define OLN_CORE_ABSTRACT_TOPOLOGY_TOPOLOGY_BEING_RANDOM_ACCESSIBLE_HH