https://svn.lrde.epita.fr/svn/oln/trunk/static
Since ConceptGCC doesn't handle concept-c++/mini-oln yet, I've disabled
it.
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix mini-oln and its Concept-C++ counterpart.
* samples/mini-oln/mini-oln.cc,
(oln::Image_with_neighborhood::niter_t): New typedef.
(oln::iterator2d::impl_op_point_t)
(oln::iterator2d::impl_op_paren): Rename as...
(oln::iterator2d::impl_op_point_type)
(oln::iterator2d::impl_op_parens): ...this.
* samples/mini-oln/mini-oln.cc,
* samples/mini-oln/concept-c++/mini-oln.cc:
(oln::Image::operator(), oln::Image2d::operator())
(oln::Image3d::operator()): Fix the delegations.
(oln::set_super_type< image_base<E> >::ret): Set to mlc::none.
(oln::image2d::self_t): New typedef.
(oln::image2d::point_t, oln::image2d::iter_t)
(oln::image2d::value_t): Fix typedefs.
* samples/mini-oln/concept-c++/mini-oln.cc: s/where/requires/
(needed by recent revisions of SVN ConceptGCC).
Declare typedefs used
as virtual types at the beginning of the file
(concepts): Rename namespace as...
(oln::concepts): ...this.
Group together abstractions on the one hand, and implementations
on the other hand.
(oln::image_with_nbh): Rename class as...
(oln::Image_with_neighborhood): ...this.
(oln::vtypes< Iterator<E> >, oln::vtypes< Image<E> >)
(oln::vtypes<image_with_nbh>)
(oln::set_super_type<Image2d>, oln::set_super_type<Image3d>,
(oln::set_super_type<image_with_nbh>): Remove (useless and
semantically wrong definitions).
(oln::Iterator::point_t, oln::Image::point_t, Image::value_t)
(oln::Image2d::point_t, oln::Image2d::value_t)
(oln::Image3d::point_t, oln::Image3d::value_t)
(oln::Image_with_neighborhood::nbh_t)
(oln::Image_with_neighborhood::niter_t): Fix typedefs.
(oln::Image::iter_t, oln::Image2d::iter_t, oln::Image3d::iter_t):
Remove typedefs.
(oln::Iterator::start, oln::Iterator::next)
(oln::Iterator::is_valid, oln::Iterator::point_t)
(oln::Image::has)
(oln::Image2d::nrows_get, oln::Image2d::ncols_get)
(oln::Image3d::nrows_get, oln::Image3d::ncols_get)
(oln::Image3d::nslis_get, oln::Image_with_neighborhood nbh): Fix
the delegations.
* samples/mini-oln/concept-c++/mini-oln.cc
(oln::image_dimension_switch): Inherit oln::Image<E> by default.
(oln::vtypes< image_base<E> >::point_type)
(oln::vtypes< image_base<E> >::iter_type)
(oln::vtypes< image_base<E> >::value_type): Set to stc::abstract.
(oln::vtypes< image_base<E> >::niter_type)
(oln::vtypes< image_base<E> >::nbh_type): New typedefs.
(oln::image_base::point_t, oln::image_base::iter_t)
(oln::image_base::value_t): Remove typedefs.
(oln::image_base::operator(), oln::image_base::has): Remove
methods.
(oln::image_base::image_base): Add ctor.
* samples/mini-oln/concept-c++/mini-oln.cc
(oln::set_super_type<iterator2d>::ret): Set to mlc::none.
(oln::set_super_type<iterator2d>::start)
(oln::set_super_type<iterator2d>::next)
(oln::set_super_type<iterator2d>::is_valid)
(oln::set_super_type<iterator2d>::operator point_t): Rename as...
(oln::set_super_type<iterator2d>::impl_start)
(oln::set_super_type<iterator2d>::impl_next)
(oln::set_super_type<iterator2d>::impl_is_valid)
(oln::set_super_type<iterator2d>::impl_op_point_type): ...these.
(oln::image2d::operator(), oln::image2d::nrows_get)
(oln::image2d::ncols_get, oln::image2d::has): Rename as...
(oln::image2d::impl_op_parens, oln::image2d::impl_nrows_get)
(oln::image2d::impl_ncols_get, oln::image2d::impl_has): Rename as...
(oln::neighborhood2d): New class.
(oln::set_super_type< image_morpher<E> >::ret): Set to
image_base<E>.
(oln::vtypes< image_morpher<E> >::delegatee_t): Set to
stc::abstract.
(oln::image_morpher): Inherit from image_base<E>.
(oln::image_morpher::delegatee_t): Fix this typedef.
(oln::set_super_type< image_morpher < plus<I, N> > >): Turn
into...
(oln::set_super_type< plus<I, N> >): ...this.
(oln::vtypes< plus<I, N> >::delegatee_t): Rename as...
(oln::vtypes< plus<I, N> >::delegatee_type): ...this.
(oln::vtypes< plus<I, N> >::nbh_type)
(oln::vtypes< plus<I, N> >::niter_type): New typedefs.
(oln::plus::self_t, oln::plus::super_t): New typedefs.
(oln::plus::plus): Pass the equipped image to the ctor of the super
class.
(oln::plus::impl_nbh): New accessor.
(main): Rewrite the test.
* samples/mini-oln/concept-c++/Makefile.am: Disable mini-oln.
concept-c++/Makefile.am | 8
concept-c++/mini-oln.cc | 457 +++++++++++++++++++++++-------------------------
mini-oln.cc | 60 ++----
3 files changed, 252 insertions(+), 273 deletions(-)
Index: samples/mini-oln/concept-c++/mini-oln.cc
--- samples/mini-oln/concept-c++/mini-oln.cc (revision 840)
+++ samples/mini-oln/concept-c++/mini-oln.cc (working copy)
@@ -37,9 +37,13 @@
#include <stc/scoop.hh>
+/*-------------.
+| Equipement. |
+`-------------*/
+
// Helper macros.
#define oln_type_of_(FromType, Alias) \
- oln::find_vtype<FromType, oln::typedef_:: Alias##_type>::ret
+ find_vtype<FromType, oln::typedef_:: Alias##_type>::ret
#define oln_type_of(FromType, Alias) \
typename oln_type_of_(FromType, Alias)
@@ -48,12 +52,25 @@
stc_scoop_equipment_for_namespace(oln);
mlc_case_equipment_for_namespace(oln);
+// Virtual types declaration.
+namespace oln
+{
+ mlc_decl_typedef(point_type);
+ mlc_decl_typedef(iter_type);
+ mlc_decl_typedef(value_type);
+
+ mlc_decl_typedef(nbh_type);
+ mlc_decl_typedef(niter_type);
+}
/*-----------.
| Concepts. |
`-----------*/
+namespace oln
+{
+
namespace concepts
{
// These concepts are not automatic (i.e., prefixed with `auto'),
@@ -103,363 +120,302 @@
int I::ncols_get() const;
int I::nslis_get() const;
};
-}
+ } // End of namespace oln::concepts.
+} // End of namespace oln.
-/*-------------.
-| Mini-Olena. |
-`-------------*/
+/*---------------.
+| Abstractions. |
+`---------------*/
+
+namespace oln
+{
// ------- //
// Point. //
// ------- //
-namespace oln
-{
template <typename E>
struct Point : public stc::any<E>
{
};
- struct point2d : public Point<point2d>
- {
- typedef int coord_type;
- coord_type row;
- coord_type col;
- };
-
- struct point3d : public Point<point2d>
- {
- typedef int coord_type;
- coord_type row;
- coord_type col;
- coord_type sli;
- };
-}
-
-namespace concepts
-{
- concept_map Point2d<oln::point2d>
- {
- typedef oln::point2d::coord_type coord_type;
- };
-
- concept_map Point3d<oln::point3d>
- {
- typedef oln::point2d::coord_type coord_type;
- };
-}
-
// ---------- //
// Iterator. //
// ---------- //
-namespace oln
-{
- template <typename E>
- struct Iterator;
-
- mlc_decl_typedef(point_type);
-
- template <typename E>
- struct vtypes< Iterator<E> >
- {
- typedef mlc::undefined point_type;
- };
-
template <typename E>
struct Iterator : public stc::any<E>
{
- typedef oln_type_of(Iterator, point) point_t;
+ typedef oln_type_of(E, point) point_t;
void start()
{
- this->exact().start();
+ this->exact().impl_start();
}
void next()
{
- this->exact().next();
+ this->exact().impl_next();
}
bool is_valid() const
{
- return this->exact().is_valid();
- };
+ return this->exact().impl_is_valid();
+ }
// auto
- operator point_t()
+ operator point_t() const
{
- return this->exact().operator point_t();
+ return this->exact().impl_op_point_type();
}
};
-}
// ------- //
// Image. //
// ------- //
-namespace oln
-{
- template <typename E>
- struct Image;
-
- mlc_decl_typedef(iter_type);
- mlc_decl_typedef(value_type);
-
- template <typename E>
- struct vtypes< Image<E> >
- {
- typedef mlc::undefined point_type;
- typedef mlc::undefined iter_type;
- typedef mlc::undefined value_type;
- };
-
template <typename E>
struct Image : public stc::any<E>
{
- typedef oln_type_of(Image, point) point_t;
- typedef oln_type_of(Image, iter) iter_t;
- typedef oln_type_of(Image, value) value_t;
+ typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(E, value) value_t;
value_t& operator ()(point_t& p)
{
- return this->exact().operator ()(p);
+ return this->exact().impl_op_parens(p);
}
bool has(const point_t& p) const
{
- return this->exact().has(p);
+ return this->exact().impl_has(p);
}
};
-}
// --------- //
// Image2d. //
// --------- //
-namespace oln
-{
- struct Image2d;
-
- template<>
- struct set_super_type<Image2d>
- {
- typedef Image<Image2d> ret;
- };
-
- struct Image2d : public Image<Image2d>
+ template <typename E>
+ struct Image2d : public Image<E>
{
- typedef oln_type_of_(Image2d, point) point_t;
- typedef oln_type_of_(Image2d, iter) iter_t;
- typedef oln_type_of_(Image2d, value) value_t;
+ typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(E, value) value_t;
+ // FIXME: delete?
value_t& operator ()(point_t& p)
{
- return this->exact().operator ()(p);
+ return this->exact().impl_op_parens(p);
}
int nrows_get() const
{
- return this->exact().nrows_get();
+ return this->exact().impl_nrows_get();
}
int ncols_get() const
{
- return this->exact().ncols_get();
+ return this->exact().impl_ncols_get();
}
};
-}
-// ---------- //
+ // --------- //
// Image 3d. //
-// ---------- //
-
-namespace oln
-{
- struct Image3d;
-
- template<>
- struct set_super_type<Image3d>
- {
- typedef Image<Image3d> ret;
- };
+ // --------- //
- struct Image3d : public Image<Image3d>
+ template <typename E>
+ struct Image3d : public Image<E>
{
- typedef oln_type_of_(Image3d, point) point_t;
- typedef oln_type_of_(Image3d, iter) iter_t;
- typedef oln_type_of_(Image3d, value) value_t;
+ typedef oln_type_of(E, point) point_t;
+ typedef oln_type_of(E, value) value_t;
+ // FIXME: delete?
value_t& operator ()(point_t& p)
{
- return this->exact().operator ()(p);
+ return this->exact().impl_op_parens(p);
}
int nrows_get() const
{
- return this->exact().nrows_get();
+ return this->exact().impl_nrows_get();
}
int ncols_get() const
{
- return this->exact().ncols_get();
+ return this->exact().impl_ncols_get();
}
int nslis_get() const
{
- return this->exact().nslis_get();
+ return this->exact().impl_nslis_get();
}
};
-}
// ------------------------- //
-// Image with neighborhood. //
+ // Image_with_neighborhood. //
// ------------------------- //
-namespace oln
-{
- struct image_with_nbh;
-
- mlc_decl_typedef(niter_type);
- mlc_decl_typedef(nbh_type);
-
- template<>
- struct set_super_type<image_with_nbh>
- {
- typedef Image<image_with_nbh> ret;
- };
-
- template <>
- struct vtypes<image_with_nbh>
- {
- typedef mlc::undefined niter_type;
- typedef mlc::undefined nbh_type;
- };
-
- struct image_with_nbh : public Image<image_with_nbh>
+ template <typename E>
+ struct Image_with_neighborhood : public Image<E>
{
- typedef oln_type_of_(image_with_nbh, niter) niter_t;
- typedef oln_type_of_(image_with_nbh, nbh) nbh_t;
+ typedef oln_type_of(E, nbh) nbh_t;
+ typedef oln_type_of(E, niter) niter_t;
- // FIXME: Implement.
-#if 0
nbh_t nbh() const
{
+ return this->exact().impl_nbh();
}
-#endif
};
-}
+
+} // End of namespace oln.
+/*---------.
+| Bridge. |
+`---------*/
+
+namespace oln
+{
// -------- //
// Switch. //
// -------- //
-namespace oln
-{
- // Fwd. decl.
- template <typename E>
- class image_dimension_switch;
+ // Forward declaration.
+ template <typename E> struct image_dimension_switch;
- // Default version, abort.
+ // Default version.
template <typename E>
- class image_dimension_switch : mlc::abort_<E>
+ struct image_dimension_switch : public oln::Image<E>
+ {
+ image_dimension_switch()
{
+ std::cout << "image_dimension_switch<E>" << std::endl;
+ }
};
// Concept-based overloading for Image2d.
- template <typename E> where concepts::Point2d< oln_type_of(E, point) >
- class image_dimension_switch<E> : public oln::Image2d
+ template <typename E>
+ requires concepts::Point2d< oln_type_of(E, point) >
+ struct image_dimension_switch<E> : public oln::Image2d<E>
{
public:
image_dimension_switch()
{
std::cout << "image_dimension_switch<E> "
- << "where concepts::Point2d<oln_type_of(E, point)>"
+ << "requires oln::concepts::Point2d<oln_type_of(E, point)>"
<< std::endl;
}
};
// Concept-based overloading for Image3d.
- template <typename E> where concepts::Point3d< oln_type_of(E, point) >
- class image_dimension_switch<E> : public oln::Image3d
+ template <typename E>
+ requires concepts::Point3d< oln_type_of(E, point) >
+ struct image_dimension_switch<E> : public oln::Image3d<E>
{
public:
image_dimension_switch()
{
std::cout << "image_dimension_switch<E> "
- << "where concepts::Point3d<oln_type_of(E, point)>"
+ << "requires oln::concepts::Point3d<oln_type_of(E, point)>"
<< std::endl;
}
};
-}
// ------------ //
// Image base. //
// ------------ //
-namespace oln
-{
- template <typename E>
- struct image_base;
+ // Forward declaration.
+ template <typename E> struct image_base;
template<typename E>
struct set_super_type< image_base<E> >
{
- typedef typename oln::image_dimension_switch<E> ret;
+ typedef mlc::none ret;
};
template <typename E>
struct vtypes< image_base<E> >
{
- typedef mlc::undefined point_type;
- typedef mlc::undefined iter_type;
- typedef mlc::undefined value_type;
+ typedef stc::abstract point_type;
+ typedef stc::abstract iter_type;
+ typedef stc::abstract value_type;
+
+ typedef mlc::none niter_type;
+ typedef mlc::none nbh_type;
};
template <typename E>
struct image_base : public oln::image_dimension_switch<E>
{
- typedef oln_type_of(image_base, point) point_t;
- typedef oln_type_of(image_base, iter) iter_t;
- typedef oln_type_of(image_base, value) value_t;
-
- value_t& operator ()(point_t& p)
+ image_base()
{
- return this->exact().operator ()(p);
}
+ };
- bool has(const point_t& p) const
+} // End of namespace oln.
+
+
+/*------------------.
+| Implementations. |
+`------------------*/
+
+namespace oln
{
- return this->exact().has(p);
- }
+ // -------- //
+ // Points. //
+ // -------- //
+
+ struct point2d : public Point<point2d>
+ {
+ typedef int coord_type;
+ coord_type row;
+ coord_type col;
};
-}
+ struct point3d : public Point<point3d>
+ {
+ typedef int coord_type;
+ coord_type row;
+ coord_type col;
+ coord_type sli;
+ };
-// ------------ //
-// iterator2d. //
-// ------------ //
+ // Explicitly map point2d and point3d to their concepts.
+ namespace concepts
+ {
+ concept_map Point2d<oln::point2d>
+ {
+ typedef oln::point2d::coord_type coord_type;
+ };
-namespace oln
+ concept_map Point3d<oln::point3d>
{
- struct iterator2d;
+ typedef oln::point2d::coord_type coord_type;
+ };
+
+ } // End of namespace oln::concepts
- template <typename T>
- struct image2d;
+
+ // ------------- //
+ // Iterator 2d. //
+ // ------------- //
+
+ // Forward declarations.
+ struct iterator2d;
+ template <typename T> struct image2d;
template<>
struct set_super_type<iterator2d>
{
- typedef Iterator<iterator2d> ret;
+ typedef mlc::none ret;
};
template <>
@@ -479,13 +435,13 @@
{
}
- void start()
+ void impl_start()
{
p.row = 0;
p.col = 0;
}
- void next()
+ void impl_next()
{
p.col = p.col + 1;
@@ -496,12 +452,12 @@
}
}
- bool is_valid() const
+ bool impl_is_valid() const
{
return p.row < nrows;
}
- operator point_t()
+ point_t& impl_op_point_type()
{
return p;
}
@@ -511,17 +467,14 @@
int ncols;
point_t p;
};
-}
-// --------- //
-// image2d. //
-// --------- //
+ // ---------- //
+ // Image 2d. //
+ // ---------- //
-namespace oln
-{
- template <typename T>
- struct image2d;
+ // Forward declaration.
+ template <typename T> struct image2d;
template<typename T>
struct set_super_type< image2d<T> >
@@ -540,9 +493,10 @@
template <typename T>
struct image2d : public image_base< image2d<T> >
{
- typedef oln_type_of(image2d, point) point_t;
- typedef oln_type_of(image2d, iter) iter_t;
- typedef oln_type_of(image2d, value) value_t;
+ typedef image2d<T> self_t;
+ typedef oln_type_of(self_t, point) point_t;
+ typedef oln_type_of(self_t, iter) iter_t;
+ typedef oln_type_of(self_t, value) value_t;
image2d(int nrows, int ncols) :
data (0),
@@ -552,22 +506,22 @@
data = new std::vector<value_t>;
}
- value_t& operator()(const point_t& p)
+ value_t& impl_op_parens(const point_t& p)
{
return this->data[p.row * nrows + p.col];
}
- int nrows_get() const
+ int impl_nrows_get() const
{
return nrows;
}
- int ncols_get() const
+ int impl_ncols_get() const
{
return ncols;
}
- bool has(point_t& p) const
+ bool impl_has(point_t& p) const
{
assert(!!data);
return p.row >= 0 && p.row < nrows && p.col >= 0
&& p.col < ncols;
@@ -578,34 +532,43 @@
int nrows;
int ncols;
};
-}
+
+
+ // ----------------- //
+ // Neighborhood 2d. //
+ // ----------------- //
+
+ struct niter2d {};
+
+ struct neighborhood2d
+ {
+ typedef niter2d niter_type;
+ };
// --------------- //
-// image_morpher. //
+ // Image morpher. //
// --------------- //
-namespace oln
-{
- template <typename E>
- struct image_morpher;
+ // Forward declaration.
+ template <typename E> struct image_morpher;
template<typename E>
struct set_super_type< image_morpher<E> >
{
- typedef image_base< image_morpher<E> > ret;
+ typedef image_base<E> ret;
};
template <typename E>
struct vtypes< image_morpher<E> >
{
- typedef mlc::undefined delegatee_t;
+ typedef stc::abstract delegatee_type;
};
template <typename E>
- struct image_morpher : public image_base< image_morpher<E> >
+ struct image_morpher : public image_base<E>
{
- typedef oln_type_of(image_morpher, delegatee) delegatee_t;
+ typedef oln_type_of(E, delegatee) delegatee_t;
image_morpher(delegatee_t& ref_ima) :
ref_ima (ref_ima)
@@ -619,20 +582,17 @@
protected:
delegatee_t& ref_ima;
};
-}
-// ------ //
-// plus. //
-// ------ //
+ // ------------------------- //
+ // Image with neighborhood. //
+ // ------------------------- //
-namespace oln
-{
- template <typename I, typename N>
- struct plus;
+ // Forward declaration.
+ template <typename I, typename N> struct plus;
template <typename I, typename N>
- struct set_super_type< image_morpher<plus<I, N> > >
+ struct set_super_type< plus<I, N> >
{
typedef image_morpher< plus <I, N> > ret;
};
@@ -640,30 +600,48 @@
template <typename I, typename N>
struct vtypes< plus<I, N> >
{
- typedef I delegatee_t;
+ typedef I delegatee_type;
+ typedef N nbh_type;
+ // For the sake of simplicity, the niter type is obtained directly
+ // from the neighborhood type itself (without using a virtual
+ // type).
+ typedef typename N::niter_type niter_type;
};
template <typename I, typename N>
struct plus : public image_morpher<plus<I, N> >
{
+ typedef plus<I, N> self_t;
+ typedef image_morpher<self_t> super_t;
+
plus(I& ima, N& nbh) :
+ super_t (ima),
nbh (nbh)
{
}
+ N impl_nbh() const
+ {
+ return nbh;
+ }
+
protected:
N& nbh;
};
- // Helper.
+ /// Helper.
template <typename I, typename N>
+ // FIXME: To be enabled later
+#if 0
+ requires concepts::Image<I>
+#endif
plus<I, N> operator+(I& lhs, N& rhs)
{
plus<I, N> res(lhs, rhs);
return res;
}
-}
+} // End of namespace oln.
/*--------------.
@@ -674,16 +652,25 @@
{
using namespace oln;
- typedef plus<image2d<int>, image_with_nbh> my_ima;
+ point2d p;
+ typedef image2d<int> ima_t;
+ ima_t ima1(10, 10);
- point2d p2d;
- point3d p3d;
+ iterator2d it(ima1);
- image2d<int> ima(10, 10);
- image_with_nbh ima_nb;
+ typedef neighborhood2d nbh_t;
- iterator2d it2d(ima);
+// // A type of image with neighborhood2d.
+// typedef plus<ima_t, nbh_t> ima_wih_nbh_t;
+// neighborhood2d nbh;
+// ima_wih_nbh_t ima2(ima1, nbh);
- // my_ima p = ima + ima_nb;
-}
+// // Another way to build an image with neigborhood.
+// ima_wih_nbh_t ima3 = ima1 + nbh;
+
+// // FIXME: Same with 3d.
+// point3d q;
+
+// // ...
+}
Index: samples/mini-oln/concept-c++/Makefile.am
--- samples/mini-oln/concept-c++/Makefile.am (revision 840)
+++ samples/mini-oln/concept-c++/Makefile.am (working copy)
@@ -14,8 +14,10 @@
# Hacky.
CXX = @CONCEPTCXX@
-check_PROGRAMS = mini-oln
+# FIXME: Disabled, since ConceptGCC fails to compile this sample
+# (dying with an Internal Compiler Error).
-mini_oln_SOURCES = mini-oln.cc
+# check_PROGRAMS = mini-oln
+# mini_oln_SOURCES = mini-oln.cc
-TESTS = $(check_PROGRAMS)
+# TESTS = $(check_PROGRAMS)
Index: samples/mini-oln/mini-oln.cc
--- samples/mini-oln/mini-oln.cc (revision 840)
+++ samples/mini-oln/mini-oln.cc (working copy)
@@ -62,18 +62,6 @@
}
-// --------------------- //
-// Forward declarations. //
-// --------------------- //
-
-// FIXME: Remove.
-namespace oln
-{
- struct point2d;
- struct point3d;
-}
-
-
/*---------------.
| Abstractions. |
`---------------*/
@@ -89,6 +77,7 @@
{
};
+
// ---------- //
// Iterator. //
// ---------- //
@@ -133,7 +122,7 @@
value_t& operator ()(point_t& p)
{
- return this->exact().impl_op_paren(p);
+ return this->exact().impl_op_parens(p);
}
bool has(const point_t& p) const
@@ -156,7 +145,7 @@
//FIXME: delete?
value_t& operator ()(point_t& p)
{
- return this->exact().impl_op_paren(p);
+ return this->exact().impl_op_parens(p);
}
int nrows_get() const
@@ -184,7 +173,7 @@
//FIXME: delete?
value_t& operator ()(point_t& p)
{
- return this->exact().impl_operator_paren(p);
+ return this->exact().impl_op_parens(p);
}
int nrows_get() const
@@ -212,8 +201,8 @@
struct Image_with_neighborhood : public Image<E>
{
typedef oln_type_of(E, nbh) nbh_t;
+ typedef oln_type_of(E, niter) niter_t;
- // FIXME: Implement.
nbh_t nbh() const
{
return this->exact().impl_nbh();
@@ -265,13 +254,13 @@
// Image base. //
// ------------ //
- template <typename E>
- struct image_base;
+ // Forward declaration.
+ template <typename E> struct image_base;
template<typename E>
struct set_super_type< image_base<E> >
{
- typedef typename mlc::none ret;
+ typedef mlc::none ret;
};
template <typename E>
@@ -299,6 +288,7 @@
/*------------------.
| Implementations. |
`------------------*/
+
namespace oln
{
// -------- //
@@ -319,15 +309,13 @@
};
- // ------------ //
+ // ------------- //
// Iterator2d. //
- // ------------ //
+ // ------------- //
// Forward declarations.
struct iterator2d;
-
- template <typename T>
- struct image2d;
+ template <typename T> struct image2d;
template<>
struct set_super_type<iterator2d>
@@ -374,7 +362,7 @@
return p.row < nrows;
}
- point_t& impl_op_point_t()
+ point_t& impl_op_point_type()
{
return p;
}
@@ -390,8 +378,8 @@
// Image 2d. //
// ---------- //
- template <typename T>
- struct image2d;
+ // Forward declaration.
+ template <typename T> struct image2d;
template<typename T>
struct set_super_type< image2d<T> >
@@ -410,9 +398,10 @@
template <typename T>
struct image2d : public image_base< image2d<T> >
{
- typedef oln_type_of(image2d, point) point_t;
- typedef oln_type_of(image2d, iter) iter_t;
- typedef oln_type_of(image2d, value) value_t;
+ typedef image2d<T> self_t;
+ typedef oln_type_of(self_t, point) point_t;
+ typedef oln_type_of(self_t, iter) iter_t;
+ typedef oln_type_of(self_t, value) value_t;
image2d(int nrows, int ncols) :
data (0),
@@ -422,7 +411,7 @@
data = new std::vector<value_t>;
}
- value_t& impl_op_paren(const point_t& p)
+ value_t& impl_op_parens(const point_t& p)
{
return this->data[p.row * nrows + p.col];
}
@@ -466,8 +455,8 @@
// Image morpher. //
// --------------- //
- template <typename E>
- struct image_morpher;
+ // Forward declaration.
+ template <typename E> struct image_morpher;
template<typename E>
struct set_super_type< image_morpher<E> >
@@ -504,8 +493,8 @@
// Image with neighborhood. //
// ------------------------- //
- template <typename I, typename N>
- struct plus;
+ // Forward declaration.
+ template <typename I, typename N> struct plus;
template <typename I, typename N>
struct set_super_type< plus<I, N> >
@@ -581,6 +570,7 @@
ima_wih_nbh_t ima3 = ima1 + nbh;
+ // FIXME: Same with 3d.
point3d q;
// ...