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

Start milena documentation.

	* core/macros.hh,
	* core/concept/genpoint.hh,
	* core/concept/psite.hh,
	* core/concept/object.hh,
	* core/concept/point.hh,
	* core/ops.hh,
	* core/exact.hh: Add some documentation.
	* core/concept/doc: New.
	* core/concept/doc/genpoint.hh: New.
	* mlc/equal.hh: Remove include.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@991 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent dd75e550
2007-07-02 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Start milena documentation.
* core/macros.hh,
* core/concept/genpoint.hh,
* core/concept/psite.hh,
* core/concept/object.hh,
* core/concept/point.hh,
* core/ops.hh,
* core/exact.hh: Add some documentation.
* core/concept/doc: New.
* core/concept/doc/genpoint.hh: New.
* mlc/equal.hh: Remove include.
2007-06-29 Roland Levillain <roland@lrde.epita.fr>
Clean up Doxygen's configuration and add support for Vcs.
......
/*! \file mln/core/concept/genpoint.doc.hh
* This file documents the concept of mln::GenPoint.
*/
namespace mln
{
namespace doc
{
template <typename E>
struct GenPoint
{
typedef void point; ///< Associated type of point.
typedef void dpoint;
typedef void coord;
// typedef void topo;
operator point() const;
const point* pointer() const;
coord operator[](unsigned i) const;
};
} // end of namespace mln::doc
} // end of namespace mln
#ifndef MLN_CORE_CONCEPT_GENPOINT_HH
# define MLN_CORE_CONCEPT_GENPOINT_HH
/*! \file mln/core/concept/genpoint.hh
* This file defines the concept of mln::GenPoint.
*/
# include <core/concept/object.hh>
# include <core/macros.hh>
# include <mlc/equal.hh>
......@@ -10,9 +14,20 @@
namespace mln
{
/*! Base class for implementation classes that are points or that
* have the behavior of points.
*
* "GenPoint" is "General Point" for short.
*
* This class does not derive from mln::Object; it is for use as a
* parallel hierarchy.
*
* \relates mln::doc::GenPoint
*/
template <typename E>
struct GenPoint // stand-alone class!
{
/*
typedef point;
typedef dpoint;
......@@ -31,6 +46,9 @@ namespace mln
};
/*! \relates mln::GenPoint
*/
template <typename Pl, typename Pr>
bool operator==(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
......@@ -38,12 +56,12 @@ namespace mln
bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
template <typename Pl, typename Pr>
mln_dpoint(Pl)
typename Pl::dpoint
operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
template <typename P>
mln_point(P)
operator+(const GenPoint<P>& lhs, const mln_dpoint(P)& rhs);
typename P::point
operator+(const GenPoint<P>& lhs, const typename P::dpoint& rhs);
template <typename P>
std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>& p);
......
#ifndef MLN_CORE_CONCEPT_OBJECT_HH
# define MLN_CORE_CONCEPT_OBJECT_HH
/*! \file mln/core/concept/object.hh
* This file contains the top milena class.
*/
# include <cassert>
# include <iostream>
......@@ -10,6 +14,10 @@
namespace mln
{
/*! \brief Base class for almost every class defined in milena.
*
* The parameter \a E is the exact type.
*/
template <typename E>
struct Object
{
......
#ifndef MLN_CORE_CONCEPT_POINT_HH
# define MLN_CORE_CONCEPT_POINT_HH
/*! \file mln/core/exact.hh
* This file defines the concept of mln::Point.
*/
# include <core/concept/psite.hh>
namespace mln
{
/*! Base class for implementation of point.
*
* A point is
*/
template <typename P>
struct Point : public Psite<P>
{
......
#ifndef MLN_CORE_CONCEPT_PSITE_HH
# define MLN_CORE_CONCEPT_PSITE_HH
/*! \file mln/core/concept/psite.hh
* This file defines the concept of mln::Psite.
*/
# include <core/concept/genpoint.hh>
namespace mln
{
/*! Base class for implementation classes of the notion of "point
* site".
*
* A point site ("psite" for short) is an object that allows an
* efficient access to data associated with a point. A point site
* is either a point or designates a point: regular points, deriving
* from mln::Point, are point sites, yet some point sites are not
* points.) A point site has the behavior expected from every
* point; see mln::GenPoint.
*
* When a point site is not a point, it is automatically convertible
* to the point it designates.
*
*
* Let us take the example of a 2D image encoded as an array of runs
* of values. With a point, a pair (row index, column index),
* retrieving the corresponding pixel value would mean to browse the
* array of runs to find the value location. That would not be
* efficient. Conversely, a point site dedicated to this image
* structure allows for value access in contant time; precisely the
* proper point site is a pair (index of run, index within the run).
*/
template <typename E>
struct Psite : public Object<E>,
public GenPoint<E>
......
#ifndef MLN_CORE_EXACT_HH
# define MLN_CORE_EXACT_HH
/*! \file mln/core/exact.hh
* This file defines the mln::exact downcast routines.
*/
# include <core/concept/object.hh>
namespace mln
{
// exact
/*! The mln::exact routine downcasts an object towards its exact
* type.
*
* The only argument is an mln::Object. The return follows the
* nature of the argument (either a pointer or a reference, const or
* not).
*/
/// \{
template <typename E>
E* exact(Object<E>* ptr);
......@@ -21,8 +32,18 @@ namespace mln
template <typename E>
const E& exact(const Object<E>& ref);
/// \}
// force_exact
/*! The mln::force_exact is a violent cast routine.
*
* It preserves the nature (pointer or reference, const or mutable)
* of its argument. The parameter \a E should not have qualifiers.
*
* \todo Move into mln::internal.
*/
/// \{
template <typename E, typename O>
E* force_exact(O* ptr);
......@@ -36,6 +57,8 @@ namespace mln
template <typename E, typename O>
const E& force_exact(const O& ref);
/// \}
# ifndef MLN_INCLUDE_ONLY
......
#ifndef MLN_CORE_MACROS_HH
# define MLN_CORE_MACROS_HH
/*! \file mln/core/macros.hh
* This file defines the set of milena macros.
*/
# define mln_point(T) typename T::point
# define mln_dpoint(T) typename T::dpoint
......
#ifndef MLN_CORE_OPS_HH
# define MLN_CORE_OPS_HH
/*! \file mln/core/ops.hh
* Default definitions of some operators.
*/
# include <core/concept/object.hh>
# include <core/exact.hh>
......@@ -8,15 +12,43 @@
namespace mln
{
/*! The "not equal to" operator is here defined for every milena
* objects. It relies on the definition of the "equal to" operator.
* It returns "not (lhs == rhs)".
*
* \warning There shall not be any other definition of this operator
* in milena when applying on a couple of mln::Object.
*/
template <typename O1, typename O2>
bool operator!=(const Object<O1>& lhs, const Object<O2>& rhs);
/*! The "greater than" operator is here defined for every milena
* objects. It relies on the definition of the "less than"
* operator. It returns "rhs < lhs".
*
* \warning There shall not be any other definition of this operator
* in milena when applying on a couple of mln::Object.
*/
template <typename O1, typename O2>
bool operator>(const Object<O1>& lhs, const Object<O2>& rhs);
/*! The "greater than or equal to" operator is here defined for
* every milena objects. It relies on the definition of the "less
* than or equal to" operator. It returns "rhs <= lhs".
*
* \warning There shall not be any other definition of this operator
* in milena when applying on a couple of mln::Object.
*/
template <typename O1, typename O2>
bool operator>=(const Object<O1>& lhs, const Object<O2>& rhs);
/*! A default version of the "less than or equal to" operator is
* defined for every milena objects. It relies on the definition of
* the "less than" operator. It returns "not (rhs < lhs)".
*
* \warning In the case of partial ordering between objects, this
* operator has to be re-defined.
*/
template <typename O1, typename O2>
bool operator<=(const Object<O1>& lhs, const Object<O2>& rhs);
......@@ -45,7 +77,7 @@ namespace mln
bool operator<=(const Object<O1>& lhs, const Object<O2>& rhs)
{
// if partial ordering, this operator should be re-defined!
return not exact(rhs) < exact(lhs);
return not (exact(rhs) < exact(lhs));
}
# endif // ! MLN_INCLUDE_ONLY
......
#ifndef MLN_MLC_EQUAL_HH
# define MLN_MLC_EQUAL_HH
# include <core/concept/genpoint.hh>
namespace mln
{
......
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