Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
December 2006
- 2 participants
- 7 discussions
olena-0.10 10.269: Add a more generic version of Salembier's algorithm
by Roland Levillain 20 Dec '06
by Roland Levillain 20 Dec '06
20 Dec '06
2006-12-20 Roland Levillain <roland(a)lrde.epita.fr>
Add a more generic version of Salembier's algorithm.
* oln/lrde/ufmt/basic_salembier.hh
(oln::lrde::ufmt::hqueue_t::print): New method.
* oln/lrde/ufmt/generic_salembier.hh: New.
* oln/lrde/ufmt/bin/basic_salembier.cc: Add a timer.
* oln/lrde/ufmt/bin/generic_salembier_int_u8.cc,
* oln/lrde/ufmt/bin/generic_salembier_float.cc: New.
* oln/lrde/Makefile.am (SUBDIRS): Add efigi.
* oln/lrde/ufmt/bin/Makefile.am (check_PROGRAMS): Add
generic_salembier_int_u8 and generic_salembier_float.
(generic_salembier_int_u8_SOURCES)
(generic_salembier_float_SOURCES)
(generic_salembier_float_LDFLAGS): New.
* oln/lrde/efigi/pgm2pfm_wo_noise.cc: New
* oln/lrde/efigi/Makefile.am: New.
--- 10.268/olena/oln/lrde/ufmt/basic_salembier.hh Thu, 03 Aug 2006 16:06:43 +0200 theo (oln/w/51_basic_sale 1.1 644)
+++ 10.269/olena/oln/lrde/ufmt/basic_salembier.hh Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/w/51_basic_sale 1.2 644)
@@ -36,7 +36,6 @@
# include <oln/lrde/ufmt/utils.hh>
-
namespace oln
{
@@ -46,6 +45,13 @@
namespace ufmt
{
+ /*-----------------------------------------------------------.
+ | Original version of Salembier's algorithm (working only on |
+ | image of unsigned integers). |
+ `-----------------------------------------------------------*/
+
+ /// Version of hqueue for unsigned values, using an array of
+ /// queues, indexed by the gray level.
template <class P>
struct hqueue_t
{
@@ -91,10 +97,29 @@
return s;
}
+ void print (std::ostream& os)
+ {
+ os << "hqueue = {";
+ for (unsigned h = 0; h < nvalues; ++h)
+ if (not empty(h))
+ {
+ os << " " << h << " -> { ";
+ std::queue<P> queue_copy = q[h];
+ while (not queue_copy.empty())
+ {
+ os << queue_copy.front () << " ";
+ queue_copy.pop();
+ }
+ os << "}";
+ }
+ os << " }" << std::endl;
+ }
+
std::queue<P>* q;
};
+ /// Salembier's algorithm -- Version for images of unsigned integers.
template <class I>
struct basic_salembier
{
@@ -175,6 +200,7 @@
while (not hqueue.empty(h))
{
point p = hqueue.first(h);
+
status[p] = number_nodes[h];
oln_neighb_type(Nbh) q(nbh, p);
@@ -204,7 +230,7 @@
if (m >= 0)
{
int j = number_nodes[m];
- father[pair_t(i, h)] = pair_t(j, m );
+ father[pair_t(i, h)] = pair_t(j, m);
}
else
{
@@ -223,7 +249,6 @@
}; // end of struct basic_salembier
-
} // end of namespace oln::lrde::ufmt
} // end of namespace oln::lrde
--- 10.268/olena/oln/lrde/ufmt/bin/basic_salembier.cc Mon, 21 Aug 2006 17:17:14 +0200 theo (oln/x/1_basic_sale 1.2 644)
+++ 10.269/olena/oln/lrde/ufmt/bin/basic_salembier.cc Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/x/1_basic_sale 1.3 644)
@@ -3,6 +3,7 @@
#include <ntg/int.hh>
#include <oln/basics2d.hh>
+#include <oln/utils/timer.hh>
#include <oln/lrde/ufmt/basic_salembier.hh>
@@ -10,7 +11,8 @@
void usage(char* argv[])
{
std::cerr << "usage: " << argv[0] << " input.pgm c" << std::endl;
- std::cerr << "basic max-tree computation with salembier's flooding" << std::endl;
+ std::cerr << "basic max-tree computation with salembier's flooding"
+ << std::endl;
// FIXME: get precise description...
exit(1);
}
@@ -25,6 +27,7 @@
typedef image2d<ntg::int_u8> image_t;
image_t input = load(argv[1]);
+ assert (input.has_impl());
int c = atoi(argv[2]);
if (not (c == 2 or c == 4 or c == 8))
@@ -39,6 +42,10 @@
nbh = c == 4 ? neighb_c4() : neighb_c8();
algorithm_t run(input, nbh);
+ utils::timer t;
+ t.start();
run.go();
- std::cout << "n level roots = " << run.n_level_roots() << std::endl;
+ t.stop();
+ std::cout << "n level roots = " << run.n_level_roots() << std::endl
+ << "elapsed time = " << t.last_time() << std::endl;
}
--- 10.268/olena/oln/lrde/Makefile.am Fri, 25 Aug 2006 17:56:35 +0200 levill_r (oln/x/25_Makefile.a 1.1 644)
+++ 10.269/olena/oln/lrde/Makefile.am Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/x/25_Makefile.a 1.2 644)
@@ -5,5 +5,5 @@
## The contents of `olena/lrde' should be moved to subdirectory of
## `olena/oln', and the contents of `olena/lrde/ufmt/bin to `olena/tests'
## or to `tools'.
-SUBDIRS = ufmt
+SUBDIRS = efigi ufmt
## ---------------------------------------- FIXME: Improve integration. --
--- 10.268/olena/oln/lrde/ufmt/Makefile.am Fri, 20 Oct 2006 19:13:44 +0200 levill_r (oln/x/26_Makefile.a 1.4 644)
+++ 10.269/olena/oln/lrde/ufmt/Makefile.am Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/x/26_Makefile.a 1.5 644)
@@ -14,7 +14,10 @@
attributes.hh \
basic_maxtree.hh \
basic_najman.hh \
+ \
basic_salembier.hh \
+ generic_salembier.hh \
+ \
fiorio-1.hh \
fiorio-2.hh \
fiorio-3.hh \
--- 10.268/olena/oln/lrde/ufmt/bin/Makefile.am Tue, 29 Aug 2006 14:48:46 +0200 levill_r (oln/x/29_Makefile.a 1.3 644)
+++ 10.269/olena/oln/lrde/ufmt/bin/Makefile.am Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/x/29_Makefile.a 1.4 644)
@@ -3,17 +3,24 @@
check_PROGRAMS = \
basic_maxtree basic_najman basic_salembier \
+ generic_salembier_int_u8 generic_salembier_float \
fiorio-1 fiorio-2 fiorio-3 \
hdc_maxtree hpc_maxtree r1ic_maxtree rpc_maxtree
basic_maxtree_SOURCES = basic_maxtree.cc
basic_najman_SOURCES = basic_najman.cc
basic_salembier_SOURCES = basic_salembier.cc
+
+generic_salembier_int_u8_SOURCES = generic_salembier_int_u8.cc
+generic_salembier_float_SOURCES = generic_salembier_float.cc
+generic_salembier_float_LDFLAGS = -lcfitsio $(ZLIB_LDFLAGS)
+
fiorio_1_SOURCES = fiorio.cc
fiorio_2_SOURCES = fiorio.cc
fiorio_2_CPPFLAGS = -DFIORIO_VERSION=2
fiorio_3_SOURCES = fiorio.cc
fiorio_3_CPPFLAGS = -DFIORIO_VERSION=3
+
hdc_maxtree_SOURCES = hdc_maxtree.cc
hpc_maxtree_SOURCES = hpc_maxtree.cc
r1ic_maxtree_SOURCES = r1ic_maxtree.cc
Only in 10.269: olena/oln/lrde/efigi/pgm2pfm_wo_noise.cc
Only in 10.269: olena/oln/lrde/efigi/Makefile.am
Only in 10.269: olena/oln/lrde/ufmt/naive_generic_salembier.hh
Only in 10.269: olena/oln/lrde/ufmt/generic_salembier.hh
Only in 10.269: olena/oln/lrde/ufmt/bin/generic_salembier_int_u8.cc
Only in 10.269: olena/oln/lrde/ufmt/bin/generic_salembier_float.cc
--- 10.268/configure.ac Fri, 25 Aug 2006 17:56:35 +0200 levill_r (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.10 600)
+++ 10.269/configure.ac Wed, 20 Dec 2006 14:46:12 +0100 levill_r (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.11 600)
@@ -469,6 +469,7 @@
## `olena/oln', and the contents of `olena/lrde/ufmt/bin to `olena/tests'
## or to `tools'.
AC_CONFIG_FILES([olena/oln/lrde/Makefile
+ olena/oln/lrde/efigi/Makefile
olena/oln/lrde/ufmt/Makefile
olena/oln/lrde/ufmt/bin/Makefile])
## ---------------------------------------- FIXME: Improve integration. --
--- 10.268/oln.prj
+++ 10.269/oln.prj
@@ -1,25 +1,31 @@
;; -*- Prcs -*-
(Created-By-Prcs-Version 1 3 3)
(Project-Description "Olena")
-(Project-Version oln 10 268)
-(Parent-Version oln 10 255)
-(Version-Log "2006-12-15 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
-
- Add some EFIGI utilities.
-
- * olena/oln/lrde/efigi/pfm2pgm.cc,
- * olena/oln/lrde/efigi/misc.hh,
- * olena/oln/lrde/efigi/io.hh,
- * olena/oln/lrde/efigi/req.hh,
- * olena/oln/lrde/efigi/wst.cc,
- * olena/oln/lrde/efigi/gaussian.cc,
- * olena/oln/lrde/efigi/pgm2pfm.cc,
- * olena/oln/lrde/efigi/wst.hh:
- New.
+(Project-Version oln 10 269)
+(Parent-Version oln 10 268)
+(Version-Log "2006-12-20 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Add a more generic version of Salembier's algorithm.
+
+ * oln/lrde/ufmt/basic_salembier.hh
+ (oln::lrde::ufmt::hqueue_t::print): New method.
+ * oln/lrde/ufmt/generic_salembier.hh: New.
+ * oln/lrde/ufmt/bin/basic_salembier.cc: Add a timer.
+ * oln/lrde/ufmt/bin/generic_salembier_int_u8.cc,
+ * oln/lrde/ufmt/bin/generic_salembier_float.cc: New.
+ * oln/lrde/Makefile.am (SUBDIRS): Add efigi.
+ * oln/lrde/ufmt/bin/Makefile.am (check_PROGRAMS): Add
+ generic_salembier_int_u8 and generic_salembier_float.
+ (generic_salembier_int_u8_SOURCES)
+ (generic_salembier_float_SOURCES)
+ (generic_salembier_float_LDFLAGS): New.
+
+ * oln/lrde/efigi/pgm2pfm_wo_noise.cc: New
+ * oln/lrde/efigi/Makefile.am: New.
")
(New-Version-Log "")
-(Checkin-Time "Fri, 15 Dec 2006 10:22:33 +0100")
-(Checkin-Login theo)
+(Checkin-Time "Wed, 20 Dec 2006 14:46:12 +0100")
+(Checkin-Login levill_r)
;; diff-ignore tests/data/.*pbm$
;; diff-ignore .*\.pbm$
;; diff-ignore .*\.pgm$
@@ -131,11 +137,11 @@
(Project-Keywords)
(Files
- (ChangeLog (oln/o/33_ChangeLog 1.37.1.16.1.17.1.19.1.29 600))
+ (ChangeLog (oln/o/33_ChangeLog 1.37.1.16.1.17.1.19.1.30 600))
(doc/ChangeLog (oln/o/31_ChangeLog 1.38.1.7.1.5.1.14.1.17 600))
(integre/ChangeLog (oln/q/35_ChangeLog 1.12.1.2.1.51 600))
(metalic/ChangeLog (oln/q/30_ChangeLog 1.3.1.44 600))
- (olena/ChangeLog (oln/o/30_ChangeLog 1.27.1.36.1.3.1.11.1.5.1.64.1.47.1.93.1.27.2.18.1.7 600))
+ (olena/ChangeLog (oln/o/30_ChangeLog 1.27.1.36.1.3.1.11.1.5.1.64.1.47.1.93.1.27.2.18.1.8 600))
(tools/ChangeLog (oln/o/32_ChangeLog 1.10.1.17 600))
(tools/swilena/ChangeLog (oln/n/37_ChangeLog 1.7.1.52 600))
@@ -147,7 +153,7 @@
(cleanup.sh (oln/o/29_cleanup.sh 1.6 700))
- (configure.ac (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.10 600))
+ (configure.ac (oln/3_configure. 1.47.1.1.1.1.1.4.1.15.1.16.1.11 600))
(doc/demo/image.cc (oln/d/46_image.cc 1.8 600))
(doc/demo/Makefile.am (oln/d/44_Makefile.a 1.16.1.2 600))
@@ -1537,9 +1543,9 @@
- (olena/oln/lrde/ufmt/basic_salembier.hh (oln/w/51_basic_sale 1.1 644))
+ (olena/oln/lrde/ufmt/basic_salembier.hh (oln/w/51_basic_sale 1.2 644))
(olena/oln/lrde/ufmt/bin/basic_maxtree.cc (oln/x/0_basic_maxt 1.2 644))
- (olena/oln/lrde/ufmt/bin/basic_salembier.cc (oln/x/1_basic_sale 1.2 644))
+ (olena/oln/lrde/ufmt/bin/basic_salembier.cc (oln/x/1_basic_sale 1.3 644))
(olena/oln/lrde/ufmt/bin/gppo (oln/x/2_gppo 1.1.1.1 755))
(olena/oln/lrde/ufmt/bin/gpp (oln/x/3_gpp 1.1.1.1 755))
@@ -1586,11 +1592,11 @@
(TODO (oln/x/23_TODO 1.1 644))
(olena/TODO (oln/x/24_TODO 1.1 644))
- (olena/oln/lrde/Makefile.am (oln/x/25_Makefile.a 1.1 644))
- (olena/oln/lrde/ufmt/Makefile.am (oln/x/26_Makefile.a 1.4 644))
+ (olena/oln/lrde/Makefile.am (oln/x/25_Makefile.a 1.2 644))
+ (olena/oln/lrde/ufmt/Makefile.am (oln/x/26_Makefile.a 1.5 644))
(olena/oln/lrde/ufmt/fiorio-1.hh (oln/x/27_fiorio-1.h 1.3 644))
(olena/oln/lrde/ufmt/fiorio-2.hh (oln/x/28_fiorio-2.h 1.3 644))
- (olena/oln/lrde/ufmt/bin/Makefile.am (oln/x/29_Makefile.a 1.3 644))
+ (olena/oln/lrde/ufmt/bin/Makefile.am (oln/x/29_Makefile.a 1.4 644))
(olena/oln/lrde/ufmt/bin/fiorio.cc (oln/x/30_fiorio.cc 1.3 644))
;; Files added by populate at Mon, 28 Aug 2006 10:51:36 +0200,
;; to version 10.249(w), by theo:
@@ -1648,21 +1654,18 @@
(olena/oln/lrde/ufmt/fiorio-3.hh (oln/x/44_fiorio-3.h 1.1 644))
(olena/oln/lrde/ufmt/img/lena64nb.pgm (oln/x/47_lena64nb.p 1.1 644) :no-keywords)
- (olena/oln/lrde/ufmt/img/lena64.pbm (oln/x/48_lena64.pbm 1.1 644) :no-keywords))
+ (olena/oln/lrde/ufmt/img/lena64.pbm (oln/x/48_lena64.pbm 1.1 644) :no-keywords)
+;; Files added by populate at Wed, 20 Dec 2006 11:47:55 +0100,
+;; to version 10.268(w), by levill_r:
+
+ (olena/oln/lrde/efigi/pgm2pfm_wo_noise.cc (oln/y/5_pgm2pfm_wo 1.1 644))
+ (olena/oln/lrde/efigi/Makefile.am (oln/y/6_Makefile.a 1.1 644))
+ (olena/oln/lrde/ufmt/naive_generic_salembier.hh (oln/y/7_naive_gene 1.1 644))
+ (olena/oln/lrde/ufmt/generic_salembier.hh (oln/y/8_generic_sa 1.1 644))
+ (olena/oln/lrde/ufmt/bin/generic_salembier_int_u8.cc (oln/y/9_generic_sa 1.1 644))
+ (olena/oln/lrde/ufmt/bin/generic_salembier_float.cc (oln/y/10_generic_sa 1.1 644))
+)
(Merge-Parents
- (10.267 complete
- (olena/ChangeLog olena/ChangeLog olena/ChangeLog m) (tools/swilena/ChangeLog tools/swilena/ChangeLog tools/swilena/ChangeLog r)
- (olena/oln/Makefile.am olena/oln/Makefile.am olena/oln/Makefile.am r) (tools/swilena/ruby/Makefile.am tools/swilena/ruby/Makefile.am tools/swilena/ruby/Makefile.am r)
- (tools/swilena/python/Makefile.am tools/swilena/python/Makefile.am tools/swilena/python/Makefile.am r) (olena/oln/makefile.src olena/oln/makefile.src olena/oln/makefile.src r)
- (tools/swilena/ruby/ltrequire.rb tools/swilena/ruby/ltrequire.rb tools/swilena/ruby/ltrequire.rb r) (olena/oln/lrde/ufmt/bin/gppo olena/oln/lrde/ufmt/bin/gppo olena/oln/lrde/ufmt/bin/gppo r)
- (olena/oln/lrde/ufmt/bin/gpp olena/oln/lrde/ufmt/bin/gpp olena/oln/lrde/ufmt/bin/gpp r) (olena/oln/lrde/ufmt/bin/inc olena/oln/lrde/ufmt/bin/inc () d)
- (olena/oln/lrde/ufmt/utils.hh olena/oln/lrde/ufmt/utils.hh olena/oln/lrde/ufmt/utils.hh r) (olena/oln/lrde/ufmt/README olena/oln/lrde/ufmt/README olena/oln/lrde/ufmt/README r)
- (olena/oln/lrde/ufmt/Makefile.am olena/oln/lrde/ufmt/Makefile.am olena/oln/lrde/ufmt/Makefile.am r) (olena/oln/lrde/ufmt/fiorio-1.hh olena/oln/lrde/ufmt/fiorio-1.hh olena/oln/lrde/ufmt/fiorio-1.hh r)
- (olena/oln/lrde/ufmt/fiorio-2.hh olena/oln/lrde/ufmt/fiorio-2.hh olena/oln/lrde/ufmt/fiorio-2.hh r) (olena/oln/lrde/ufmt/bin/Makefile.am olena/oln/lrde/ufmt/bin/Makefile.am olena/oln/lrde/ufmt/bin/Makefile.am r)
- (olena/oln/lrde/ufmt/bin/fiorio.cc olena/oln/lrde/ufmt/bin/fiorio.cc olena/oln/lrde/ufmt/bin/fiorio.cc r) (olena/oln/lrde/ufmt/attributes.hh olena/oln/lrde/ufmt/attributes.hh olena/oln/lrde/ufmt/attributes.hh r)
- (olena/oln/lrde/ufmt/attributes_bis.hh olena/oln/lrde/ufmt/attributes_bis.hh olena/oln/lrde/ufmt/attributes_bis.hh r) (olena/oln/lrde/ufmt/basic_najman.hh olena/oln/lrde/ufmt/basic_najman.hh olena/oln/lrde/ufmt/basic_najman.hh r)
- (() () olena/oln/lrde/ufmt/fiorio-3.hh a) (() () olena/oln/lrde/ufmt/img/lena64nb.pgm a)
- (() () olena/oln/lrde/ufmt/img/lena64.pbm a)
- )
+ (10.268 complete)
)
(New-Merge-Parents)
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
New prototype for SCOOP 2 algorithms.
* stc/scoop2.hh: New (prototype).
* tests/scoop2.cc: New test.
* stc/Makefile.am (nobase_stc_HEADERS): Add scoop2.hh
* tests/Makefile.am (check_PROGRAMS): Add scoop2.
(scoop2_SOURCES): New.
stc/Makefile.am | 4
stc/scoop2.hh | 689 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/Makefile.am | 7
tests/scoop2.cc | 657 +++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 1355 insertions(+), 2 deletions(-)
Index: tests/Makefile.am
--- tests/Makefile.am (revision 717)
+++ tests/Makefile.am (working copy)
@@ -21,7 +21,10 @@
vtypes \
vtypes-and-exact \
\
- tour
+ tour \
+ \
+ scoop2
+
any_SOURCES = any.cc
entry_SOURCES = entry.cc
@@ -33,6 +36,8 @@
tour_SOURCES = tour.cc
+scoop2_SOURCES = scoop2.cc
+
# Old tests.
EXTRA_DIST = multiple-supers.cc vtypes-multiple-supers.cc
Index: tests/scoop2.cc
--- tests/scoop2.cc (revision 0)
+++ tests/scoop2.cc (revision 0)
@@ -0,0 +1,657 @@
+// 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.
+
+
+/// This test focuses on the virtual types system, so the exact type of
+/// classes is not propagated here (stc::any is not used).
+
+/// These examples comes from doc/algorithm.ml.
+
+
+#include <mlc/cmp.hh>
+#include <mlc/assert.hh>
+
+#include <stc/scoop2.hh>
+
+/* FIXME: To be enabled later, when the contents of stc/scoop2.hh is
+ enclosed in a macro. */
+#if 0
+// Namespace equipment.
+stc_scoop_equipment_for_namespace(my);
+#endif
+
+// FIXME: Check single_vtype, too.
+
+namespace my
+{
+ // ------------------------------------------------------------ Typedefs.
+
+ mlc_decl_typedef(my_type);
+
+ mlc_decl_typedef(foo_type);
+ mlc_decl_typedef(bar_type);
+ mlc_decl_typedef(baz_type);
+ mlc_decl_typedef(quux_type);
+ mlc_decl_typedef(hop_type);
+
+ mlc_decl_typedef(value_type);
+
+
+
+ /* ---------------------------------------------------------------- Ex 1.
+
+ ** Virtual type definition
+
+ Ex.
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+ */
+
+ namespace ex1
+ {
+ // Forward declaration.
+ struct A;
+ }
+
+ // Set super type.
+ template <> struct set_super_type<ex1::A> { typedef stc::none ret; };
+
+ /// Virtual types associated to A.
+ template <>
+ struct vtypes<ex1::A>
+ {
+ typedef int my_type;
+ };
+
+ namespace ex1
+ {
+ struct A : public stc::none {};
+
+ void
+ check()
+ {
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex1::A, my), int)
+ >::check();
+ }
+ }
+
+ /* ---------------------------------------------------------------- Ex 2.
+
+ ** Virtual type re-definition.
+
+ Ex.
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+ // Valid.
+ class B < A =
+ {
+ vtype my_type = float;
+ }
+ // Valid.
+ class C < A =
+ {
+ vtype my_type = int;
+ }
+ */
+
+ namespace ex2
+ {
+ // Forward declarations.
+ struct A;
+ struct B;
+ struct C;
+ }
+
+ // Set super types.
+ template <> struct set_super_type<ex2::A> { typedef stc::none ret; };
+ template <> struct set_super_type<ex2::B> { typedef ex2::A ret; };
+ template <> struct set_super_type<ex2::C> { typedef ex2::B ret; };
+
+ /// Virtual types associated to A.
+ template <>
+ struct vtypes<ex2::A>
+ {
+ typedef int my_type;
+ };
+
+ /// Virtual types associated to B.
+ template <>
+ struct vtypes<ex2::B>
+ {
+ typedef float my_type;
+ };
+
+ /// Virtual types associated to C.
+ template <>
+ struct vtypes<ex2::C>
+ {
+ typedef int my_type;
+ };
+
+ namespace ex2
+ {
+ struct A : public stc::none {};
+ struct B : public A {};
+ struct C : public B {};
+
+ void
+ check()
+ {
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex2::A, my), int)
+ >::check();
+
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex2::B, my), float)
+ >::check();
+
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex2::C, my), int)
+ >::check();
+ }
+ }
+
+
+ /* ---------------------------------------------------------------- Ex 3.
+
+ ** Virtual type abstract declaration (i.e., deferred definition).
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ // my_type is abstract.
+ vtype my_type = 0;
+ }
+ class B < A =
+ {
+ vtype my_type = int;
+ }
+ */
+
+ namespace ex3
+ {
+ // Forward declarations.
+ struct A;
+ struct B;
+ }
+
+ // Set super types.
+ template <> struct set_super_type<ex3::A> { typedef stc::none ret; };
+ template <> struct set_super_type<ex3::B> { typedef ex3::A ret; };
+
+ /// Virtual types associated to A.
+ template <>
+ struct vtypes<ex3::A>
+ {
+ typedef stc::abstract my_type;
+ };
+
+ /// Virtual types associated to B.
+ template <>
+ struct vtypes<ex3::B>
+ {
+ typedef int my_type;
+ };
+
+ namespace ex3
+ {
+ struct A : public stc::none {};
+ struct B : public A {};
+
+ void
+ check()
+ {
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex3::B, my), int)
+ >::check();
+ }
+ }
+
+
+ /* ---------------------------------------------------------------- Ex 4.
+
+ ** Final virtual type
+
+ - A virtual type can be tagged as final.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ final vtype my_type = int;
+ }
+ */
+
+ namespace ex4
+ {
+ // Forward declaration.
+ struct A;
+ }
+
+ // Set super type.
+ template <> struct set_super_type<ex4::A> { typedef stc::none ret; };
+
+ /// Virtual types associated to A.
+ template <>
+ struct vtypes<ex4::A>
+ {
+ typedef stc::final<int> my_type;
+ };
+
+ namespace ex4
+ {
+ struct A : public stc::none {};
+
+ void
+ check()
+ {
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex4::A, my), int)
+ >::check();
+ }
+ }
+
+
+ /* ---------------------------------------------------------------- Ex 5.
+
+ ** General virtual type lookup (i.e., with delegation)
+
+ *** Abstract
+
+ class A < stc::none
+ {
+ // my_vtype not defined.
+ }
+
+ class D < stc::none
+ {
+ vtype my_type = 0;
+ }
+
+ // A
+ // ^
+ // |
+ // C<>--D
+ class C < stc::none
+ {
+ vtype delegatee_type = D;
+ }
+
+ type t = C#my_type;
+ */
+
+ namespace ex5
+ {
+ // Forward declarations.
+ struct A;
+ struct D;
+ struct C;
+ }
+
+ // Set super types.
+ template <> struct set_super_type<ex5::A> { typedef stc::none ret; };
+ template <> struct set_super_type<ex5::D> { typedef stc::none ret; };
+ template <> struct set_super_type<ex5::C> { typedef ex5::A ret; };
+
+ /// Virtual types associated to A.
+ template <>
+ struct vtypes<ex5::A>
+ {
+ };
+
+ /// Virtual types associated to D.
+ template <>
+ struct vtypes<ex5::D>
+ {
+ typedef stc::abstract my_type;
+ };
+
+ /// Virtual types associated to C.
+ template <>
+ struct vtypes<ex5::C>
+ {
+ typedef ex5::D delegatee_type;
+ };
+
+ namespace ex5
+ {
+ struct A : public stc::none {};
+ struct D : public stc::none {};
+ struct C : public A {};
+
+ void
+ check()
+ {
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex5::C, my), stc::not_found)
+ >::check();
+ }
+ }
+
+
+ /* ---------------------------------------------------------------- Ex 6.
+
+ * More examples.
+
+ ** A complex example, with stc::not_delegated.
+
+ A
+ ^
+ | X
+ B ^
+ ^ |
+ | Y
+ C<>-�
+ ^
+ |
+ D
+ ^
+ |
+ E
+
+
+ class A < stc::none | class C < B
+ { | {
+ } | vtype delegatee_type = Y;
+ class B < A | vtype foo = int;
+ { | vtype baz = not_delegated;
+ vtype foo = 0; | vtype hop = not_delegated;
+ } | }
+ | class D < C
+ class X < stc::none | {
+ { | vtype quux = unsigned;
+ vtype bar = 0; | }
+ vtype hop = int; | class E < D
+ } | {
+ class Y < X | vtype baz = float;
+ { | }
+ vtype baz = short; |
+ vtype bar = char; |
+ } |
+ */
+
+ namespace ex6
+ {
+ // Forward declarations.
+ struct A;
+ struct B;
+
+ struct X;
+ struct Y;
+
+ struct C;
+ struct D;
+ struct E;
+ }
+
+ // Set super types.
+ template <> struct set_super_type<ex6::A> { typedef stc::none ret; };
+ template <> struct set_super_type<ex6::B> { typedef ex6::A ret; };
+
+ template <> struct set_super_type<ex6::X> { typedef stc::none ret; };
+ template <> struct set_super_type<ex6::Y> { typedef ex6::X ret; };
+
+ template <> struct set_super_type<ex6::C> { typedef ex6::B ret; };
+ template <> struct set_super_type<ex6::D> { typedef ex6::C ret; };
+ template <> struct set_super_type<ex6::E> { typedef ex6::D ret; };
+
+ /// Virtual types associated to A.
+ template <>
+ struct vtypes<ex6::A>
+ {
+ };
+
+ /// Virtual types associated to B.
+ template <>
+ struct vtypes<ex6::B>
+ {
+ typedef stc::abstract foo_type;
+ };
+
+ /// Virtual types associated to X.
+ template <>
+ struct vtypes<ex6::X>
+ {
+ typedef stc::abstract bar_type;
+ typedef int hop_type;
+ };
+
+ /// Virtual types associated to Y.
+ template <>
+ struct vtypes<ex6::Y>
+ {
+ typedef short baz_type;
+ typedef char bar_type;
+ };
+
+ /// Virtual types associated to C.
+ template <>
+ struct vtypes<ex6::C>
+ {
+ typedef ex6::Y delegatee_type;
+ typedef int foo_type;
+ typedef stc::not_delegated baz_type;
+ typedef stc::not_delegated hop_type;
+ };
+
+ /// Virtual types associated to D.
+ template <>
+ struct vtypes<ex6::D>
+ {
+ typedef unsigned quux_type;
+ };
+
+ /// Virtual types associated to E.
+ template <>
+ struct vtypes<ex6::E>
+ {
+ typedef float baz_type;
+ };
+
+ namespace ex6
+ {
+ struct A : public stc::none {};
+ struct B : public A {};
+
+ struct X : public stc::none {};
+ struct Y : public X {};
+
+ struct C : public B {};
+ struct D : public C {};
+ struct E : public D {};
+
+ void
+ check()
+ {
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex6::E, foo), int)
+ >::check();
+
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex6::E, bar), char)
+ >::check();
+
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex6::E, baz), float)
+ >::check();
+
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex6::E, quux), unsigned)
+ >::check();
+
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex6::E, hop), stc::not_found)
+ >::check();
+ }
+ }
+
+
+ /* ---------------------------------------------------------------- Ex 7.
+
+ *** Olena-like examples.
+
+ class /image_entry/ < stc::none
+ {
+ vtype value_type = 0;
+ }
+
+ class image2d<int> < image_entry
+ {
+ vtypes value_type = int;
+ }
+
+ class /value_morpher/ < image_entry
+ {
+ vtype delegatee_type = 0;
+ vtype value_type = stc::not_delegated;
+ }
+
+ class value_cast<image2d<int>, float> < value_morpher
+ {
+ vtype delegatee_type = image2d<int>;
+ vtype value_type = float;
+ }
+ */
+
+ namespace ex7
+ {
+ // Forward declarations.
+ namespace abstract
+ {
+ struct image_entry;
+ struct value_morpher;
+ }
+
+ template <typename T> struct image2d;
+ template <typename I, typename T> struct value_cast;
+ }
+
+ // Set super types.
+ template <>
+ struct set_super_type<ex7::abstract::image_entry>
+ {
+ typedef stc::none ret;
+ };
+ template <>
+ struct set_super_type<ex7::abstract::value_morpher>
+ {
+ typedef ex7::abstract::image_entry ret;
+ };
+ template <typename T>
+ struct set_super_type< ex7::image2d<T> >
+ {
+ typedef ex7::abstract::image_entry ret;
+ };
+ template <typename I, typename T>
+ struct set_super_type< ex7::value_cast<I, T> >
+ {
+ typedef ex7::abstract::value_morpher ret;
+ };
+
+
+ /// Virtual types associated to abstract::image_entry.
+ template <>
+ struct vtypes<ex7::abstract::image_entry>
+ {
+ typedef stc::abstract value_type;
+ };
+
+ /// Virtual types associated to abstract::value_morpher.
+ template <>
+ struct vtypes<ex7::abstract::value_morpher>
+ {
+ typedef stc::abstract delegatee_type;
+ typedef stc::not_delegated value_type;
+ };
+
+ /// Virtual types associated to image2d<T>.
+ template <typename T>
+ struct vtypes< ex7::image2d<T> >
+ {
+ typedef T value_type;
+ };
+
+ /// Virtual types associated to value_cast<I, T>.
+ template <typename I, typename T>
+ struct vtypes< ex7::value_cast<I, T> >
+ {
+ typedef I delegatee_type;
+ typedef T value_type;
+ };
+
+
+ namespace ex7
+ {
+ namespace abstract
+ {
+ struct image_entry : public stc::none {};
+ struct value_morpher : public image_entry {};
+ }
+
+ template <typename T>
+ struct image2d : public abstract::image_entry {};
+
+ template <typename I, typename T>
+ struct value_cast : public abstract::value_morpher {};
+
+
+ void
+ check()
+ {
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, my::ex7::image2d<int>, value), int)
+ >::check();
+
+ typedef value_cast< image2d<int>, float> morphed_type;
+ mlc::assert_<
+ mlc_eq(stc_find_vtype_(my, morphed_type, value), float)
+ >::check();
+ }
+ }
+
+} // end of namespace my
+
+
+int
+main()
+{
+ my::ex1::check();
+ my::ex2::check();
+ my::ex3::check();
+ my::ex4::check();
+ my::ex5::check();
+ my::ex6::check();
+ my::ex7::check();
+}
Index: stc/scoop2.hh
--- stc/scoop2.hh (revision 0)
+++ stc/scoop2.hh (revision 0)
@@ -0,0 +1,689 @@
+// 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.
+
+/* \file stc/vtypes.hh
+
+ \brief Equipment for SCOOP 2 (in particular, virtual types). */
+
+#ifndef STC_SCOOP2_HH
+# define STC_SCOOP2_HH
+
+# include <mlc/flags.hh>
+# include <mlc/typedef.hh>
+# include <mlc/abort.hh>
+
+
+namespace stc
+{
+
+ struct none {};
+ struct not_found;
+ struct abstract;
+ struct not_delegated;
+ struct not_delegated_abstract;
+ template <typename T> struct final;
+
+ namespace ERROR
+ {
+ struct IN_find__VIRTUAL_TYPE_IS_ABSTRACT;
+
+ struct IN_find_local__VIRTUAL_TYPE_MULTIPLY_DEFINED;
+
+ struct IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+ struct IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL;
+ struct IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED;
+ struct IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+
+ struct IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+ struct IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+ struct IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT;
+ struct IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL;
+ struct IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED;
+
+ } // end of namespace ERROR
+
+} // end of namespace stc
+
+
+#define stc_super(T) typename set_super_type< T >::ret
+
+// Based on doc/algorithm.ml.
+
+// FIXME: Hack.
+#define SCOOPED_NAMESPACE my
+
+
+// ------------------------------------------------------------ find_local.
+
+// Highly inspired from Th�o's get_stm!
+
+namespace SCOOPED_NAMESPACE
+{
+
+ // Declare delegatee_type.
+ mlc_decl_typedef(delegatee_type);
+
+
+ template <typename class_name>
+ struct set_super_type
+ {
+ };
+
+ template <typename class_name>
+ struct vtypes
+ {
+ };
+
+ template <typename class_name, typename type_name>
+ struct single_vtype
+ {
+ typedef mlc::not_found ret;
+ };
+
+ namespace find_local_
+ {
+ // Forward declaration.
+ template <typename T, typename U> struct match_with;
+
+ template <typename T>
+ struct match_with <T, mlc::not_found>
+ {
+ typedef T ret;
+ };
+
+ template <typename U>
+ struct match_with <mlc::not_found, U>
+ {
+ typedef U ret;
+ };
+
+ template <>
+ struct match_with <mlc::not_found, mlc::not_found>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <typename T, typename U>
+ struct match_with :
+ mlc::abort_<T, stc::ERROR::IN_find_local__VIRTUAL_TYPE_MULTIPLY_DEFINED>
+ {
+ };
+
+ } // end of namespace find_local_
+
+ template <typename source, typename target>
+ struct find_local
+ {
+ typedef SCOOPED_NAMESPACE::vtypes<source> decl1;
+ typedef typename target::template from_<decl1>::ret res1;
+
+ typedef SCOOPED_NAMESPACE::single_vtype<source, target> decl2;
+ typedef typename decl2::ret ret2;
+
+
+ // Result.
+ typedef typename find_local_::match_with<res1, ret2>::ret ret;
+ };
+
+
+ // -------------------------------------------------------------- merge2.
+
+ namespace merge2_
+ {
+ // Forward declaration.
+ template <typename T, typename U> struct match_with;
+
+
+ // super_res == stc::not_found.
+ template <>
+ struct match_with<stc::abstract, stc::not_found>
+ {
+ typedef stc::abstract ret;
+ };
+ template <>
+ struct match_with<stc::not_found, stc::not_found>
+ {
+ typedef stc::not_found ret;
+ };
+ template <typename T>
+ struct match_with<stc::final<T>, stc::not_found>
+ {
+ typedef stc::final<T> ret;
+ };
+
+ template <typename T>
+ struct match_with<T, stc::not_found>
+ {
+ typedef T ret;
+ };
+
+
+ // super_res == stc::abstract.
+ template <>
+ struct match_with<stc::not_found, stc::abstract>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <>
+ struct match_with<stc::abstract, stc::abstract>
+ {
+ typedef stc::abstract ret;
+ };
+
+ template <typename T>
+ struct match_with<stc::final<T>, stc::abstract>
+ {
+ typedef stc::final<T> ret;
+ };
+
+ template <typename T>
+ struct match_with<T, stc::abstract>
+ {
+ typedef T ret;
+ };
+
+
+ // super_res == stc::final<U>.
+ template <typename U>
+ struct match_with<stc::abstract, stc::final<U> > :
+ mlc::abort_<U, stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT>
+ {
+ };
+
+ template <typename U>
+ struct match_with<stc::not_found, stc::final<U> >
+ {
+ typedef stc::final<U> ret;
+ };
+
+ template <typename T, typename U>
+ struct match_with<stc::final<T>, stc::final<U> > :
+ mlc::abort_<U, stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL>
+ {
+ };
+
+ template <typename T, typename U>
+ struct match_with<T, stc::final<U> > :
+ mlc::abort_<U, stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED>
+ {
+ };
+
+
+ // super_res == U.
+ template <typename U>
+ struct match_with<stc::abstract, U> :
+ mlc::abort_<U, stc::ERROR::IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT>
+ {
+ };
+
+ template <typename U>
+ struct match_with<stc::not_found, U>
+ {
+ typedef U ret;
+ };
+
+ template <typename T, typename U>
+ struct match_with<stc::final<T>, U>
+ {
+ typedef stc::final<T> ret;
+ };
+
+ template <typename T, typename U>
+ struct match_with
+ {
+ typedef T ret;
+ };
+
+ } // end of namespace merge2_
+
+ template <typename local_res, typename super_res>
+ struct merge2
+ {
+ // Result.
+ typedef typename merge2_::match_with<local_res, super_res>::ret ret;
+ };
+
+
+ // -------------------------------------------------------------- merge3.
+
+ // FIXME: Undef these macros after the definition of merge3.
+
+#define stc_match_0p_with(Local, Super, Deleg, Res) \
+ template <> \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_match_1p_with(T1, Local, Super, Deleg, Res) \
+ template <typename T1> \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_match_2p_with(T1, T2, Local, Super, Deleg, Res) \
+ template <typename T1, typename T2> \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_match_3p_with(T1, T2, T3, Local, Super, Deleg, Res) \
+ template <typename T1, typename T2, typename T3> \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+ // FIXME: Example of use.
+ // stc_match_with(stc::not_found, stc::not_found, stc::not_found, stc::not_found);
+
+ namespace merge3_
+ {
+ // Forward declaration.
+ template <typename T, typename U, typename V> struct match_with;
+
+
+ // local_res == stc::not_found.
+ template <>
+ struct match_with<stc::not_found, stc::not_found, stc::not_found>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <>
+ struct match_with<stc::not_found, stc::not_found, stc::abstract>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::not_found, stc::not_found, stc::final<V> >
+ {
+ typedef stc::final<V> ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::not_found, stc::not_found, V>
+ {
+ typedef V ret;
+ };
+
+
+ template <>
+ struct match_with<stc::not_found, stc::abstract, stc::not_found>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <>
+ struct match_with<stc::not_found, stc::abstract, stc::abstract>
+ {
+ typedef stc::abstract ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::not_found, stc::abstract, stc::final<V> >
+ {
+ typedef stc::final<V> ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::not_found, stc::abstract, V>
+ {
+ typedef V ret;
+ };
+
+
+ template <typename U, typename V>
+ struct match_with<stc::not_found, stc::final<U>, V>
+ {
+ typedef stc::final<U> ret;
+ };
+
+ template <typename U, typename V>
+ struct match_with<stc::not_found, U, V>
+ {
+ typedef U ret;
+ };
+
+
+ // local_res == stc::abstract.
+ template <>
+ struct match_with<stc::abstract, stc::not_found, stc::not_found>
+ {
+ typedef stc::abstract ret;
+ };
+
+ template <>
+ struct match_with<stc::abstract, stc::not_found, stc::abstract>
+ {
+ typedef stc::abstract ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::abstract, stc::not_found, stc::final<V> >
+ {
+ typedef stc::final<V> ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::abstract, stc::not_found, V >
+ {
+ typedef V ret;
+ };
+
+
+ template <>
+ struct match_with<stc::abstract, stc::abstract, stc::not_found>
+ {
+ typedef stc::abstract ret;
+ };
+
+ template <>
+ struct match_with<stc::abstract, stc::abstract, stc::abstract>
+ {
+ typedef stc::abstract ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::abstract, stc::abstract, stc::final<V> >
+ {
+ typedef stc::final<V> ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::abstract, stc::abstract, V>
+ {
+ typedef V ret;
+ };
+
+
+ template <typename V>
+ struct match_with<stc::abstract, stc::not_delegated_abstract, V>
+ {
+ typedef stc::not_delegated_abstract ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::abstract, stc::not_delegated, V>
+ {
+ typedef stc::not_delegated_abstract ret;
+ };
+
+
+ template <typename U, typename V>
+ struct match_with<stc::abstract, stc::final<U>, V> :
+ mlc::abort_<V, stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT>
+ {
+ };
+
+ template <typename U, typename V>
+ struct match_with<stc::abstract, U, V> :
+ mlc::abort_<V, stc::ERROR::IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT>
+ {
+ };
+
+
+ // local_res == stc::not_delegated.
+ template <typename V>
+ struct match_with<stc::not_delegated, stc::not_found, V>
+ {
+ typedef stc::not_delegated ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::not_delegated, stc::abstract, V>
+ {
+ typedef stc::not_delegated_abstract ret;
+ };
+
+ template <typename V>
+ struct match_with<stc::not_delegated, stc::not_delegated_abstract, V>
+ {
+ typedef stc::not_delegated_abstract ret;
+ };
+
+
+ // local_res == stc::not_delegated_abstract. *)
+ /* FIXME: Shouldn't we introduce a means to tag a vtype both
+ as abstract *and* not delegated? (Currently, the rule below
+ prevents this). */
+ template <typename U, typename V>
+ struct match_with<stc::not_delegated_abstract, U, V> :
+ mlc::abort_<V, stc::ERROR::IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT>
+ {
+ };
+
+
+ // local_res == stc::final<T>.
+ template <typename T, typename U, typename V>
+ struct match_with<stc::final<T>, stc::final<U>, V> :
+ mlc::abort_<V, stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL>
+ {
+ };
+
+ template <typename T, typename U, typename V>
+ struct match_with<stc::final<T>, U, V>
+ {
+ typedef stc::final<T> ret;
+ };
+
+
+ // local_res == T.
+ template <typename T, typename U, typename V>
+ struct match_with<T, stc::final<U>, V> :
+ mlc::abort_<V, stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED>
+ {
+ };
+
+ template <typename T, typename U, typename V>
+ struct match_with
+ {
+ typedef T ret;
+ };
+
+ } // end of namespace merge3_
+
+ template <typename local_res, typename super_res, typename delegatee_res>
+ struct merge3
+ {
+ // Result.
+ typedef typename merge3_::match_with<local_res, super_res, delegatee_res>::ret ret;
+ };
+
+
+ // ----------------------------------------------------------- find_rec.
+
+ // Forward declarations.
+ template <typename source, typename target> struct find_rec;
+ template <typename source, typename target> struct find_rec_in_supers;
+
+
+ namespace find_rec_
+ {
+
+ namespace find_delegatee_res_
+ {
+ // Forward declaration.
+ template <typename delegatee, typename target> struct match_with;
+
+ template <typename target>
+ struct match_with<stc::not_found, target>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <typename target>
+ struct match_with<stc::abstract, target>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <typename delegatee, typename target>
+ struct match_with
+ {
+ typedef typename find_rec<delegatee, target>::ret ret;
+ };
+
+ } // end of namespace find_delegatee_res_
+
+
+ // Forward declaration.
+ template <typename source, typename target> struct match_with;
+
+ template <typename target>
+ struct match_with<stc::none, target>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <typename source, typename target>
+ struct match_with
+ {
+ typedef typename find_local<source, target>::ret local_res;
+ typedef typename find_rec<stc_super(source), target>::ret super_res;
+ // delegatee_type is the name of the (optional) virtual type
+ // containing the (type of the) delgatee.
+ typedef typename find_rec_in_supers<source, typedef_::delegatee_type>::ret delegatee;
+
+ typedef typename find_delegatee_res_::match_with<delegatee, target>::ret delegatee_res;
+ typedef typename merge3<local_res, super_res, delegatee_res>::ret ret;
+ };
+
+ } // end of namespace find_rec_
+
+ template <typename source, typename target>
+ struct find_rec
+ {
+ // Result.
+ typedef typename find_rec_::match_with<source, target>::ret ret;
+ };
+
+
+ // -------------------------------------------------- find_rec_in_supers.
+
+ namespace find_rec_in_supers_
+ {
+ // Forward declaration.
+ template <typename source, typename target> struct match_with;
+
+ template <typename target>
+ struct match_with<stc::none, target>
+ {
+ typedef stc::none ret;
+ };
+
+ template <typename source, typename target>
+ struct match_with
+ {
+ typedef typename find_local<source, target>::ret local_res;
+ typedef typename find_rec<stc_super(source), target>::ret super_res;
+ typedef typename merge2<local_res, super_res>::ret ret;
+ };
+
+ } // end of namespace find_rec_in_supers_
+
+ template <typename source, typename target>
+ struct find_rec_in_supers
+ {
+ // Result.
+ typedef typename find_rec_in_supers_::match_with<source, target>::ret ret;
+ };
+
+
+ // ---------------------------------------------------------------- find.
+
+ namespace find_
+ {
+ // Forward declaration.
+ template <typename T> struct match_with;
+
+ template <>
+ struct match_with<stc::abstract>
+/* FIXME: We'd like to add a static abort here, but we can't, since
+ stc::abstract is not a free parameter (enabling this abort statement
+ would prevent any compilation). */
+#if 0
+ : mlc::abort_<stc::abstract,
+ stc::ERROR::IN_find__VIRTUAL_TYPE_IS_ABSTRACT>
+#endif
+ {
+ };
+
+ template <>
+ struct match_with<stc::not_delegated_abstract>
+/* FIXME: We'd like to add a static abort here, but we can't, since
+ stc::not_delegated_abstract is not a free parameter (enabling this
+ abort statement would prevent any compilation). */
+#if 0
+ : mlc::abort_<stc::not_delegated_abstract,
+ stc::ERROR::IN_find__VIRTUAL_TYPE_IS_ABSTRACT>
+#endif
+ {
+ };
+
+ template <>
+ struct match_with<stc::not_delegated>
+ {
+ typedef stc::not_found ret;
+ };
+
+ template <typename T>
+ struct match_with< stc::final<T> >
+ {
+ typedef T ret;
+ };
+
+ template <typename T>
+ struct match_with
+ {
+ typedef T ret;
+ };
+
+ } // end of namespace find_
+
+ template <typename source, typename target>
+ struct find
+ {
+ typedef typename find_rec<source, target>::ret res;
+ // Result.
+ typedef typename find_::match_with<res>::ret ret;
+ };
+
+} /* end of SCOOPED_NAMESPACE */
+
+
+# define stc_find_vtype_(Namespace, Source, Target) \
+ Namespace::find<Source, Namespace::typedef_::Target##_type>::ret
+
+# define stc_find_vtype(Namespace, Source, Target) \
+ typename stc_find_vtype_(Namespace, Source, Target)
+
+#endif // ! STC_SCOOP2_HH
Index: stc/Makefile.am
--- stc/Makefile.am (revision 717)
+++ stc/Makefile.am (working copy)
@@ -9,7 +9,9 @@
scoop.hh \
valist_aggregator.hh \
\
- internal/extract_vtype_from_list.hh
+ internal/extract_vtype_from_list.hh \
+ \
+ scoop2.hh
# Old code.
EXTRA_DIST = was.scoop.hh
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Improve SCOOP 2 documentation and prototype.
* doc/algorithms.ml (merge2): Reorder patterns as in merge3.
Aesthetic changes.
(merge3): Aesthetic changes.
* doc/algorithms.txt: Adjust.
* doc/rules.txt: Typos.
Improve the last two examples.
algorithms.ml | 46 +++++++++++++++-------------------
algorithms.txt | 32 ++++++++++++------------
rules.txt | 75 ++++++++++++++++++++++++++++++++-------------------------
3 files changed, 80 insertions(+), 73 deletions(-)
Index: doc/algorithms.ml
--- doc/algorithms.ml (revision 716)
+++ doc/algorithms.ml (working copy)
@@ -73,26 +73,25 @@
let merge2 (local_res : cxx_type) (super_res : cxx_type) : cxx_type =
match local_res, super_res with
- | Stc_Abstract, Stc_Not_found -> Stc_Abstract
+ (* local_res == stc::not_found. *)
| Stc_Not_found, Stc_Not_found -> Stc_Not_found
- | Stc_Final t, Stc_Not_found -> Stc_Final t
- | t, Stc_Not_found -> t
-
| Stc_Not_found, Stc_Abstract -> Stc_Not_found
- | Stc_Abstract, Stc_Abstract -> Stc_Abstract
- | Stc_Final t, Stc_Abstract -> Stc_Final t
- | t, Stc_Abstract -> t
-
- | Stc_Abstract, Stc_Final u -> error "Final VT redefined abstract"
| Stc_Not_found, Stc_Final u -> Stc_Final u
- | Stc_Final t, Stc_Final u -> error "Final VT redefined final."
- | t, Stc_Final u -> error "Final VT redefined."
-
- | Stc_Abstract, u -> error "VT redefined abstract."
| Stc_Not_found, u -> u
- | Stc_Final t, u -> Stc_Final t
- | t, u -> t
+ (* local_res == stc::abstract. *)
+ | Stc_Abstract, Stc_Abstract -> Stc_Abstract
+ | Stc_Abstract, Stc_Not_found -> Stc_Abstract
+ | Stc_Abstract, Stc_Final _ -> error "Final VT redefined abstract"
+ | Stc_Abstract, _ -> error "VT redefined abstract."
+
+ (* local_res == stc::final<T>. *)
+ | Stc_Final _, Stc_Final _ -> error "Final VT redefined final."
+ | Stc_Final t, _ -> Stc_Final t
+
+ (* local_res == T. *)
+ | _, Stc_Final _ -> error "Final VT redefined."
+ | t, _ -> t
;;
(* Another version (rewriting) of merge3. *)
@@ -114,7 +113,7 @@
| Stc_Not_found, Stc_Final u, _ -> Stc_Final u
| Stc_Not_found, u, _ -> u
- (* local_res == stc::not_abstract. *)
+ (* local_res == stc::abstract. *)
| Stc_Abstract, Stc_Not_found, Stc_Not_found -> Stc_Abstract
| Stc_Abstract, Stc_Not_found, Stc_Abstract -> Stc_Abstract
| Stc_Abstract, Stc_Not_found, Stc_Final v -> Stc_Final v
@@ -128,9 +127,9 @@
| Stc_Abstract, Stc_Not_delegated_Abstract, _ -> Stc_Not_delegated_Abstract
| Stc_Abstract, Stc_Not_delegated, _ -> Stc_Not_delegated_Abstract
- | Stc_Abstract, Stc_Final u, _ -> error ("Final VT " ^
+ | Stc_Abstract, Stc_Final _, _ -> error ("Final VT " ^
"redefined abstract")
- | Stc_Abstract, u, _ -> error ("VT redefined " ^
+ | Stc_Abstract, _, _ -> error ("VT redefined " ^
"abstract.")
(* local_res == stc::not_delegated. *)
@@ -147,15 +146,14 @@
" and abstract")
(* local_res == stc::final<T>. *)
- | Stc_Final t, Stc_Final u, _ -> error ("Final VT " ^
+ | Stc_Final _, Stc_Final _, _ -> error ("Final VT " ^
"redefined final.")
| Stc_Final t, _, _ -> Stc_Final t
(* local_res == T. *)
- | t, Stc_Final u, _ -> error ("Final VT " ^
+ | _, Stc_Final _, _ -> error ("Final VT " ^
"redefined.")
| t, _, _ -> t
-
;;
@@ -380,7 +378,7 @@
with Scoop_exception "Final VT redefined final." -> ();
;;
-(* ** General virtual type lookup
+(* ** General virtual type lookup (i.e., with delegation)
*** Abstract
@@ -403,8 +401,6 @@
vtype delegatee_type = D;
}
- // FIXME: What should be the value of ``t''?
- // I would say ``stc::not_found'', but I'm not sure (see intro.txt, too).
type t = C#my_type;
*)
let a =
@@ -573,7 +569,7 @@
;;
-(* Olena-like examples.
+(* *** Olena-like examples.
class /image_entry/ < stc::none
{
Index: doc/algorithms.txt
--- doc/algorithms.txt (revision 716)
+++ doc/algorithms.txt (working copy)
@@ -29,8 +29,8 @@
| stc::abstract -> error "find: VT is abstract."
| stc::not_delegated_abstract -> error "find: VT is abstract."
| stc::not_delegated -> stc::not_found
- | stc::final t -> t
- | t -> t
+ | stc::final<T> -> T
+ | T -> T
** find_rec
@@ -70,25 +70,25 @@
merge2 (local_res, super_res) =
match local_res, super_res with
- | stc::abstract, stc::not_found -> stc::abstract
+ // local_res == stc::not_found.
| mlc::not_found, stc::not_found -> stc::not_found
- | T, stc::not_found -> T
- | stc::final<T>, stc::not_found -> stc::final<T>
-
| mlc::not_found, stc::abstract -> stc::not_found
- | stc::abstract, stc::abstract -> stc::abstract
- | T, stc::abstract -> T
- | stc::final<T>, stc::abstract -> stc::final<T>
-
- | stc::abstract, U -> error ("VT redefined abstract.")
+ | mlc::not_found, stc::final<U> -> stc::final<U>
| mlc::not_found, U -> U
- | T, U -> T
- | stc::final<T>, U -> stc::final<T>
+ // local_res == stc::abstract.
+ | stc::abstract, stc::not_found -> stc::abstract
+ | stc::abstract, stc::abstract -> stc::abstract
| stc::abstract, stc::final<U> -> error ("Final VT redefined abstract")
- | mlc::not_found, stc::final<U> -> stc::final<U>
- | T, stc::final<U> -> error ("Final VT redefined.")
+ | stc::abstract, U -> error ("VT redefined abstract.")
+
+ // local_res == stc::final<T>.
| stc::final<T>, stc::final<U> -> error ("Final VT redefined final.")
+ | stc::final<T>, _ -> stc::final<T>
+
+ // local_res == stc::final<T>.
+ | T, stc::final<U> -> error ("Final VT redefined.")
+ | T, _ -> T
merge3 (local_res, super_res, delegatee_res) =
@@ -109,7 +109,7 @@
| mlc::not_found, U, _ -> U
- // local_res == stc::not_abstract.
+ // local_res == stc::abstract.
| stc::abstract, stc::not_found, stc::not_found -> stc::abstract
| stc::abstract, stc::not_found, stc::abstract -> stc::abstract
| stc::abstract, stc::not_found, stc::final<V> -> stc::final<V>
Index: doc/rules.txt
--- doc/rules.txt (revision 716)
+++ doc/rules.txt (working copy)
@@ -16,7 +16,7 @@
stc::none (FIXME: What about stc::top ?)
- deferred_type? (FIXME: Which syntax?)
+ (deferred_type?) (FIXME: Which syntax?)
* Declaration/definition
@@ -93,7 +93,7 @@
- Unless declared final (see relevant item), a virtual type of a class
can be redefined in its subclass(es). The new value can be the same
or different for the inital one. The syntax is the same as the one
- for defining a virtual type.
+ defining a virtual type.
Ex.:
@@ -315,7 +315,7 @@
This process relies on an `atomic' lookup on each inspected class:
each of them can be queried for a locally defined virtual type.
-(FIXME: reference to the local_find algorithm.)
+(FIXME: reference to the find_local algorithm.)
The result of this local lookup is
- mlc::not_found: meaning there is no delegatee_type;
@@ -415,6 +415,8 @@
FIXME: Continue.
+
+
* Examples
@@ -471,41 +473,50 @@
*** E#bar
- A local_find(A, bar) = mlc::not_found
- ^
+ top-down
+ propagation
+
|
- | X local_find(X, bar) = 0
- | ^
- | |
- B | local_find(B, bar) = mlc::not_found
- ^ |
+ | find_local(A, bar) = not_found A
+ | => find(A, bar) = not_found ^
+ | | X find_local(X, bar) = 0
+ | | ^ => find(X, bar) = 0
+ | find_local(B, bar) = not_found B |
+ | => find(B, bar) = not_found ^ |
+ | | Y find_local(Y, bar) = char
+ | | | => find(Y, bar) = char
+ | find_local(C, bar) = not_found C<>-�
+ | => find(C, bar) = char ^
| |
- | Y local_find(Y, bar) = char
+ | find_local(D, bar) = not_found D
+ | => find(D, bar) = char ^
| |
- | |
- C<>-� local_find(D, bar) = mlc::not_found
- ^
- |
- D local_find(D, bar) = mlc::not_found
- ^
- |
- E local_find(E, bar) = mlc::not_found
+ | find_local(E, bar) = not_found E
+ | => find(E, bar) = char
+ v
*** E#hop
- A local_find(A, bar) = mlc::not_found
- ^
- | X
- B ^ local_find(B, bar) = mlc::not_found
- ^ |
- | Y
- C<>-� local_find(D, bar) = stc::not_delegated
- ^
- |
- D local_find(D, hop) = mlc::not_found
- ^
- |
- E local_find(E, hop) = mlc::not_found
+ top-down
+ propagation
+
+ | find_local(A, hop) = not_found A
+ | => find(A, hop) = not_found ^
+ | | X find_local(X, hop) = int
+ | | ^ => find(X, hop) = int
+ | find_local(B, hop) = not_found B |
+ | => find(B, hop) = not_found ^ |
+ | | Y find_local(Y, hop) = not_found
+ | | | => find(Y, hop) = int
+ | find_local(C, hop) = not_deleg C<>-�
+ | => find(C, hop) = not_found ^
+ | |
+ | find_local(D, hop) = not_found D
+ | => find(D, hop) = not_found ^
+ | |
+ | find_local(E, hop) = not_found E
+ | => find(E, hop) = not_found
+ v
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
More examples in doc/algorithms.ml.
* doc/algorithms.ml (find_rec): Handle abstract delegatee.
Add Olena-like examples.
Aesthetic changes.
* doc/algorithms.txt (Top-down approach): Document `find'.
(Bottom-up approach): Move section at the end of the file.
algorithms.ml | 178 ++++++++++++++++++++++------------
algorithms.txt | 292 +++++++++++++++++++++++++++++----------------------------
2 files changed, 267 insertions(+), 203 deletions(-)
Index: doc/algorithms.ml
--- doc/algorithms.ml (revision 715)
+++ doc/algorithms.ml (working copy)
@@ -173,13 +173,12 @@
inheritance branch. Of course, the declarative nature
of C++ templates will avoid this cost, but it remains
inelegant, IMHO. *)
-
let delegatee = find_rec_in_supers source "delegatee_type" in
let delegatee_res =
- if delegatee = Stc_Not_found then
- Stc_Not_found
- else
- find_rec delegatee target in
+ match delegatee with
+ | Stc_Not_found -> Stc_Not_found
+ | Stc_Abstract -> Stc_Not_found
+ | _ -> find_rec delegatee target in
merge3 local_res super_res delegatee_res
end
@@ -223,7 +222,8 @@
vtype my_type = int;
}
*)
-let a = Scoop_Class { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["my_type", Std_Int] } in
assert (find a "my_type" = Std_Int);;
@@ -247,11 +247,14 @@
vtype my_type = int;
}
*)
-let a = Scoop_Class { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["my_type", Std_Int] } in
-let b = Scoop_Class { super = a;
+let b =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["my_type", Std_Float] } in
-let c = Scoop_Class { super = b;
+let c =
+ Scoop_Class { super = b;
vtypes = create_vtypes ["my_type", Std_Int] } in
assert (find c "my_type" = Std_Int);;
@@ -270,9 +273,11 @@
vtype my_type = int;
}
*)
-let a = Scoop_Class { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["my_type", Stc_Abstract] } in
-let b = Scoop_Class { super = a;
+let b =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["my_type", Std_Int] } in
assert (find b "my_type" = Std_Int);;
@@ -290,14 +295,15 @@
vtype my_type = 0;
}
*)
-let a = Scoop_Class { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["my_type", Std_Int] } in
-let b = Scoop_Class { super = a;
+let b =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["my_type", Stc_Abstract] } in
try
ignore (find b "my_type")
- with Scoop_exception "VT redefined abstract." -> ()
-;;
+with Scoop_exception "VT redefined abstract." -> ();;
(* ** Final virtual type
@@ -311,9 +317,9 @@
final vtype my_type = int;
}
*)
-let a = Scoop_Class { super = Stc_None;
- vtypes = create_vtypes ["my_type", Stc_Final Std_Int] }
-in
+let a =
+ Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Stc_Final Std_Int] } in
assert (find a "my_type" = Std_Int);;
(* - A virtual type tagged as final in a class cannot be redefined in its
@@ -347,20 +353,20 @@
final vtype my_type = float;
}
*)
-let a = Scoop_Class
- { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["my_type", Stc_Final Std_Int] } in
-let b = Scoop_Class
- { super = a;
+let b =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["my_type", Std_Float] } in
-let c = Scoop_Class
- { super = a;
+let c =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["my_type", Std_Int] } in
-let d = Scoop_Class
- { super = a;
+let d =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["my_type", Stc_Final Std_Int] } in
-let e = Scoop_Class
- { super = a;
+let e =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["my_type", Stc_Final Std_Float] } in
assert (find a "my_type" = Std_Int);
@@ -401,14 +407,14 @@
// I would say ``stc::not_found'', but I'm not sure (see intro.txt, too).
type t = C#my_type;
*)
-let a = Scoop_Class
- { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes [] } in
-let d = Scoop_Class
- { super = Stc_None;
+let d =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["my_type", Stc_Abstract] } in
-let c = Scoop_Class
- { super = a;
+let c =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["delegatee_type", d] } in
assert (find c "my_type" = Stc_Not_found);;
@@ -451,33 +457,33 @@
vtype bar = char; |
} |
*)
-let a = Scoop_Class
- { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes [] } in
-let b = Scoop_Class
- { super = a;
+let b =
+ Scoop_Class { super = a;
vtypes = create_vtypes ["foo", Stc_Abstract] } in
-let x = Scoop_Class
- { super = Stc_None;
+let x =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes [("bar", Stc_Abstract);
("hop", Std_Int)] } in
-let y = Scoop_Class
- { super = x;
+let y =
+ Scoop_Class { super = x;
vtypes = create_vtypes [("bar", Std_Char);
("baz", Std_Short)] } in
-let c = Scoop_Class
- { super = b;
+let c =
+ Scoop_Class { super = b;
vtypes = create_vtypes [("delegatee_type", y);
("foo", Std_Int);
("baz", Stc_Not_delegated);
("hop", Stc_Not_delegated)] } in
-let d = Scoop_Class
- { super = c;
+let d =
+ Scoop_Class { super = c;
vtypes = create_vtypes [("quux", Std_Unsigned)] } in
-let e = Scoop_Class
- { super = d;
+let e =
+ Scoop_Class { super = d;
vtypes = create_vtypes [("baz", Std_Float)] } in
assert (find e "foo" = Std_Int);
@@ -503,20 +509,20 @@
{ |
} |
*)
-let a = Scoop_Class
- { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["foo", Stc_Abstract] } in
-let x = Scoop_Class
- { super = Stc_None;
+let x =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["foo", Std_Int] } in
-let b = Scoop_Class
- { super = a;
+let b =
+ Scoop_Class { super = a;
vtypes = create_vtypes [("delegatee_type", x);
("foo", Stc_Not_delegated)] } in
-let c = Scoop_Class
- { super = b;
+let c =
+ Scoop_Class { super = b;
vtypes = create_vtypes [] } in
(* foo is abstract and tagged ``not delegated'' for B. *)
@@ -544,20 +550,20 @@
vtype foo = 0 |
} |
*)
-let a = Scoop_Class
- { super = Stc_None;
+let a =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes [] } in
-let x = Scoop_Class
- { super = Stc_None;
+let x =
+ Scoop_Class { super = Stc_None;
vtypes = create_vtypes ["foo", Std_Int] } in
-let b = Scoop_Class
- { super = a;
+let b =
+ Scoop_Class { super = a;
vtypes = create_vtypes [("delegatee_type", x);
("foo", Stc_Not_delegated)] } in
-let c = Scoop_Class
- { super = b;
+let c =
+ Scoop_Class { super = b;
vtypes = create_vtypes ["foo", Stc_Abstract] } in
(* foo is abstract and tagged ``not delegated'' for B. *)
@@ -565,3 +571,47 @@
(* Likewise for C. *)
try ignore (find c "foo") with Scoop_exception "find: VT is abstract." -> ()
;;
+
+
+(* Olena-like examples.
+
+ class /image_entry/ < stc::none
+ {
+ vtype value_type = 0;
+ }
+
+ class image2d<int> < image_entry
+ {
+ vtypes value_type = int;
+ }
+
+ class /value_morpher/ < image_entry
+ {
+ vtype delegatee_type = 0;
+ vtype value_type = stc::not_delegated;
+ }
+
+ class value_cast<image2d<int>, float> < value_morpher
+ {
+ vtype delegatee_type = image2d<int>;
+ vtype value_type = float;
+ }
+*)
+
+let image_entry =
+ Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["value_type", Stc_Abstract] } in
+let image2d_int =
+ Scoop_Class { super = image_entry;
+ vtypes = create_vtypes ["value_type", Std_Int] } in
+let value_morpher =
+ Scoop_Class { super = image_entry;
+ vtypes = create_vtypes [("delegatee_type", Stc_Abstract);
+ ("value_type", Stc_Not_delegated)]} in
+let value_cast__image2d_int__float =
+ Scoop_Class { super = value_morpher;
+ vtypes = create_vtypes [("delegatee_type", image2d_int);
+ ("value_type", Std_Float)] } in
+
+assert (find image2d_int "value_type" = Std_Int);
+assert (find value_cast__image2d_int__float "value_type" = Std_Float);;
Index: doc/algorithms.txt
--- doc/algorithms.txt (revision 715)
+++ doc/algorithms.txt (working copy)
@@ -2,8 +2,160 @@
These algorithms are expressed in a pseudo-Caml like syntax.
+
+===========================================================================
+* Preamble
+
+Notes:
+
+- syntax: foo#super returns the type of the super class of foo.
+
+- syntax: 'foo_type' stands for the SCOOP virtual type named foo_type.
+
+- stc::none#super is an error, but calling `find (none, ...)' returns
+ stc::not_found.
+
+
+===========================================================================
+* Top-down approach
+
+These algorithms have been prototyped in algorithms.ml.
+
+** find
+
+function find (source, target, string) =
+ let res = find_rec (source, target) in
+ match res with
+ | stc::abstract -> error "find: VT is abstract."
+ | stc::not_delegated_abstract -> error "find: VT is abstract."
+ | stc::not_delegated -> stc::not_found
+ | stc::final t -> t
+ | t -> t
+
+
+** find_rec
+
+function find_rec (source, target) =
+ if (source = mlc::none)
+ stc::not_found
+ else
+ let local_res = find_local (source, target) in
+
+ let super_res = find_rec (source#super, target) in
+ /* FIXME: This might not be efficient, since find_rec can be
+ called several times on the nodes of the delegation branch when
+ going down the inheritance branch. Of course, the declarative
+ nature of C++ templates will avoid this cost, but it might be
+ inelegant -- I'm not sure). */
+ let delegatee = find_rec_in_supers (source, 'delegatee_type') in
+ let delegatee_res =
+ match delegatee with
+ | stc::not_found -> stc::not_found
+ | stc::abstract -> stc::not_found
+ | _ -> find_rec delegatee target in
+
+ merge3 (local_res, super_res, delegatee_res)
+
+
+// Like find_rec, but only search in the inheritance branch.
+function find_rec_in_supers (source, target) =
+ if (source = mlc::none)
+ stc::not_found
+ else
+ let local_res = find_local (source, target) in
+ let super_res = find_rec (source#super, target) in
+ merge2 (local_res, super_res)
+
+
+merge2 (local_res, super_res) =
+ match local_res, super_res with
+
+ | stc::abstract, stc::not_found -> stc::abstract
+ | mlc::not_found, stc::not_found -> stc::not_found
+ | T, stc::not_found -> T
+ | stc::final<T>, stc::not_found -> stc::final<T>
+
+ | mlc::not_found, stc::abstract -> stc::not_found
+ | stc::abstract, stc::abstract -> stc::abstract
+ | T, stc::abstract -> T
+ | stc::final<T>, stc::abstract -> stc::final<T>
+
+ | stc::abstract, U -> error ("VT redefined abstract.")
+ | mlc::not_found, U -> U
+ | T, U -> T
+ | stc::final<T>, U -> stc::final<T>
+
+ | stc::abstract, stc::final<U> -> error ("Final VT redefined abstract")
+ | mlc::not_found, stc::final<U> -> stc::final<U>
+ | T, stc::final<U> -> error ("Final VT redefined.")
+ | stc::final<T>, stc::final<U> -> error ("Final VT redefined final.")
+
+
+merge3 (local_res, super_res, delegatee_res) =
+ match local_res, super_res, delegatee_res with
+
+ // local_res == stc::not_found.
+ | mlc::not_found, stc::not_found, stc::not_found -> stc::not_found
+ | mlc::not_found, stc::not_found, stc::abstract -> stc::not_found
+ | mlc::not_found, stc::not_found, stc::final<V> -> stc::final<V>
+ | mlc::not_found, stc::not_found, V -> V
+
+ | mlc::not_found, stc::abstract, stc::not_found -> stc::not_found
+ | mlc::not_found, stc::abstract, stc::abstract -> stc::abstract
+ | mlc::not_found, stc::abstract, stc::final<V> -> stc::final<V>
+ | mlc::not_found, stc::abstract, V -> V
+
+ | mlc::not_found, stc::final<U>, _ -> stc::final<U>
+ | mlc::not_found, U, _ -> U
+
+
+ // local_res == stc::not_abstract.
+ | stc::abstract, stc::not_found, stc::not_found -> stc::abstract
+ | stc::abstract, stc::not_found, stc::abstract -> stc::abstract
+ | stc::abstract, stc::not_found, stc::final<V> -> stc::final<V>
+ | stc::abstract, stc::not_found, V -> V
+
+ | stc::abstract, stc::abstract, stc::not_found -> stc::abstract
+ | stc::abstract, stc::abstract, stc::abstract -> stc::abstract
+ | stc::abstract, stc::abstract, stc::final<V> -> stc::final<V>
+ | stc::abstract, stc::abstract, V -> V
+
+ | stc::abstract, stc::not_delegated_abstract, _ -> stc::not_delegated_abstract
+ | stc::abstract, stc::not_delegated, _ -> stc::not_delegated_abstract
+
+ | stc::abstract, stc::final<U>, _ -> error ("Final VT "
+ "redefined abstract")
+ | stc::abstract, U, _ -> error ("VT redefined "
+ "abstract.")
+ // local_res == stc::not_delegated.
+ | stc::not_delegated, stc::not_found, _ -> stc::not_delegated
+ | stc::not_delegated, stc::abstract, _ -> stc::not_delegated_abstract
+ | stc::not_delegated, stc::not_delegated_abstract, _ -> stc::not_delegated_abstract
+
+ // local_res == stc::not_delegated_abstract.
+ /* FIXME: Shouldn't we introduce a means to tag a vtype both
+ as abstract *and* not delegated? (Currently, the rule below
+ prevents this). */
+ | stc::not_delegated_abstract, _, _ -> error ("Local "
+ "declaration of "
+ "not delegated "
+ "and abstract")
+
+ // local_res == stc::final<T>.
+ | stc::final<T>, stc::final<U>, _ -> error ("Final VT "
+ "redefined final.")
+ | stc::final<T>, _, _ -> stc::final<T>
+
+ // local_res == T.
+ | T, stc::final<U>, _ -> error ("Final VT "
+ "redefined.")
+ | T, _, _ -> T
+
+
+
+
===========================================================================
-* Bottom-up approach (not finished)
+* Bottom-up approach (FIXME: not finished, and old)
This implementation doesn't handle stc::not_delegated properly.
@@ -131,141 +283,3 @@
| stc::abstract, U -> U
| T, _ -> T
-
-
-Notes:
-
-- syntax: foo#super returns the type of the super class of foo.
-
-- syntax: 'foo_type' stands for the SCOOP virtual type named foo_type.
-
-- stc::none#super is an error, so calling `find (none, ...)' might be
- an error !
-
-
-===========================================================================
-* Top-down approach
-
-
-** find
-
-FIXME: To be written from algorithms.ml.
-
-** find_rec
-
-function find_rec (source, target) =
- if (source = mlc::none)
- stc::not_found
- else
- let local_res = find_local (source, target) in
-
- let super_res = find_rec (source#super, target) in
- // FIXME: This might not be efficient, since find_rec can be
- // called several times on the nodes of the delegation branch when
- // going down the inheritance branch. Of course, the declarative
- // nature of C++ templates will avoid this cost, but it remains
- // inelegant, IMHO.
-
- let delegatee = find_rec_in_supers (source, 'delegatee_type') in
- let delegatee_res =
- if (delegatee = stc::not_found)
- stc::not_found
- else
- find_rec (delegatee, target) in
-
- merge3 (local_res, super_res, delegatee_res)
-
-
-// Like find_rec, but only search in the inheritance branch.
-function find_rec_in_supers (source, target) =
- if (source = mlc::none)
- stc::not_found
- else
- let local_res = find_local (source, target) in
- let super_res = find_rec (source#super, target) in
- merge2 (local_res, super_res)
-
-
-merge2 (local_res, super_res) =
- match local_res, super_res with
-
- | stc::abstract, stc::not_found -> stc::abstract
- | mlc::not_found, stc::not_found -> stc::not_found
- | T, stc::not_found -> T
- | stc::final<T>, stc::not_found -> stc::final<T>
-
- | mlc::not_found, stc::abstract -> stc::not_found
- | stc::abstract, stc::abstract -> stc::abstract
- | T, stc::abstract -> T
- | stc::final<T>, stc::abstract -> stc::final<T>
-
- | stc::abstract, U -> error ("VT redefined abstract.")
- | mlc::not_found, U -> U
- | T, U -> T
- | stc::final<T>, U -> stc::final<T>
-
- | stc::abstract, stc::final<U> -> error ("Final VT redefined abstract")
- | mlc::not_found, stc::final<U> -> stc::final<U>
- | T, stc::final<U> -> error ("Final VT redefined.")
- | stc::final<T>, stc::final<U> -> error ("Final VT redefined final.")
-
-
-merge3 (local_res, super_res, delegatee_res) =
- match local_res, super_res, delegatee_res with
-
- // local_res == stc::not_found.
- | mlc::not_found, stc::not_found, stc::not_found -> stc::not_found
- | mlc::not_found, stc::not_found, stc::abstract -> stc::not_found
- | mlc::not_found, stc::not_found, stc::final<V> -> stc::final<V>
- | mlc::not_found, stc::not_found, V -> V
-
- | mlc::not_found, stc::abstract, stc::not_found -> stc::not_found
- | mlc::not_found, stc::abstract, stc::abstract -> stc::abstract
- | mlc::not_found, stc::abstract, stc::final<V> -> stc::final<V>
- | mlc::not_found, stc::abstract, V -> V
-
- | mlc::not_found, stc::final<U>, _ -> stc::final<U>
- | mlc::not_found, U, _ -> U
-
-
- // local_res == stc::not_abstract.
- | stc::abstract, stc::not_found, stc::not_found -> stc::abstract
- | stc::abstract, stc::not_found, stc::abstract -> stc::abstract
- | stc::abstract, stc::not_found, stc::final<V> -> stc::final<V>
- | stc::abstract, stc::not_found, V -> V
-
- | stc::abstract, stc::abstract, stc::not_found -> stc::abstract
- | stc::abstract, stc::abstract, stc::abstract -> stc::abstract
- | stc::abstract, stc::abstract, stc::final<V> -> stc::final<V>
- | stc::abstract, stc::abstract, V -> V
-
- | stc::abstract, stc::not_delegated_abstract, _ -> stc::not_delegated_abstract
- | stc::abstract, stc::not_delegated, _ -> stc::not_delegated_abstract
-
- | stc::abstract, stc::final<U>, _ -> error ("Final VT "
- "redefined abstract")
- | stc::abstract, U, _ -> error ("VT redefined "
- "abstract.")
- // local_res == stc::not_delegated.
- | stc::not_delegated, stc::not_found, _ -> stc::not_delegated
- | stc::not_delegated, stc::abstract, _ -> stc::not_delegated_abstract
- | stc::not_delegated, stc::not_delegated_abstract, _ -> stc::not_delegated_abstract
-
- // local_res == stc::not_delegated_abstract.
- /* FIXME: Shouldn't we introduce a means to tag a vtype both
- as abstract *and* not delegated? (Currently, the rule below
- prevents this). */
- | stc::not_delegated_abstract, _, _ -> error ("Local "
- "declaration of "
- "not delegated "
- "and abstract")
-
- // local_res == stc::final<T>.
- | stc::final<T>, stc::final<U>, _ -> error ("Final VT "
- "redefined final.")
- | stc::final<T>, _, _ -> stc::final<T>
-
- // local_res == T.
- | T, stc::final<U>, _ -> error ("Final VT "
- "redefined.")
- | T, _, _ -> T
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Start a draft of Static's documentation.
* doc/README, doc/intro.txt, doc/rules.txt, doc/scool.txt,
* doc/algorithms.txt: New.
* doc/algorithms.ml: New (prototype of Static's type-checking rules,
written in Objective Caml).
* stc/scoop.hh: Typos, FIXMEs.
doc/README | 20 +
doc/algorithms.ml | 567 +++++++++++++++++++++++++++++++++++++++++++++++++++++
doc/algorithms.txt | 271 +++++++++++++++++++++++++
doc/intro.txt | 292 +++++++++++++++++++++++++++
doc/rules.txt | 514 ++++++++++++++++++++++++++++++++++++++++++++++++
doc/scool.txt | 12 +
stc/scoop.hh | 11 -
7 files changed, 1685 insertions(+), 2 deletions(-)
Index: doc/algorithms.ml
--- doc/algorithms.ml (revision 0)
+++ doc/algorithms.ml (revision 0)
@@ -0,0 +1,567 @@
+(* Prototyping SCOOP's algorithms on virtual types in Objective Caml. *)
+
+
+(*--------.
+| Types. |
+`--------*)
+
+module StringType =
+ struct
+ type t = string
+ let compare = String.compare
+ end
+;;
+
+module StringMap = Map.Make (StringType);;
+
+
+type cxx_type =
+ (* Static stypes. *)
+ | Stc_None
+ | Stc_Not_found
+ | Stc_Abstract
+ | Stc_Not_delegated
+ | Stc_Not_delegated_Abstract
+ | Stc_Final of cxx_type
+
+ (* C++ types. *)
+ | Std_Char
+ | Std_Short
+ | Std_Int
+ | Std_Unsigned
+ | Std_Float
+ | Scoop_Class of scoop_class
+
+and vtypes_dict = cxx_type StringMap.t
+and scoop_class = { super: cxx_type; vtypes: vtypes_dict }
+;;
+
+(* A helper to create virtual types sets. *)
+let rec create_vtypes = function
+ | [] -> StringMap.empty
+ | (type_name, type_val)::t ->
+ StringMap.add type_name type_val (create_vtypes t)
+;;
+
+
+(*-----------------.
+| Error handling. |
+`-----------------*)
+
+exception Scoop_exception of string;;
+
+let error =
+ function s -> raise (Scoop_exception s)
+;;
+
+
+(*----------------------.
+| Virtual type lookup. |
+`----------------------*)
+
+let find_local (source: cxx_type) (target: string) : cxx_type =
+ match source with
+ | Scoop_Class c ->
+ begin
+ try
+ StringMap.find target c.vtypes
+ with Not_found -> Stc_Not_found
+ end
+ | _ -> raise (Scoop_exception "find_local: source is not SCOOP class.")
+;;
+
+let merge2 (local_res : cxx_type) (super_res : cxx_type) : cxx_type =
+ match local_res, super_res with
+
+ | Stc_Abstract, Stc_Not_found -> Stc_Abstract
+ | Stc_Not_found, Stc_Not_found -> Stc_Not_found
+ | Stc_Final t, Stc_Not_found -> Stc_Final t
+ | t, Stc_Not_found -> t
+
+ | Stc_Not_found, Stc_Abstract -> Stc_Not_found
+ | Stc_Abstract, Stc_Abstract -> Stc_Abstract
+ | Stc_Final t, Stc_Abstract -> Stc_Final t
+ | t, Stc_Abstract -> t
+
+ | Stc_Abstract, Stc_Final u -> error "Final VT redefined abstract"
+ | Stc_Not_found, Stc_Final u -> Stc_Final u
+ | Stc_Final t, Stc_Final u -> error "Final VT redefined final."
+ | t, Stc_Final u -> error "Final VT redefined."
+
+ | Stc_Abstract, u -> error "VT redefined abstract."
+ | Stc_Not_found, u -> u
+ | Stc_Final t, u -> Stc_Final t
+ | t, u -> t
+
+;;
+
+(* Another version (rewriting) of merge3. *)
+let merge3 (local_res : cxx_type) (super_res : cxx_type)
+ (delegatee_res : cxx_type) : cxx_type =
+ match local_res, super_res, delegatee_res with
+
+ (* local_res == stc::not_found. *)
+ | Stc_Not_found, Stc_Not_found, Stc_Not_found -> Stc_Not_found
+ | Stc_Not_found, Stc_Not_found, Stc_Abstract -> Stc_Not_found
+ | Stc_Not_found, Stc_Not_found, Stc_Final v -> Stc_Final v
+ | Stc_Not_found, Stc_Not_found, v -> v
+
+ | Stc_Not_found, Stc_Abstract, Stc_Not_found -> Stc_Not_found
+ | Stc_Not_found, Stc_Abstract, Stc_Abstract -> Stc_Abstract
+ | Stc_Not_found, Stc_Abstract, Stc_Final v -> Stc_Final v
+ | Stc_Not_found, Stc_Abstract, v -> v
+
+ | Stc_Not_found, Stc_Final u, _ -> Stc_Final u
+ | Stc_Not_found, u, _ -> u
+
+ (* local_res == stc::not_abstract. *)
+ | Stc_Abstract, Stc_Not_found, Stc_Not_found -> Stc_Abstract
+ | Stc_Abstract, Stc_Not_found, Stc_Abstract -> Stc_Abstract
+ | Stc_Abstract, Stc_Not_found, Stc_Final v -> Stc_Final v
+ | Stc_Abstract, Stc_Not_found, v -> v
+
+ | Stc_Abstract, Stc_Abstract, Stc_Not_found -> Stc_Abstract
+ | Stc_Abstract, Stc_Abstract, Stc_Abstract -> Stc_Abstract
+ | Stc_Abstract, Stc_Abstract, Stc_Final v -> Stc_Final v
+ | Stc_Abstract, Stc_Abstract, v -> v
+
+ | Stc_Abstract, Stc_Not_delegated_Abstract, _ -> Stc_Not_delegated_Abstract
+ | Stc_Abstract, Stc_Not_delegated, _ -> Stc_Not_delegated_Abstract
+
+ | Stc_Abstract, Stc_Final u, _ -> error ("Final VT " ^
+ "redefined abstract")
+ | Stc_Abstract, u, _ -> error ("VT redefined " ^
+ "abstract.")
+
+ (* local_res == stc::not_delegated. *)
+ | Stc_Not_delegated, Stc_Not_found, _ -> Stc_Not_delegated
+ | Stc_Not_delegated, Stc_Abstract, _ -> Stc_Not_delegated_Abstract
+ | Stc_Not_delegated, Stc_Not_delegated_Abstract, _ -> Stc_Not_delegated_Abstract
+
+ (* local_res == stc::not_delegated_abstract. *)
+ (* FIXME: Shouldn't we introduce a means to tag a vtype both
+ as abstract *and* not delegated? (Currently, the rule below
+ prevents this). *)
+ | Stc_Not_delegated_Abstract, _, _ -> error ("Local declaration" ^
+ " of not delegated" ^
+ " and abstract")
+
+ (* local_res == stc::final<T>. *)
+ | Stc_Final t, Stc_Final u, _ -> error ("Final VT " ^
+ "redefined final.")
+ | Stc_Final t, _, _ -> Stc_Final t
+
+ (* local_res == T. *)
+ | t, Stc_Final u, _ -> error ("Final VT " ^
+ "redefined.")
+ | t, _, _ -> t
+
+;;
+
+
+let rec find_rec (source : cxx_type) (target : string) : cxx_type =
+ match source with
+ | Stc_None -> Stc_Not_found
+ | Scoop_Class c ->
+ begin
+ let local_res = find_local source target in
+
+ let super_res = find_rec c.super target in
+ (* FIXME: This might not be efficient, since
+ find_rec_in_super can be called several times on the
+ nodes of the delegation branch when going down the
+ inheritance branch. Of course, the declarative nature
+ of C++ templates will avoid this cost, but it remains
+ inelegant, IMHO. *)
+
+ let delegatee = find_rec_in_supers source "delegatee_type" in
+ let delegatee_res =
+ if delegatee = Stc_Not_found then
+ Stc_Not_found
+ else
+ find_rec delegatee target in
+
+ merge3 local_res super_res delegatee_res
+ end
+ | _ -> error "find_rec: source is not a SCOOP class."
+
+(* Like find_rec, but only search in the inheritance branch. *)
+and find_rec_in_supers (source : cxx_type) (target : string) : cxx_type =
+ match source with
+ | Stc_None -> Stc_Not_found
+ | Scoop_Class c ->
+ begin
+ let local_res = find_local source target in
+ let super_res = find_rec c.super target in
+ merge2 local_res super_res
+ end
+ | _ -> error "find_rec_in_supers: source is not a SCOOP class."
+;;
+
+
+let find (source : cxx_type) (target : string) : cxx_type =
+ match find_rec source target with
+ | Stc_Abstract -> error "find: VT is abstract."
+ | Stc_Not_delegated_Abstract -> error "find: VT is abstract."
+ | Stc_Not_delegated -> Stc_Not_found
+ | Stc_Final t -> t
+ | t -> t
+;;
+
+
+
+(*-----------.
+| Examples. |
+`-----------*)
+
+(* ** Virtual type definition
+
+ Ex.
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+*)
+let a = Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Std_Int] } in
+assert (find a "my_type" = Std_Int);;
+
+
+(* ** Virtual type re-definition.
+
+ Ex.
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+ // Valid.
+ class B < A =
+ {
+ vtype my_type = float;
+ }
+ // Valid.
+ class C < A =
+ {
+ vtype my_type = int;
+ }
+*)
+let a = Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Std_Int] } in
+let b = Scoop_Class { super = a;
+ vtypes = create_vtypes ["my_type", Std_Float] } in
+let c = Scoop_Class { super = b;
+ vtypes = create_vtypes ["my_type", Std_Int] } in
+assert (find c "my_type" = Std_Int);;
+
+
+(* ** Virtual type abstract declaration (i.e., deferred definition).
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ // my_type is abstract.
+ vtype my_type = 0;
+ }
+ class B < A =
+ {
+ vtype my_type = int;
+ }
+*)
+let a = Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Stc_Abstract] } in
+let b = Scoop_Class { super = a;
+ vtypes = create_vtypes ["my_type", Std_Int] } in
+assert (find b "my_type" = Std_Int);;
+
+(* - A concrete virtual type cannot be redefined as abstract.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+ // Invalid.
+ class B < A =
+ {
+ vtype my_type = 0;
+ }
+*)
+let a = Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Std_Int] } in
+let b = Scoop_Class { super = a;
+ vtypes = create_vtypes ["my_type", Stc_Abstract] } in
+ try
+ ignore (find b "my_type")
+ with Scoop_exception "VT redefined abstract." -> ()
+;;
+
+
+(* ** Final virtual type
+
+ - A virtual type can be tagged as final.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ final vtype my_type = int;
+ }
+*)
+let a = Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Stc_Final Std_Int] }
+in
+assert (find a "my_type" = Std_Int);;
+
+(* - A virtual type tagged as final in a class cannot be redefined in its
+ subclasses, either tagged final or not, even if its value is
+ unchanged.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ final vtype my_type = int;
+ }
+ // Invalid.
+ class B < A =
+ {
+ vtype my_type = float;
+ }
+ // Invalid.
+ class C < A =
+ {
+ vtype my_type = int;
+ }
+ // Invalid.
+ class D < A =
+ {
+ final vtype my_type = int;
+ }
+ // Invalid.
+ class E < A =
+ {
+ final vtype my_type = float;
+ }
+*)
+let a = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Stc_Final Std_Int] } in
+let b = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes ["my_type", Std_Float] } in
+let c = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes ["my_type", Std_Int] } in
+let d = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes ["my_type", Stc_Final Std_Int] } in
+let e = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes ["my_type", Stc_Final Std_Float] } in
+
+ assert (find a "my_type" = Std_Int);
+ try ignore (find b "my_type")
+ with Scoop_exception "Final VT redefined." -> ();
+ try ignore (find c "my_type")
+ with Scoop_exception "Final VT redefined." -> ();
+ try ignore (find d "my_type")
+ with Scoop_exception "Final VT redefined final." -> ();
+ try ignore (find e "my_type")
+ with Scoop_exception "Final VT redefined final." -> ();
+;;
+
+(* ** General virtual type lookup
+
+ *** Abstract
+
+ class A < stc::none
+ {
+ // my_vtype not defined.
+ }
+
+ class D < stc::none
+ {
+ vtype my_type = 0;
+ }
+
+ // A
+ // ^
+ // |
+ // C<>--D
+ class C < stc::none
+ {
+ vtype delegatee_type = D;
+ }
+
+ // FIXME: What should be the value of ``t''?
+ // I would say ``stc::not_found'', but I'm not sure (see intro.txt, too).
+ type t = C#my_type;
+*)
+let a = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes [] } in
+let d = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes ["my_type", Stc_Abstract] } in
+let c = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes ["delegatee_type", d] } in
+assert (find c "my_type" = Stc_Not_found);;
+
+
+(* More examples.
+
+ ** A complex example, with stc::not_delegated.
+
+ A
+ ^
+ | X
+ B ^
+ ^ |
+ | Y
+ C<>-�
+ ^
+ |
+ D
+ ^
+ |
+ E
+
+
+ class A < stc::none | class C < B
+ { | {
+ } | vtype delegatee_type = Y;
+ class B < A | vtype foo = int;
+ { | vtype baz = not_delegated;
+ vtype foo = 0; | vtype hop = not_delegated;
+ } | }
+ | class D < C
+ class X < stc::none | {
+ { | vtype quux = unsigned;
+ vtype bar = 0; | }
+ vtype hop = int; | class E < D
+ } | {
+ class Y < X | vtype baz = float;
+ { | }
+ vtype baz = short; |
+ vtype bar = char; |
+ } |
+*)
+let a = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes [] } in
+let b = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes ["foo", Stc_Abstract] } in
+
+let x = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes [("bar", Stc_Abstract);
+ ("hop", Std_Int)] } in
+let y = Scoop_Class
+ { super = x;
+ vtypes = create_vtypes [("bar", Std_Char);
+ ("baz", Std_Short)] } in
+
+let c = Scoop_Class
+ { super = b;
+ vtypes = create_vtypes [("delegatee_type", y);
+ ("foo", Std_Int);
+ ("baz", Stc_Not_delegated);
+ ("hop", Stc_Not_delegated)] } in
+let d = Scoop_Class
+ { super = c;
+ vtypes = create_vtypes [("quux", Std_Unsigned)] } in
+let e = Scoop_Class
+ { super = d;
+ vtypes = create_vtypes [("baz", Std_Float)] } in
+
+assert (find e "foo" = Std_Int);
+assert (find e "bar" = Std_Char);
+assert (find e "baz" = Std_Float);
+assert (find e "quux" = Std_Unsigned);
+assert (find e "hop" = Stc_Not_found);
+;;
+
+
+(* *** abstract redefined with tag stc::not_delegated.
+
+ class A < stc::none |
+ { |
+ vtype foo = 0 |
+ } |
+ class B < A | class X < stc::none
+ { | {
+ vtype delegatee_type = X; | vtype foo = int;
+ vtype foo = stc::not_delegated | }
+ } |
+ class C < B |
+ { |
+ } |
+*)
+let a = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes ["foo", Stc_Abstract] } in
+
+let x = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes ["foo", Std_Int] } in
+
+let b = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes [("delegatee_type", x);
+ ("foo", Stc_Not_delegated)] } in
+let c = Scoop_Class
+ { super = b;
+ vtypes = create_vtypes [] } in
+
+(* foo is abstract and tagged ``not delegated'' for B. *)
+try ignore (find b "foo") with Scoop_exception "find: VT is abstract." -> ();
+(* Likewise for C. *)
+try ignore (find c "foo") with Scoop_exception "find: VT is abstract." -> ()
+;;
+
+
+(* *** abstract redefined with tag stc::not_delegated.
+
+ This is the converse situation from the previous example (foo is
+ declared abstract in C instead of A).
+
+ class A < stc::none |
+ { |
+ } |
+ class B < A | class X < stc::none
+ { | {
+ vtype delegatee_type = X; | vtype foo = int;
+ vtype foo = stc::not_delegated | }
+ } |
+ class C < B |
+ { |
+ vtype foo = 0 |
+ } |
+*)
+let a = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes [] } in
+
+let x = Scoop_Class
+ { super = Stc_None;
+ vtypes = create_vtypes ["foo", Std_Int] } in
+
+let b = Scoop_Class
+ { super = a;
+ vtypes = create_vtypes [("delegatee_type", x);
+ ("foo", Stc_Not_delegated)] } in
+let c = Scoop_Class
+ { super = b;
+ vtypes = create_vtypes ["foo", Stc_Abstract] } in
+
+(* foo is abstract and tagged ``not delegated'' for B. *)
+assert (find b "foo" = Stc_Not_found);
+(* Likewise for C. *)
+try ignore (find c "foo") with Scoop_exception "find: VT is abstract." -> ()
+;;
Index: doc/algorithms.txt
--- doc/algorithms.txt (revision 0)
+++ doc/algorithms.txt (revision 0)
@@ -0,0 +1,271 @@
+SCOOP 2 - algorithms -*- outline -*-
+
+These algorithms are expressed in a pseudo-Caml like syntax.
+
+===========================================================================
+* Bottom-up approach (not finished)
+
+This implementation doesn't handle stc::not_delegated properly.
+
+** find_local
+
+fun find_local (source, target) =
+ mlc::get_typedef (source, target)
+
+(get_typedef is a routine from Metalic.)
+
+
+** find
+
+// FIXME: Handle final.
+
+fun find (source, target) =
+ if (source == stc::none)
+ error ("find: cannot perform lookup on stc::none.") // FIXME: Detail.
+ else
+ let local_type = find_local (source, target) in
+ let delegatee_type = find_local (source, 'delegatee_type') in
+
+ match local_type with
+
+ | stc::abstract -> error ("find: abstract virtual type in leaf class.")
+
+ | stc::no_delegation ->
+ // Look only in the inheritance branch only.
+ find_rec (source#super, target)
+
+ | mlc::not_found ->
+ if (delegatee_type = mlc::not_found)
+ // Look only in the inheritance branch only.
+ find_rec (source#super, target)
+ else
+ let inheritance_branch_res = find_rec (source#super, target) in
+ let delegation_branch_res = find_rec (delegatee_type, target) in
+ merge (inheritance_branch_res, delegation_branch_res)
+
+ | T -> T
+
+
+** find_rec0
+
+(Previous version of find_rec.)
+
+fun find_rec0 (source, target, is_abstract = false) =
+ let local_type = find_local (source, target) in
+
+ match local_type, source#super, is_abstract with
+
+ | stc::not_delegated, _ , _ ->
+ error ("find_rec: stc::delegation found in non-leaf class.")
+
+ | mlc::not_found, mlc::none, _ -> stc::not_found
+ | mlc::not_found, S , _ -> find_rec (S, target, is_abstract)
+
+ | stc::abstract, mlc::none, _ -> stc::abstract
+ | stc::abstract, S , _ -> find_rec (S, target, true)
+
+ // Final<T> is handled like T (the checks are performed elsewhere).
+ | stc::final<T>, _, false -> T
+ | stc::final<T>, _, true ->
+ error ("find_rec: virtual type redefined abstract.")
+
+ | T, _, false -> T
+ | T, _, true ->
+ error ("find_rec: virtual type redefined abstract.")
+
+
+** find_rec
+
+FIXME: Improve the automaton of the states (abstract, defined, final,
+etc.)
+
+fun find_rec (source, target, res = stc::not_found) =
+ if (source = mlc::none)
+ res
+ else
+ let local_type = find_local (source, target) in
+
+ match local_type, res with
+
+ | stc::not_delegated, _ ->
+ error ("find_rec: stc::delegation found in non-leaf class.")
+
+ | mlc::not_found, _ -> find_rec (source#super, target, res)
+
+ // The values below cannot be used to redefine a *final* virtual type.
+
+ | stc::abstract, _ -> find_rec (source#super, target, stc::abstract)
+
+ | T, _ -> T
+ match res with
+ | stc::not_found -> find_rec (source#super, target, T)
+ | stc::abstract ->
+ // FIXME: Detail
+ error ("find_rec: virtual type redefined as abstract.")
+ | _ -> find_rec (source#super, target, T)
+
+ // stc::final<T> is handled like T, with additional checks.
+ | stc::final<T>, _ ->
+ match res with
+ | stc::not_found -> find_rec (source#super, target, T)
+ | stc::abstract ->
+ // FIXME: Detail
+ error ("find_rec: final virtual type redefined as abstract.")
+ | _ -> error ("find_rec: final virtual type redefined.")
+
+
+FIXME: Write another version where the search is performed top-down
+(in both branches). Handling the lookup this way seems to ease the
+writing of states and automata.
+
+** merge
+
+fun merge (inheritance_branch_res delegation_branch_res) =
+ match (inheritance_branch_res, delegation_branch_res)
+ | stc::not_found, stc::not_found -> stc::not_found
+ | stc::not_found, stc::abstract -> stc::not_found
+ | stc::not_found, U -> U
+
+ | stc::abstract, stc::not_found -> error () // FIXME: Detail.
+ | stc::abstract, stc::abstract -> error () // FIXME: Detail.
+ | stc::abstract, U -> U
+
+ | T, _ -> T
+
+
+Notes:
+
+- syntax: foo#super returns the type of the super class of foo.
+
+- syntax: 'foo_type' stands for the SCOOP virtual type named foo_type.
+
+- stc::none#super is an error, so calling `find (none, ...)' might be
+ an error !
+
+
+===========================================================================
+* Top-down approach
+
+
+** find
+
+FIXME: To be written from algorithms.ml.
+
+** find_rec
+
+function find_rec (source, target) =
+ if (source = mlc::none)
+ stc::not_found
+ else
+ let local_res = find_local (source, target) in
+
+ let super_res = find_rec (source#super, target) in
+ // FIXME: This might not be efficient, since find_rec can be
+ // called several times on the nodes of the delegation branch when
+ // going down the inheritance branch. Of course, the declarative
+ // nature of C++ templates will avoid this cost, but it remains
+ // inelegant, IMHO.
+
+ let delegatee = find_rec_in_supers (source, 'delegatee_type') in
+ let delegatee_res =
+ if (delegatee = stc::not_found)
+ stc::not_found
+ else
+ find_rec (delegatee, target) in
+
+ merge3 (local_res, super_res, delegatee_res)
+
+
+// Like find_rec, but only search in the inheritance branch.
+function find_rec_in_supers (source, target) =
+ if (source = mlc::none)
+ stc::not_found
+ else
+ let local_res = find_local (source, target) in
+ let super_res = find_rec (source#super, target) in
+ merge2 (local_res, super_res)
+
+
+merge2 (local_res, super_res) =
+ match local_res, super_res with
+
+ | stc::abstract, stc::not_found -> stc::abstract
+ | mlc::not_found, stc::not_found -> stc::not_found
+ | T, stc::not_found -> T
+ | stc::final<T>, stc::not_found -> stc::final<T>
+
+ | mlc::not_found, stc::abstract -> stc::not_found
+ | stc::abstract, stc::abstract -> stc::abstract
+ | T, stc::abstract -> T
+ | stc::final<T>, stc::abstract -> stc::final<T>
+
+ | stc::abstract, U -> error ("VT redefined abstract.")
+ | mlc::not_found, U -> U
+ | T, U -> T
+ | stc::final<T>, U -> stc::final<T>
+
+ | stc::abstract, stc::final<U> -> error ("Final VT redefined abstract")
+ | mlc::not_found, stc::final<U> -> stc::final<U>
+ | T, stc::final<U> -> error ("Final VT redefined.")
+ | stc::final<T>, stc::final<U> -> error ("Final VT redefined final.")
+
+
+merge3 (local_res, super_res, delegatee_res) =
+ match local_res, super_res, delegatee_res with
+
+ // local_res == stc::not_found.
+ | mlc::not_found, stc::not_found, stc::not_found -> stc::not_found
+ | mlc::not_found, stc::not_found, stc::abstract -> stc::not_found
+ | mlc::not_found, stc::not_found, stc::final<V> -> stc::final<V>
+ | mlc::not_found, stc::not_found, V -> V
+
+ | mlc::not_found, stc::abstract, stc::not_found -> stc::not_found
+ | mlc::not_found, stc::abstract, stc::abstract -> stc::abstract
+ | mlc::not_found, stc::abstract, stc::final<V> -> stc::final<V>
+ | mlc::not_found, stc::abstract, V -> V
+
+ | mlc::not_found, stc::final<U>, _ -> stc::final<U>
+ | mlc::not_found, U, _ -> U
+
+
+ // local_res == stc::not_abstract.
+ | stc::abstract, stc::not_found, stc::not_found -> stc::abstract
+ | stc::abstract, stc::not_found, stc::abstract -> stc::abstract
+ | stc::abstract, stc::not_found, stc::final<V> -> stc::final<V>
+ | stc::abstract, stc::not_found, V -> V
+
+ | stc::abstract, stc::abstract, stc::not_found -> stc::abstract
+ | stc::abstract, stc::abstract, stc::abstract -> stc::abstract
+ | stc::abstract, stc::abstract, stc::final<V> -> stc::final<V>
+ | stc::abstract, stc::abstract, V -> V
+
+ | stc::abstract, stc::not_delegated_abstract, _ -> stc::not_delegated_abstract
+ | stc::abstract, stc::not_delegated, _ -> stc::not_delegated_abstract
+
+ | stc::abstract, stc::final<U>, _ -> error ("Final VT "
+ "redefined abstract")
+ | stc::abstract, U, _ -> error ("VT redefined "
+ "abstract.")
+ // local_res == stc::not_delegated.
+ | stc::not_delegated, stc::not_found, _ -> stc::not_delegated
+ | stc::not_delegated, stc::abstract, _ -> stc::not_delegated_abstract
+ | stc::not_delegated, stc::not_delegated_abstract, _ -> stc::not_delegated_abstract
+
+ // local_res == stc::not_delegated_abstract.
+ /* FIXME: Shouldn't we introduce a means to tag a vtype both
+ as abstract *and* not delegated? (Currently, the rule below
+ prevents this). */
+ | stc::not_delegated_abstract, _, _ -> error ("Local "
+ "declaration of "
+ "not delegated "
+ "and abstract")
+
+ // local_res == stc::final<T>.
+ | stc::final<T>, stc::final<U>, _ -> error ("Final VT "
+ "redefined final.")
+ | stc::final<T>, _, _ -> stc::final<T>
+
+ // local_res == T.
+ | T, stc::final<U>, _ -> error ("Final VT "
+ "redefined.")
+ | T, _, _ -> T
Index: doc/rules.txt
--- doc/rules.txt (revision 0)
+++ doc/rules.txt (revision 0)
@@ -0,0 +1,514 @@
+SCOOP 2 -- rules -*- outline -*-
+
+
+* Keywords
+
+- Keywords added to the language (both SCOOL or C++):
+
+ delegatee_type (FIXME: or stc_delegatee_type?)
+ abstract (syntax: ``= 0'')
+ final (syntax: ``final vtype ...'')
+ stc::not_found (note: different from mlc::not_found)
+ stc::not_delegated
+
+ stc::not_delegated_abstract (private type, used internally --
+ cannot be used by the programmer).
+
+ stc::none (FIXME: What about stc::top ?)
+
+ deferred_type? (FIXME: Which syntax?)
+
+
+* Declaration/definition
+
+** Class definition
+
+- A class has almost the same meaning as in C++: an entity gathering
+ data and operations. C++ (as well as SCOOL) also allows classes to
+ define types (via typedefs); this ability is part of SCOOP, and is
+ extended to the notion of virtual types (see the relevant item).
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ // A variable.
+ var pi : float = 3.14;
+ // A function.
+ fun sqr : (a : int) -> int
+ => a * a;
+ // A (classical) type.
+ type t = int
+ // A virtual type.
+ vtype vt = float;
+ }
+
+ In the present document, we will mainly deal with virtual type.
+
+- A class must inherit from another class. When a class has
+ semantically no superclass, its superclass must be set to stc::none.
+ A class having no supertype is invalid.
+
+ Ex.:
+
+ // Valid (assuming S is a valid class).
+ class A < S =
+ {
+ // ...
+ }
+
+ Ex.:
+
+ // Valid.
+ class A < stc::none =
+ {
+ // ...
+ }
+
+ Ex.:
+
+ // Invalid.
+ class A =
+ {
+ // ...
+ }
+
+** Virtual type definition
+
+- Each class can provide zero, one or more virtual type(s).
+
+ // FIXME: Validity of the definition? What can the user put in RHS?
+ // What about deferred type?
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+
+
+** Virtual type re-definition
+
+- Unless declared final (see relevant item), a virtual type of a class
+ can be redefined in its subclass(es). The new value can be the same
+ or different for the inital one. The syntax is the same as the one
+ for defining a virtual type.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+ // Valid.
+ class B < A =
+ {
+ vtype my_type = float;
+ }
+ // Valid.
+ class C < A =
+ {
+ vtype my_type = int;
+ }
+
+FIXME: Restrictions on computed values? (-> deferred vtypes, etc.)
+
+** Virtual type abstract declaration (i.e., deferred definition)
+
+- The definition of a virtual type can be deferred, i.e. a virtual
+ type can be just /declared/. Such a virtual type is said to be
+ abstract. A non-abstract virtual type is said to be concrete.
+
+ A class containing at least an abstract virtual type
+ (resp. containing no virtual type) is said abstract
+ (resp. concrete).
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ // my_type is abstract.
+ vtype my_type = 0;
+ }
+ class B < A =
+ {
+ vtype my_type = int;
+ }
+
+- A concrete virtual type cannot be redefined as abstract.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ vtype my_type = int;
+ }
+ // Invalid.
+ class B < A =
+ {
+ vtype my_type = 0;
+ }
+
+
+** Final virtual type
+
+- A virtual type can be tagged as final.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ final vtype my_type = int;
+ }
+
+- A virtual type tagged as final in a class cannot be redefined in its
+ subclasses, either tagged final or not, even if its value is
+ unchanged.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ final vtype my_type = int;
+ }
+ // Invalid.
+ class B < A =
+ {
+ vtype my_type = float;
+ }
+ // Invalid.
+ class C < A =
+ {
+ vtype my_type = int;
+ }
+ // Invalid.
+ class D < A =
+ {
+ final vtype my_type = int;
+ }
+ // Invalid.
+ class E < A =
+ {
+ final vtype my_type = float;
+ }
+
+- A final type cannot be abstract.
+
+ Ex.:
+
+ // Invalid.
+ class A < stc::none =
+ {
+ final vtype my_type = 0;
+ }
+
+FIXME: Is that all concerning abstract and final?
+
+
+** Delegation
+
+As stated before, any class has a super class in the SCOOP paradigm.
+SCOOP also allows a class to have a /delegatee/, i.e., a type it can
+use or depend on -- but without fulfilling the ``IS A'' relationship.
+
+- There is at most one delegatee (having a delegatee is not
+ mandatory).
+
+- Delegation is introduced thanks to a special virtual type,
+ delegatee_type (see below).
+
+*** Delegatee type
+
+- The virtual type `delegatee_type' is special: it is not looked up like
+ the other virtual types (see the lookup section).
+
+ class D < stc::none =
+ {
+ }
+ class A < stc::none =
+ {
+ vtype delegatee_type = D;
+ }
+
+- A delagatee_type virtual type can be abstract in a class, and given
+ a concrete definition in a subclass. As for other virtual types,
+ the fact that it is abstract renders the class abstract.
+
+ Ex.:
+
+ class D < stc::none =
+ {
+ }
+ class A < stc::none =
+ {
+ // Deferred definition of delagatee_type.
+ vtype delegatee_type = 0;
+ }
+ class B < A =
+ {
+ vtype delegatee_type = D;
+ }
+
+- If its no abstract, the value of a delegatee_type virtual type must
+ be a (SCOOP) class name.
+
+ class A < stc::none =
+ {
+ // Invalid.
+ vtype delegatee_type = int;
+ }
+
+- The virtual type `delegatee_type' cannot be tagged as final.
+ However, if its is actually defined (not just declared) in a class,
+ the delegatee_type virtual type cannot be subsequently redefined in
+ any of its subclasses, either with the same value or with another
+ one.
+
+
+ Ex.:
+
+ class D1 < stc::none =
+ {
+ }
+ class D2 < stc::none =
+ {
+ }
+ class A < stc::none =
+ {
+ vtype delegatee_type = D1;
+ }
+ class B < A =
+ {
+ // Invalid.
+ vtype delegatee_type = D1;
+ }
+ class C < A =
+ {
+ // Invalid.
+ vtype delegatee_type = D2;
+ }
+
+FIXME: Continue.
+
+
+* Lookup
+
+The process of retrieving a virtual type given a class (``source'')
+and a type name (``target'') is call ``virtual type lookup''. We'll
+use a has (or pound) symbol (#) to a virtual type lookup.
+
+ Ex.:
+
+ class A < stc::none =
+ {
+ vtype foo = int;
+ }
+
+ // t contains the value of the virtual type foo from class A.
+ type t = A#foo;
+
+** Local lookup
+
+Recall: The lookup process is recursive: it starts from a class (a
+priori concrete).
+
+This process relies on an `atomic' lookup on each inspected class:
+each of them can be queried for a locally defined virtual type.
+(FIXME: reference to the local_find algorithm.)
+
+The result of this local lookup is
+- mlc::not_found: meaning there is no delegatee_type;
+- another C++ type: this is then the result of the lookup;
+- a compile-time error (mlc::assert or mlc::abort), meaning that
+ something is either wrong in the virtual type definitions or in the
+ query.
+
+
+** General virtual type lookup
+
+When looking for a virtual type from a class, the answer can come from
+- the class itself, if it directly defines the virtual type;
+- one of its super classes (``the inheritance branch'');
+- if applicable, its delegatee, or one of its super classes (``the
+ delegation branch'').
+
+
+So, the lookup is performed in a single or a double (if there is a
+delegatee) recursive search up from the class in the inheritance and
+the delegation branch (if applicable).
+
+
+Teh first step in the lookup is to find whether a local definition of
+the virtual type (i.e., within the ``source'' class) exists. (See item
+``Local lookup''). If so, it is returned.
+
+If (FIXME: Finish this sentence.)
+
+
+FIXME: Do we want to perform the checks of the inheritance and
+delegation branch (in that event).
+
+Then, a delegatee_type is looked for. The result of this search can
+be either
+- stc::not_found: meaning there is no delegatee_type;
+- another C++ type: this is then the result of the lookup;
+- a compile-time error (mlc::assert or mlc::abort), meaning that
+ something is either wrong in the virtual type definitions or in the
+ query.
+
+Note: the general lookup procedure (either for delegatee_type or any
+other other virtual type) return stc::not_found when it fails to find
+the target virtual type, whereas the local lookup return
+mlc::not_found.
+
+
+
+
+FIXME: Continue.
+
+*** stc::not_delegated
+
+Cannot appear in a class of the delegation branch (aside from the
+junction class).
+
+*** Abstract
+
+[...]
+
+stc::abstract in a delegation branch:
+
+ class A < stc::none
+ {
+ // my_vtype not defined.
+ }
+
+ class D < stc::none
+ {
+ vtype my_type = 0;
+ }
+
+ // A
+ // ^
+ // |
+ // C<>--D
+ class C < stc::none
+ {
+ vtype delegatee_type = D;
+ }
+
+ // Gives stc::not_found.
+ type t = C#my_type;
+
+
+** delagatee_type lookup
+
+The lookup of delegatee_type is different from the lookup of other
+virtual types. While other virtual types are searched for in both the
+inheritance and the delegation branch, delegatee_type is only seeked
+in the inheritance branch (for infinite recursion reasons).
+
+FIXME: Continue.
+
+
+*** Abstract
+
+FIXME: Continue.
+
+* Examples
+
+
+** A complex example
+
+ A
+ ^
+ | X
+ B ^
+ ^ |
+ | Y
+ C<>-�
+ ^
+ |
+ D
+ ^
+ |
+ E
+
+ class A < stc::none
+ {
+ }
+ class B < A
+ {
+ vtype foo = 0;
+ }
+
+ class X < stc::none
+ {
+ vtype bar = 0;
+ vtype hop = int;
+ }
+ class Y < X
+ {
+ vtype bar = char;
+ vtype baz = short;
+ }
+
+ class C < B
+ {
+ vtype delegatee_type = Y;
+ vtype foo = int;
+ vtype baz = not_delegated;
+ vtype hop = not_delegated;
+ }
+ class D < C
+ {
+ vtype quux = unsigned;
+ }
+ class E < D
+ {
+ vtype baz = float;
+ }
+
+*** E#bar
+
+ A local_find(A, bar) = mlc::not_found
+ ^
+ |
+ | X local_find(X, bar) = 0
+ | ^
+ | |
+ B | local_find(B, bar) = mlc::not_found
+ ^ |
+ | |
+ | Y local_find(Y, bar) = char
+ | |
+ | |
+ C<>-� local_find(D, bar) = mlc::not_found
+ ^
+ |
+ D local_find(D, bar) = mlc::not_found
+ ^
+ |
+ E local_find(E, bar) = mlc::not_found
+
+*** E#hop
+
+ A local_find(A, bar) = mlc::not_found
+ ^
+ | X
+ B ^ local_find(B, bar) = mlc::not_found
+ ^ |
+ | Y
+ C<>-� local_find(D, bar) = stc::not_delegated
+ ^
+ |
+ D local_find(D, hop) = mlc::not_found
+ ^
+ |
+ E local_find(E, hop) = mlc::not_found
+
+
+
+Local Variables:
+ispell-local-dictionary: "american"
+End:
Index: doc/intro.txt
--- doc/intro.txt (revision 0)
+++ doc/intro.txt (revision 0)
@@ -0,0 +1,292 @@
+Static - Equipment for Static Hierarchies and SCOOP 2 -*- outline -*-
+
+This a very rough, buggy and incomplete draft of explanations on
+SCOOP 2. To be improved, fixed, and completed!
+
+
+* On virtual types
+
+A description of the mechanism of virtual types in SCOOP 2.
+
+** Rules
+
+A virtual type is like a typedef in a class scope, with added
+possibilities. Like a method (in C++),
+- it can be abstract (i.e., only declared, with a postponed
+ definition, to be given in a concrete subclass);
+- it can be altered;
+- it is resolved (looked up for) bottom-up.
+
+SCOOP 2 describes a virtual type pattern where virtual types are
+declared and (re-)defined across a class hierarchy (thanks to the
+``super'' relationship), but also across a (single) delegation
+relationship.
+
+*** Virtual type name declaration
+
+The SCOOPed namespace must be equipped for every virtual type name.
+
+*** Class virtual types.
+
+- Each class can define any number of virtual types. Some of them
+ have a special meaning (see below):
+
+ - delegatee_type
+ - (supertype ?)
+
+ Some ``values'' (i.e., type assigned to the typedef standing for a
+ vtype) have a special meaning (see below):
+
+ - stc::abstract
+ - stc::final<T>
+ - stc::not_found
+ - stc::not_delegated
+
+*** Single inheritance
+
+**** Class definition
+ A
+ ^
+ |
+ B
+
+- A class *must* declare another class as being its superclass. When A
+ is a superclass of B, B is said to be a direct subclass or direct
+ derived class of A. Every subclass of B an (indirect) subclass or
+ (indirect) derived class of A.
+
+ Ex.:
+
+ A < B
+ {
+ // ...
+ }
+
+ When a class has semantically no superclass, its superclass must
+ be set to stc::none. A class having no supertype is invalid.
+
+ Ex.:
+
+ // Valid.
+ A < stc::none
+ {
+ // ...
+ }
+
+ // Invalid.
+ A
+ {
+ // ...
+ }
+
+- A virtual defined as stc::final<T> in a class cannot be redefined
+ in any of its derived class(es).
+
+- A (non final) virtual type defined in a class can be redefined in any
+ of its subclasses.
+
+- A vtype can be /declared/ as stc::abstract. Such a definition is
+ actually a making it a virtual declaration, meaning that an actual
+ type definition is required in a concrete subclass of the class
+ where this vtype was declared abstract, for this subclass to be
+ instantiable.
+
+ To put it in a nutshell: a valid virtual type cannot resolve as
+ stc::abstract.
+
+**** Virtual type look-up
+
+- The process of resolving a vtype involves a source (a class) and a
+ vtype (a typedef). If both the structures involved and the request
+ are valid, the result of this operation is
+
+ - a typedef, if the resolution succeeded;
+ - mlc::not_found.
+
+ Note that a source must be a *concrete* class.
+
+FIXME: Describe how the look-up works here.
+
+- A virtual type can resolve as mlc::not_found, if the queried class
+ doesn't have a value for this vtype (cf. supra).
+
+*** Single inheritance + single Delegation
+
+ A
+ ^
+ |
+ C<>--D
+
+- A class can have a special vtype named `delegatee_type', whose value
+ refers to another class name. The latter class will be a delegation
+ of the former class.
+
+- Prone to discussion:
+ The `delegatee_type' vtype is not looked up like other vtypes,
+ instead, only the considered concrete class is queried -- no
+ superclass is involved in this process.
+
+ Note: in Th�o's implementation of stc/scoop.hh (revision 712 in
+ the Olena repository), the `delegatee_type' vtype *is* looked up
+ throughout the super classes of the `from' class. Obviously, this
+ look-up doesn't occur not in the delegation branch!
+
+- The rules of the vtype look-up are affected by the presence of a
+ delegation. The default global rule is: unless defined in the
+ current class, a vtype if looked in the superclass branch first, then
+ in the delegation branch.
+
+FIXME: False.
+- The look-up w.r.t. stc::final<T> remains the same, but is performed
+ in the supertype branch and the delegation branch (if applicable).
+
+- When the vtype is defined in the class where it is looked for,
+ this value is returned.
+
+ Exception: if this typedef has value stc::not_delegated, the result
+ of the look-up is the same as if there was
+ - no delegation,
+ - no definition for this vtype in the considered class,
+ i.e., the result is computed from the superclass branch *only*.
+
+
+ When the vtype if not defined in the class, the look-up is done in
+ parallel, in the superclass branch and in the delegation branch. If
+ no error has arisen during theses (internal) look-ups, two typedefs
+ are returned (one for each branch). The final result of the overall
+ look-up is the result of a merge of the two typedefs, whose rules are
+ given by the following table.
+
+FIXME: For Olena 1.0, we'll consider that a vtype in the delegation
+branch cannot be stc::abstract.
+
+ +------------------------------+-----------------------------------------+
+ | | result of the delegation branch |
+ | +----------------+----------------+-------+
+ | | | stc::abstract | |
+ | | stc::not_found | (error must | U [2] |
+ | | | not occur [1]) | |
+ +-------------+----------------+----------------+----------------+-------+
+ | result of | stc::not_found | stc::not_found | stc::not_found | U |
+ | the look-up +----------------+----------------+----------------+-------+
+ | in the | stc::abstract | error | error | U |
+ | superclass +----------------+----------------+----------------+-------+
+ | branch | T [2] | T | T | T |
+ +-------------+----------------+----------------+----------------+-------+
+
+ Notes:
+ [1] The main idea being: delegation is additional material. Note
+ that we could have chosen the other convention
+
+ FIXME: Should there be error when the inheritance branch
+ answers stc::not_found and the delegation branch answers
+ stc::abstract?
+
+ [2] T and U are two types different from stc::not_found and
+ stc::abstract.
+
+
+* A bit of formalism
+
+** Types and algorithms signatures
+
+*** Built-in values
+
+cxx_type_name // any valid C++ type
+cxx_class_name :: cxx_type_name // a C++ class/struct
+
+*** SCOOP2 values
+
+vtype_name :: cxx_type_name
+scooped_class_name :: cxx_class_name
+
+
+find :: scooped_class_name, vtype_name -> cxx_type_name
+
+
+
+
+
+---------------------------------------------------------------------------
+* Open questions on this document, things to do, etc.
+
+In all these questions, we assume that A is a superclass of B.
+Let A be a superclass of B.
+
+- Can a vtype defined in A as concrete, be redefined in B as
+ stc::abstract? (at least not for Olena 1.0).
+
+- Can a virtual defined as stc::final<T> in a class A cannot be
+ ``redefined'' as stc::final<T> (i.e., the exact same type) in a
+ derived classed B? (No.)
+
+- Can a virtual type be assigned the type stc::not_found?
+
+- Is there a `exact_type' vtype? If so, does it have to be present in
+ every class?
+
+
+** Lookup Strategies
+
+*** Bottom-up, with fork at junction and merge of both results.
+Current strategy, half-designed in algorithm.txt.
+
+*** Top-down from each top class, with merge at junction.
+To be tried/written.
+
+
+*** Linear top-down (?)
+The walk in the delegation branch is performed between the upper part
+(above the junction) and the lower part (below the junction).
+
+*** Linear bottom-up (?)
+The walk in the delegation branch is performed between the lower
+part (below the junction) and the upper part (above the junction).
+
+*** Anything else (?)
+
+
+
+** Rule enforcement (virtual types checking)
+
+*** Ensuring the vtype name is known (i.e., declared in the SCOOPed namespace
+
+*** Existence of a superclass
+
+*** Absence/uniqueness of a delegation
+
+*** Checking Final vtypes
+
+(In both branches, if applicable.)
+
+*** Ensuring that the vtype is not abstract
+
+
+** Check algorithm
+
+// FIXME: To do.
+
+** Look-up algorithm
+
+ /** Virtual type look-up.
+
+ \a source is the (concrete) class from which the look-up is performed
+ \a target is the name of the virtual type looked for (without
+ the `_type' suffix). */
+ find :: scooped_class,
+ find(source, target)
+
+ // FIXME: Write algorithm.
+
+---------------------------------------------------------------------------
+
+
+
+
+
+Local Variables:
+ispell-local-dictionary: "american"
+End:
+
+ LocalWords: typedef SCOOPed namespace delegatee supertype vtype superclass
+ LocalWords: instantiable vtypes Th�o's stc typedefs ispell american
Index: doc/scool.txt
--- doc/scool.txt (revision 0)
+++ doc/scool.txt (revision 0)
@@ -0,0 +1,12 @@
+SCOOL -- summary and extensions -*- outline -*-
+
+
+This document doesn't describe the whole SCOOL language; see
+
+ https://trac.lrde.org/olena/trac.cgi/wiki/SCOOL
+
+for a detail documentation on the language. Instead, we'll mention
+only the traits needed to explain the novelties of SCOOP 2, both
+current elements of SCOOL and extensions.
+
+...
\ No newline at end of file
Index: doc/README
--- doc/README (revision 0)
+++ doc/README (revision 0)
@@ -0,0 +1,20 @@
+Static - Equipment for Static Hierarchies and SCOOP 2 -*- outline -*-
+
+(This a rough, buggy and incomplete draft of explanations on SCOOP 2.
+To be improved, fixed, and completed!)
+
+
+intro.txt General explanations on SCOOP 2
+scool.txt Short introduction to SCOOL and its extensions
+rules.txt More formal rules on SCOOP 2
+algorithms.txt Algorithms used in the SCOOP paradigm.
+algorithms.ml Likewise, written in Objective Caml.
+static.txt ?
+...
+
+
+
+Local Variables:
+ispell-local-dictionary: "american"
+End:
+
Index: stc/scoop.hh
--- stc/scoop.hh (revision 714)
+++ stc/scoop.hh (working copy)
@@ -81,7 +81,7 @@
/* FIXME: nothing here! \
* \
* mlc::none is not a default value \
- * so that the client should define stoppers \
+ * so that the client has to define stoppers \
*/ \
}; \
\
@@ -226,7 +226,7 @@
}; \
\
template <typename res1, typename res2> \
- struct helper_get_stm \
+ struct helper_get_stm /* FIXME: Insert mlc::abort_<> statement here? */ \
{ \
/* error */ \
}; \
@@ -246,6 +246,10 @@
\
\
\
+ /* -------------------- */ \
+ /* Checking algorithm. */ \
+ /* -------------------- */ \
+ \
/* \
* check_no_final_inherited \
* \
@@ -459,6 +463,9 @@
\
\
\
+ /* ------------------- */ \
+ /* Look-up algorithm. */ \
+ /* ------------------- */ \
\
/* \
* first_stm(from, target) \
1
0
2006-12-04 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Propagate scoop update to oln.
* oln/core/macros.hh
(oln_type_of_, oln_type_of, oln_deduce_type_of): Update and rename as...
(oln_vtype_, oln_vtype, oln_deduce_vtype): ...these.
(oln_deferred_vtype, oln_deduce_deferred_vtype): New.
(oln_find_vtype, oln_find_deferred_vtype): New.
* tests/morphers/add_neighborhood_morpher.cc: Update.
* tests/morphers/morphers.cc: Likewise.
* tests/core/image_entry.cc: Likewise.
* tests/core/grid.cc: Likewise.
* tests/core/image1d.cc: Likewise.
* tests/core/image2d.cc: Likewise.
* tests/core/image3d.cc: Likewise.
* tests/core/npoints.cc: Likewise.
* oln/debug/print.hh: Likewise.
* oln/core/typedefs.hh: Likewise.
* oln/core/automatic/impl.hh: Likewise.
* oln/core/automatic/image/image.hh: Likewise.
* oln/core/automatic/image/image_being_point_wise_random_accessible.hh:
Likewise.
* oln/core/automatic/image/image_having_neighborhood.hh: Likewise.
* oln/core/automatic/image/image_being_value_wise_random_accessible.hh:
Likewise.
* oln/core/automatic/topology/topology_having_bbox.hh: Likewise.
* oln/core/automatic/topology/topology_having_subset.hh: Likewise.
* oln/core/automatic/topology/topology_being_random_accessible.hh:
Likewise.
* oln/core/automatic/topology/topology_having_neighborhood.hh: Likewise.
* oln/core/spe/row.hh: Likewise.
* oln/core/spe/col.hh: Likewise.
* oln/core/spe/slice.hh: Likewise.
* oln/core/iterator_vtypes.hh: Likewise.
* oln/core/abstract/iterator_on_points.hh: Likewise.
* oln/core/abstract/image/hybrid/classical.hh: Likewise.
* oln/core/abstract/image/type/integre.hh: Likewise.
* oln/core/abstract/image/type/hierarchy.hh: Likewise.
* oln/core/abstract/image/computability/hierarchy.hh: Likewise.
* oln/core/abstract/image/dimension/1d.hh: Likewise.
* oln/core/abstract/image/dimension/2d.hh: Likewise.
* oln/core/abstract/image/dimension/3d.hh: Likewise.
* oln/core/abstract/image/point_wise_accessibility/hierarchy.hh: Likewise.
* oln/core/abstract/point_set/point_set_being_random_accessible.hh:
Likewise.
* oln/core/abstract/point_set/point_set_having_known_size.hh: Likewise.
* oln/core/abstract/point_set/point_set_being_connected.hh: Likewise.
* oln/core/abstract/point_set/point_set_having_bbox.hh: Likewise.
* oln/core/abstract/topology/topology_having_bbox.hh: Likewise.
* oln/core/abstract/topology/topology_being_random_accessible.hh: Likewise.
* oln/core/abstract/topology/topology_having_subset.hh: Likewise.
* oln/core/abstract/topology/topology_having_neighborhood.hh: Likewise.
* oln/core/abstract/internal/image_impl.hh: Likewise.
* oln/core/gen/piter_isubset.hh: Likewise.
* oln/core/gen/topo_add_isubset.hh: Likewise.
* oln/core/gen/bbox.hh: Likewise.
* oln/core/gen/topo_bbox.hh: Likewise.
* oln/core/gen/neighb.hh: Likewise.
* oln/core/gen/bkd_viter_lut.hh: Likewise.
* oln/core/gen/pset_list.hh: Likewise.
* oln/core/gen/window.hh: Likewise.
* oln/core/gen/topo_lbbox.hh: Likewise.
* oln/core/gen/pset_vec.hh: Likewise.
* oln/core/gen/pset_.hh: Likewise.
* oln/core/gen/fwd_viter_lut.hh: Likewise.
* oln/core/gen/mapimage.hh: Likewise.
* oln/core/gen/topo_add_nbh.hh: Likewise.
* oln/core/internal/topology_morpher.hh: Likewise.
* oln/core/internal/point_nd.hh: Likewise.
* oln/core/internal/bbox_bkd_piter.hh: Likewise.
* oln/core/internal/bbox_fwd_piter.hh: Likewise.
* oln/core/internal/dpoint_nd.hh: Likewise.
* oln/morpher/add_isubset.hh: Likewise.
* oln/morpher/value_cast.hh: Likewise.
* oln/morpher/thru_fun.hh: Likewise.
* oln/morpher/slice.hh: Likewise.
* oln/morpher/with_lut.hh: Likewise.
* oln/morpher/thru_mfun.hh: Likewise.
* oln/morpher/internal/image_value_morpher.hh: Likewise.
* oln/morpher/internal/image_extension.hh: Likewise.
* oln/morpher/add_neighborhood.hh: Likewise.
Entry classes now use:
- stc::abstract instead of mlc::undefined;
- stc::final when possible;
- 'deferred' versions of vtype access when required.
* oln/core/point_set_entry.hh: Update.
(set_super_type): New.
(vtypes): Update.
* oln/core/neighborhood_entry.hh: Likewise.
* oln/core/topology_entry.hh: Likewise.
* oln/core/image_entry.hh: Likewise.
* oln/core/abstract/grid.hh: Likewise.
* oln/core/abstract/image.hh: Likewise.
(decl): Re-activate static checks.
* oln/core/abstract/iterator.hh: Likewise.
* oln/core/abstract/point.hh: Likewise.
* oln/core/abstract/dpoint.hh: Likewise.
* oln/core/abstract/iterator_on_values.hh: Likewise.
* oln/core/abstract/window.hh: Likewise.
Remove obsolete definitions of now final vtypes.
* tests/core/image_entry.cc: Update.
* oln/core/1d/image1d.hh: Likewise.
* oln/core/2d/image2d.hh: Likewise.
* oln/core/3d/image3d.hh: Likewise.
Update tests with the 'find' version of vtype access.
* oln/core/abstract/image/mutability/hierarchy.hh: Update.
* oln/core/abstract/image/dimension/hierarchy.hh: Likewise.
* oln/core/abstract/image/neighborhood/hierarchy.hh: Likewise.
* oln/core/abstract/image/bbox/hierarchy.hh: Likewise.
* oln/core/abstract/image/value_wise_accessibility/hierarchy.hh: Likewise.
Update from 'delegated' to 'delegatee'.
* oln/core/abstract/internal/image_impl.hh: Update.
* oln/core/gen/topo_add_nbh.hh: Likewise.
* oln/core/internal/topology_morpher.hh: Likewise.
* oln/morpher/internal/image_value_morpher.hh: Likewise.
* oln/morpher/internal/image_extension.hh: Likewise.
* oln/core/typedefs.hh (delegated_type): Add commentary.
Misc.
* tests/core/at.cc: Cosmetic change.
* oln/core/gen/bbox.hh (vtypes): Fix typo.
* oln/core/gen/pset_list.hh: Likewise.
* oln/core/gen/pset_vec.hh: Likewise.
* oln/core/gen/pset_.hh: Likewise.
* tests/core/image_entry.cc (is_computed_type): Fix missing.
Index: tests/morphers/add_neighborhood_morpher.cc
===================================================================
--- tests/morphers/add_neighborhood_morpher.cc (revision 712)
+++ tests/morphers/add_neighborhood_morpher.cc (working copy)
@@ -61,11 +61,11 @@
// same interfaces as the underlying morphed image.
mlc::assert_< mlc_is_a_(image_with_nbh_t, oln::abstract::image2d) >::check();
// Check the type of neighborhood.
- mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_t, neighborhood),
+ mlc::assert_< mlc_eq(oln_vtype_(image_with_nbh_t, neighborhood),
oln::neighb2d) >::check();
// Instantiate a neighborhood for this image type.
- oln_type_of_(image_with_nbh_t, neighborhood) nbh;
+ oln_vtype_(image_with_nbh_t, neighborhood) nbh;
// Instantiate an object, and check its methods.
image_with_nbh_t ima_with_nbh(ima, nbh);
oln::neighb2d nbh2 = ima_with_nbh.neighborhood();
Index: tests/morphers/morphers.cc
===================================================================
--- tests/morphers/morphers.cc (revision 712)
+++ tests/morphers/morphers.cc (working copy)
@@ -65,11 +65,11 @@
mlc::assert_< mlc_is_a_(image_with_nbh_t,
oln::abstract::image_having_neighborhood) >::check();
// Check the type of neighborhood.
- mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_t, neighborhood),
+ mlc::assert_< mlc_eq(oln_vtype_(image_with_nbh_t, neighborhood),
oln::neighb2d) >::check();
// Instantiate a neighborhood for this image type.
- oln_type_of_(image_with_nbh_t, neighborhood) nbh;
+ oln_vtype_(image_with_nbh_t, neighborhood) nbh;
// Instantiate an object, and check its methods.
image_with_nbh_t ima_with_nbh(ima, nbh);
oln::neighb2d nbh2 = ima_with_nbh.neighborhood();
@@ -88,7 +88,7 @@
mlc::assert_< mlc_is_a_(image_with_nbh_id_t,
oln::abstract::image_having_neighborhood) >::check();
// Check the type of neighborhood.
- mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_id_t, neighborhood),
+ mlc::assert_< mlc_eq(oln_vtype_(image_with_nbh_id_t, neighborhood),
oln::neighb2d) >::check();
// Instantiate an object, and check its methods.
Index: tests/core/image_entry.cc
===================================================================
--- tests/core/image_entry.cc (revision 712)
+++ tests/core/image_entry.cc (working copy)
@@ -57,21 +57,20 @@
template<>
struct vtypes<my::image>
{
- // The switch for image_dimension (above image_entry) plugs the
- // inheritance relation to the right abstract::image_dimension
- // class using the sole grid information (the grid can be seen
- // here as a ``tag'').
- typedef oln::grid2d grid_type;
-
// Likewise, for the switch of image_typeness using the type of
// the value of the image.
typedef char value_type;
+ // The switch for image_dimension (above image_entry) plugs the
+ // inheritance relation to the right abstract::image_dimension
+ // class using the grid information fetched from the point type.
+ typedef point2d point_type;
+
// FIXME: Dummy values.
typedef topo2d topo_type;
- typedef point2d point_type;
typedef my::image concrete_type;
typedef my::dummy morpher_type;
+ typedef mlc::true_ is_computed_type;
};
template<>
Index: tests/core/at.cc
===================================================================
--- tests/core/at.cc (revision 712)
+++ tests/core/at.cc (working copy)
@@ -38,10 +38,12 @@
{
using namespace oln;
- image2d<int> ima(1, 1);
+ typedef image2d<int> I;
+ I ima(1, 1);
point2d p(0, 0);
(ima + c4).at(0, 0) = 51;
+
assert(ima(p) == 51);
image1d<int> sig(1);
Index: tests/core/grid.cc
===================================================================
--- tests/core/grid.cc (revision 712)
+++ tests/core/grid.cc (working copy)
@@ -39,7 +39,7 @@
// The extra pairs of parenthesis around mlc_value are needed to
// prevent the assert macro from interpreting the arguments of
// mlc_value as its own.
- assert((mlc_value(oln_type_of_(oln::grid1d, dimvalue))) == 1);
- assert((mlc_value(oln_type_of_(oln::grid2d, dimvalue))) == 2);
- assert((mlc_value(oln_type_of_(oln::grid3d, dimvalue))) == 3);
+ assert((mlc_value(oln_vtype_(oln::grid1d, dimvalue))) == 1);
+ assert((mlc_value(oln_vtype_(oln::grid2d, dimvalue))) == 2);
+ assert((mlc_value(oln_vtype_(oln::grid3d, dimvalue))) == 3);
}
Index: tests/core/image1d.cc
===================================================================
--- tests/core/image1d.cc (revision 712)
+++ tests/core/image1d.cc (working copy)
@@ -38,7 +38,7 @@
{
// Fill a 1D image using its iterator.
oln::image1d<char> ima1(3);
- oln_type_of_(oln::image1d<char>, piter) p1(ima1.topo());
+ oln_vtype_(oln::image1d<char>, piter) p1(ima1.topo());
for_all(p1)
ima1(p1) = 1;
@@ -54,7 +54,7 @@
// Add the three images.
oln::image1d<long> sum(ima1.topo());
- oln_type_of_(oln::image1d<long>, piter) p(sum.topo());
+ oln_vtype_(oln::image1d<long>, piter) p(sum.topo());
for_all(p)
sum(p) = ima1(p) + ima2(p) + ima3(p);
// And check the sum.
Index: tests/core/image2d.cc
===================================================================
--- tests/core/image2d.cc (revision 712)
+++ tests/core/image2d.cc (working copy)
@@ -38,7 +38,7 @@
{
// Fill a 2D image using its iterator.
oln::image2d<char> ima1(3, 3);
- oln_type_of_(oln::image2d<char>, piter) p1(ima1.topo());
+ oln_vtype_(oln::image2d<char>, piter) p1(ima1.topo());
for_all(p1)
ima1(p1) = 1;
@@ -55,7 +55,7 @@
// Add the three images.
oln::image2d<long> sum(ima1.topo());
- oln_type_of_(oln::image2d<long>, piter) p(sum.topo());
+ oln_vtype_(oln::image2d<long>, piter) p(sum.topo());
for_all(p)
sum(p) = ima1(p) + ima2(p) + ima3(p);
// And check the sum.
Index: tests/core/image3d.cc
===================================================================
--- tests/core/image3d.cc (revision 712)
+++ tests/core/image3d.cc (working copy)
@@ -38,7 +38,7 @@
{
// Fill a 3D image using its iterator.
oln::image3d<char> ima1(3, 3, 3);
- oln_type_of_(oln::image3d<char>, piter) p1(ima1.topo());
+ oln_vtype_(oln::image3d<char>, piter) p1(ima1.topo());
for_all(p1)
ima1(p1) = 1;
@@ -56,7 +56,7 @@
// Add the three images.
oln::image3d<long> sum(ima1.topo());
- oln_type_of_(oln::image3d<long>, piter) p(sum.topo());
+ oln_vtype_(oln::image3d<long>, piter) p(sum.topo());
for_all(p)
sum(p) = ima1(p) + ima2(p) + ima3(p);
// And check the sum.
Index: tests/core/npoints.cc
===================================================================
--- tests/core/npoints.cc (revision 712)
+++ tests/core/npoints.cc (working copy)
@@ -34,7 +34,7 @@
template <typename I>
unsigned npoints(const oln::abstract::image<I>& input)
{
- oln_type_of(I, piter) p(input.topo());
+ oln_vtype(I, piter) p(input.topo());
unsigned count = 0;
for_all(p)
++count;
Index: oln/debug/print.hh
===================================================================
--- oln/debug/print.hh (revision 712)
+++ oln/debug/print.hh (working copy)
@@ -73,7 +73,7 @@
template <typename I>
void print(const abstract::image<I>& input, std::ostream& ostr)
{
- oln_type_of(I, fwd_piter) p(input.topo());
+ oln_vtype(I, fwd_piter) p(input.topo());
for_all(p)
ostr << p.to_point() << ':' << format(input(p)) << ' ';
}
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 712)
+++ oln/core/typedefs.hh (working copy)
@@ -125,7 +125,7 @@
mlc_decl_typedef(neighborhood_type);
mlc_decl_typedef(subset_type);
- mlc_decl_typedef(delegated_type);
+ mlc_decl_typedef(delegated_type); // FIXME: soon obsolete
mlc_decl_typedef(topo_type);
mlc_decl_typedef(bbox_type);
@@ -168,85 +168,85 @@
/// Shortcuts formed such as "oln_something(T) means
-/// oln_type_of(T, something)".
+/// oln_vtype(T, something)".
/// \{
-# define oln_dim(T) oln_type_of(T, dim)
-# define oln_dim_(T) oln_type_of_(T, dim)
+# define oln_dim(T) oln_vtype(T, dim)
+# define oln_dim_(T) oln_vtype_(T, dim)
-# define oln_vec(T) oln_type_of(T, vec)
-# define oln_vec_(T) oln_type_of_(T, vec)
+# define oln_vec(T) oln_vtype(T, vec)
+# define oln_vec_(T) oln_vtype_(T, vec)
-# define oln_bbox(T) oln_type_of(T, bbox)
-# define oln_bbox_(T) oln_type_of_(T, bbox)
+# define oln_bbox(T) oln_vtype(T, bbox)
+# define oln_bbox_(T) oln_vtype_(T, bbox)
-# define oln_coord(T) oln_type_of(T, coord)
-# define oln_coord_(T) oln_type_of_(T, coord)
+# define oln_coord(T) oln_vtype(T, coord)
+# define oln_coord_(T) oln_vtype_(T, coord)
-# define oln_grid(T) oln_type_of(T, grid)
-# define oln_grid_(T) oln_type_of_(T, grid)
+# define oln_grid(T) oln_vtype(T, grid)
+# define oln_grid_(T) oln_vtype_(T, grid)
-# define oln_topo(T) oln_type_of(T, topo)
-# define oln_topo_(T) oln_type_of_(T, topo)
+# define oln_topo(T) oln_vtype(T, topo)
+# define oln_topo_(T) oln_vtype_(T, topo)
-# define oln_point(T) oln_type_of(T, point)
-# define oln_point_(T) oln_type_of_(T, point)
+# define oln_point(T) oln_vtype(T, point)
+# define oln_point_(T) oln_vtype_(T, point)
-# define oln_psite(T) oln_type_of(T, psite)
-# define oln_psite_(T) oln_type_of_(T, psite)
+# define oln_psite(T) oln_vtype(T, psite)
+# define oln_psite_(T) oln_vtype_(T, psite)
-# define oln_dpoint(T) oln_type_of(T, dpoint)
-# define oln_dpoint_(T) oln_type_of_(T, dpoint)
+# define oln_dpoint(T) oln_vtype(T, dpoint)
+# define oln_dpoint_(T) oln_vtype_(T, dpoint)
-# define oln_is_computed(T) oln_type_of(T, is_computed)
-# define oln_is_computed_(T) oln_type_of_(T, is_computed)
+# define oln_is_computed(T) oln_vtype(T, is_computed)
+# define oln_is_computed_(T) oln_vtype_(T, is_computed)
-# define oln_value(T) oln_type_of(T, value)
-# define oln_value_(T) oln_type_of_(T, value)
+# define oln_value(T) oln_vtype(T, value)
+# define oln_value_(T) oln_vtype_(T, value)
-# define oln_rvalue(T) oln_type_of(T, rvalue)
-# define oln_rvalue_(T) oln_type_of_(T, rvalue)
+# define oln_rvalue(T) oln_vtype(T, rvalue)
+# define oln_rvalue_(T) oln_vtype_(T, rvalue)
-# define oln_lvalue(T) oln_type_of(T, lvalue)
-# define oln_lvalue_(T) oln_type_of_(T, lvalue)
+# define oln_lvalue(T) oln_vtype(T, lvalue)
+# define oln_lvalue_(T) oln_vtype_(T, lvalue)
-# define oln_fwd_piter(T) oln_type_of(T, fwd_piter)
-# define oln_fwd_piter_(T) oln_type_of_(T, fwd_piter)
+# define oln_fwd_piter(T) oln_vtype(T, fwd_piter)
+# define oln_fwd_piter_(T) oln_vtype_(T, fwd_piter)
-# define oln_bkd_piter(T) oln_type_of(T, bkd_piter)
-# define oln_bkd_piter_(T) oln_type_of_(T, bkd_piter)
+# define oln_bkd_piter(T) oln_vtype(T, bkd_piter)
+# define oln_bkd_piter_(T) oln_vtype_(T, bkd_piter)
-# define oln_fwd_qiter(T) oln_type_of(T, fwd_qiter)
-# define oln_fwd_qiter_(T) oln_type_of_(T, fwd_qiter)
+# define oln_fwd_qiter(T) oln_vtype(T, fwd_qiter)
+# define oln_fwd_qiter_(T) oln_vtype_(T, fwd_qiter)
-# define oln_bkd_qiter(T) oln_type_of(T, bkd_qiter)
-# define oln_bkd_qiter_(T) oln_type_of_(T, bkd_qiter)
+# define oln_bkd_qiter(T) oln_vtype(T, bkd_qiter)
+# define oln_bkd_qiter_(T) oln_vtype_(T, bkd_qiter)
-# define oln_fwd_niter(T) oln_type_of(T, fwd_niter)
-# define oln_fwd_niter_(T) oln_type_of_(T, fwd_niter)
+# define oln_fwd_niter(T) oln_vtype(T, fwd_niter)
+# define oln_fwd_niter_(T) oln_vtype_(T, fwd_niter)
-# define oln_bkd_niter(T) oln_type_of(T, bkd_niter)
-# define oln_bkd_niter_(T) oln_type_of_(T, bkd_niter)
+# define oln_bkd_niter(T) oln_vtype(T, bkd_niter)
+# define oln_bkd_niter_(T) oln_vtype_(T, bkd_niter)
-# define oln_fwd_viter(T) oln_type_of(T, fwd_viter)
-# define oln_fwd_viter_(T) oln_type_of_(T, fwd_viter)
+# define oln_fwd_viter(T) oln_vtype(T, fwd_viter)
+# define oln_fwd_viter_(T) oln_vtype_(T, fwd_viter)
-# define oln_bkd_viter(T) oln_type_of(T, bkd_viter)
-# define oln_bkd_viter_(T) oln_type_of_(T, bkd_viter)
+# define oln_bkd_viter(T) oln_vtype(T, bkd_viter)
+# define oln_bkd_viter_(T) oln_vtype_(T, bkd_viter)
/// Even shorter shortcuts.
/// \{
-# define oln_piter(T) oln_type_of(T, fwd_piter)
-# define oln_piter_(T) oln_type_of_(T, fwd_piter)
+# define oln_piter(T) oln_vtype(T, fwd_piter)
+# define oln_piter_(T) oln_vtype_(T, fwd_piter)
-# define oln_qiter(T) oln_type_of(T, fwd_qiter)
-# define oln_qiter_(T) oln_type_of_(T, fwd_qiter)
+# define oln_qiter(T) oln_vtype(T, fwd_qiter)
+# define oln_qiter_(T) oln_vtype_(T, fwd_qiter)
-# define oln_niter(T) oln_type_of(T, fwd_niter)
-# define oln_niter_(T) oln_type_of_(T, fwd_niter)
+# define oln_niter(T) oln_vtype(T, fwd_niter)
+# define oln_niter_(T) oln_vtype_(T, fwd_niter)
-# define oln_viter(T) oln_type_of(T, fwd_viter)
-# define oln_viter_(T) oln_type_of_(T, fwd_viter)
+# define oln_viter(T) oln_vtype(T, fwd_viter)
+# define oln_viter_(T) oln_vtype_(T, fwd_viter)
/// \}
/// \}
Index: oln/core/macros.hh
===================================================================
--- oln/core/macros.hh (revision 712)
+++ oln/core/macros.hh (working copy)
@@ -32,30 +32,36 @@
# include <oln/core/typedefs.hh>
-# define oln_type_of_(OlnType, Alias) \
- oln::direct_type_of_<OlnType, oln::typedef_:: Alias##_type>::ret
+# define oln_vtype_(OlnType, Alias) \
+ stc_vtype_(oln, OlnType, Alias)
-# define oln_type_of(OlnType, Alias) \
- typename oln_type_of_(OlnType, Alias)
+# define oln_vtype(OlnType, Alias) \
+ stc_vtype(oln, OlnType, Alias)
+# define oln_find_vtype(OlnType, Alias) \
+ stc_find_vtype(oln, OlnType, Alias)
-# define oln_deduce_type_of(OlnType, Alias1, Alias2) \
-typename oln::direct_type_of_<typename oln::direct_type_of_<OlnType, oln::typedef_::Alias1##_type >::ret, \
- oln::typedef_::Alias2##_type >::ret
-# define oln_deduce(OlnType, Alias1, Alias2) \
- oln_deduce_type_of(OlnType, Alias1, Alias2)
+# define oln_deferred_vtype(OlnType, Alias) \
+ stc_deferred_vtype(oln, OlnType, Alias)
+# define oln_deduce_deferred_vtype(OlnType, Alias1, Alias2) \
+ stc_deduce_deferred_vtype(oln, OlnType, Alias1, Alias2)
+# define oln_deduce_vtype(OlnType, Alias1, Alias2) \
+ stc_deduce_vtype(oln, OlnType, Alias1, Alias2)
+
+# define oln_find_deduce_vtype(OlnType, Alias1, Alias2) \
+ stc_find_deduce_vtype(oln, OlnType, Alias1, Alias2)
+
+
+
#define oln_virtual_typedef(Typedef) \
- typedef oln_type_of(E, Typedef) Typedef
+ typedef oln_vtype(E, Typedef) Typedef
-// FIXME: Rec? The macro below is to ensure that static checks are removed during "Rec" tests.
-// #define oln_virtual_typedef(Typedef) typedef void Typedef
-
#endif // ! OLN_CORE_MACROS_HH
Index: oln/core/point_set_entry.hh
===================================================================
--- oln/core/point_set_entry.hh (revision 712)
+++ oln/core/point_set_entry.hh (working copy)
@@ -39,6 +39,11 @@
template <typename E> struct point_set_entry;
+ template <typename E>
+ struct set_super_type< point_set_entry<E> >
+ {
+ typedef mlc::none ret;
+ };
/// Virtual types associated to point_set_entry<E>.
@@ -46,20 +51,20 @@
template <typename E>
struct vtypes< point_set_entry<E> >
{
- typedef mlc::undefined point_type;
+ typedef stc::abstract point_type;
- typedef mlc::undefined fwd_piter_type;
- typedef mlc::undefined bkd_piter_type;
+ typedef stc::abstract fwd_piter_type;
+ typedef stc::abstract bkd_piter_type;
typedef mlc::none bbox_type;
- typedef mlc::undefined is_random_accessible_type;
- typedef mlc::undefined has_known_size_type;
- typedef mlc::undefined is_connected_type;
+ typedef stc::abstract is_random_accessible_type;
+ typedef stc::abstract has_known_size_type;
+ typedef stc::abstract is_connected_type;
// final.
- typedef oln_deduce(E, point, coord) coord_type;
- typedef oln_deduce(E, point, grid) grid_type;
- typedef oln_deduce(E, point, dim) dim_type;
+ typedef oln_deduce_vtype(E, point, coord) coord_type;
+ typedef oln_deduce_vtype(E, point, grid) grid_type;
+ typedef oln_deduce_vtype(E, point, dim) dim_type;
typedef oln_fwd_piter(E) piter_type;
};
Index: oln/core/neighborhood_entry.hh
===================================================================
--- oln/core/neighborhood_entry.hh (revision 712)
+++ oln/core/neighborhood_entry.hh (working copy)
@@ -40,11 +40,18 @@
template <typename E> struct neighborhood_entry;
+ template <typename E>
+ struct set_super_type< neighborhood_entry<E> >
+ {
+ typedef mlc::none ret;
+ };
+
+
/// Virtual types associated to neighborhood_entry<E>.
template <typename E>
struct vtypes< neighborhood_entry<E> >
{
- typedef mlc::undefined grid_type;
+ typedef stc::abstract grid_type;
};
Index: oln/core/automatic/impl.hh
===================================================================
--- oln/core/automatic/impl.hh (revision 712)
+++ oln/core/automatic/impl.hh (working copy)
@@ -44,7 +44,7 @@
/// Specialization of oln::automatic::get_impl saving the user
/// the need to specify the morpher type as tag.
template < template <class> class abstraction, typename E >
- class get_impl : public set_impl< abstraction, oln_type_of(E, morpher), E >
+ class get_impl : public set_impl< abstraction, oln_vtype(E, morpher), E >
{
};
Index: oln/core/automatic/image/image.hh
===================================================================
--- oln/core/automatic/image/image.hh (revision 712)
+++ oln/core/automatic/image/image.hh (working copy)
@@ -53,9 +53,9 @@
{
private:
- typedef oln_type_of(E, topo) topo_t;
- typedef oln_type_of(E, rvalue) rvalue_t;
- typedef oln_type_of(E, psite) psite_t;
+ typedef oln_vtype(E, topo) topo_t;
+ typedef oln_vtype(E, rvalue) rvalue_t;
+ typedef oln_vtype(E, psite) psite_t;
public:
Index: oln/core/automatic/image/image_being_point_wise_random_accessible.hh
===================================================================
--- oln/core/automatic/image/image_being_point_wise_random_accessible.hh (revision 712)
+++ oln/core/automatic/image/image_being_point_wise_random_accessible.hh (working copy)
@@ -55,7 +55,7 @@
{
private:
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
public:
Index: oln/core/automatic/image/image_having_neighborhood.hh
===================================================================
--- oln/core/automatic/image/image_having_neighborhood.hh (revision 712)
+++ oln/core/automatic/image/image_having_neighborhood.hh (working copy)
@@ -53,7 +53,7 @@
public virtual stc::any__simple<E>
{
private:
- typedef oln_type_of(E, neighborhood) neighborhood_t;
+ typedef oln_vtype(E, neighborhood) neighborhood_t;
public:
/// Accessor delegation.
Index: oln/core/automatic/image/image_being_value_wise_random_accessible.hh
===================================================================
--- oln/core/automatic/image/image_being_value_wise_random_accessible.hh (revision 712)
+++ oln/core/automatic/image/image_being_value_wise_random_accessible.hh (working copy)
@@ -54,8 +54,8 @@
public virtual stc::any__simple<E>
{
public:
- typedef oln_type_of(E, value) value_type;
- typedef oln_type_of(E, fwd_viter) fwd_viter_type;
+ typedef oln_vtype(E, value) value_type;
+ typedef oln_vtype(E, fwd_viter) fwd_viter_type;
public:
fwd_viter_type impl_value(const value_type& v) const;
@@ -70,8 +70,8 @@
public virtual stc::any__simple<E>
{
public:
- typedef oln_type_of(E, value) value_type;
- typedef oln_type_of(E, fwd_viter) fwd_viter_type;
+ typedef oln_vtype(E, value) value_type;
+ typedef oln_vtype(E, fwd_viter) fwd_viter_type;
public:
fwd_viter_type impl_value(const value_type& v);
Index: oln/core/automatic/topology/topology_having_bbox.hh
===================================================================
--- oln/core/automatic/topology/topology_having_bbox.hh (revision 712)
+++ oln/core/automatic/topology/topology_having_bbox.hh (working copy)
@@ -56,7 +56,7 @@
public virtual stc::any__simple<E>
{
private:
- typedef oln_type_of(E, bbox) bbox_t;
+ typedef oln_vtype(E, bbox) bbox_t;
public:
Index: oln/core/automatic/topology/topology_having_subset.hh
===================================================================
--- oln/core/automatic/topology/topology_having_subset.hh (revision 712)
+++ oln/core/automatic/topology/topology_having_subset.hh (working copy)
@@ -56,7 +56,7 @@
public virtual stc::any__simple<E>
{
private:
- typedef oln_type_of(E, subset) subset_t;
+ typedef oln_vtype(E, subset) subset_t;
public:
Index: oln/core/automatic/topology/topology_being_random_accessible.hh
===================================================================
--- oln/core/automatic/topology/topology_being_random_accessible.hh (revision 712)
+++ oln/core/automatic/topology/topology_being_random_accessible.hh (working copy)
@@ -57,7 +57,7 @@
public virtual stc::any__simple<E>
{
private:
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
public:
Index: oln/core/automatic/topology/topology_having_neighborhood.hh
===================================================================
--- oln/core/automatic/topology/topology_having_neighborhood.hh (revision 712)
+++ oln/core/automatic/topology/topology_having_neighborhood.hh (working copy)
@@ -56,7 +56,7 @@
public virtual stc::any__simple<E>
{
private:
- typedef oln_type_of(E, neighborhood) neighborhood_t;
+ typedef oln_vtype(E, neighborhood) neighborhood_t;
public:
Index: oln/core/spe/row.hh
===================================================================
--- oln/core/spe/row.hh (revision 712)
+++ oln/core/spe/row.hh (working copy)
@@ -81,14 +81,14 @@
template <typename P>
oln_coord(P) row(const abstract::point<P>& p)
{
- typedef oln_type_of(P, row_comp) comp_t;
+ typedef oln_vtype(P, row_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
template <typename P>
oln_coord(P)& row(abstract::point<P>& p)
{
- typedef oln_type_of(P, row_comp) comp_t;
+ typedef oln_vtype(P, row_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
@@ -97,14 +97,14 @@
template <typename D>
oln_coord(D) row(const abstract::dpoint<D>& p)
{
- typedef oln_type_of(D, row_comp) comp_t;
+ typedef oln_vtype(D, row_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
template <typename D>
oln_coord(D)& row(abstract::dpoint<D>& p)
{
- typedef oln_type_of(D, row_comp) comp_t;
+ typedef oln_vtype(D, row_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
@@ -113,7 +113,7 @@
template <typename P>
oln_coord(P) row(const abstract::iterator_on_points<P>& it)
{
- typedef oln_deduce_type_of(P, point, row_comp) comp_t;
+ typedef oln_deduce_vtype(P, point, row_comp) comp_t;
return it.to_point().vec()[mlc_value(comp_t)];
}
@@ -122,14 +122,14 @@
template <typename Ps>
oln_coord(Ps) min_row(const abstract::point_set_having_bbox<Ps>& ps)
{
- typedef oln_deduce_type_of(Ps, point, row_comp) comp_t;
+ typedef oln_deduce_vtype(Ps, point, row_comp) comp_t;
return ps.pmin().vec()[mlc_value(comp_t)];
}
template <typename Ps>
oln_coord(Ps) max_row(const abstract::point_set_having_bbox<Ps>& ps)
{
- typedef oln_deduce_type_of(Ps, point, row_comp) comp_t;
+ typedef oln_deduce_vtype(Ps, point, row_comp) comp_t;
return ps.pmax().vec()[mlc_value(comp_t)];
}
@@ -138,14 +138,14 @@
template <typename I>
oln_coord(I) min_row(const abstract::image_having_bbox<I>& ps)
{
- typedef oln_deduce_type_of(I, point, row_comp) comp_t;
+ typedef oln_deduce_vtype(I, point, row_comp) comp_t;
return ps.pmin().vec()[mlc_value(comp_t)];
}
template <typename I>
oln_coord(I) max_row(const abstract::image_having_bbox<I>& ps)
{
- typedef oln_deduce_type_of(I, point, row_comp) comp_t;
+ typedef oln_deduce_vtype(I, point, row_comp) comp_t;
return ps.pmax().vec()[mlc_value(comp_t)];
}
Index: oln/core/spe/col.hh
===================================================================
--- oln/core/spe/col.hh (revision 712)
+++ oln/core/spe/col.hh (working copy)
@@ -81,14 +81,14 @@
template <typename P>
oln_coord(P) col(const abstract::point<P>& p)
{
- typedef oln_type_of(P, col_comp) comp_t;
+ typedef oln_vtype(P, col_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
template <typename P>
oln_coord(P)& col(abstract::point<P>& p)
{
- typedef oln_type_of(P, col_comp) comp_t;
+ typedef oln_vtype(P, col_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
@@ -97,14 +97,14 @@
template <typename D>
oln_coord(D) col(const abstract::dpoint<D>& p)
{
- typedef oln_type_of(D, col_comp) comp_t;
+ typedef oln_vtype(D, col_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
template <typename D>
oln_coord(D)& col(abstract::dpoint<D>& p)
{
- typedef oln_type_of(D, col_comp) comp_t;
+ typedef oln_vtype(D, col_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
@@ -113,7 +113,7 @@
template <typename P>
oln_coord(P) col(const abstract::iterator_on_points<P>& it)
{
- typedef oln_deduce_type_of(P, point, col_comp) comp_t;
+ typedef oln_deduce_vtype(P, point, col_comp) comp_t;
return it.to_point().vec()[mlc_value(comp_t)];
}
@@ -122,14 +122,14 @@
template <typename Ps>
oln_coord(Ps) min_col(const abstract::point_set_having_bbox<Ps>& ps)
{
- typedef oln_deduce_type_of(Ps, point, col_comp) comp_t;
+ typedef oln_deduce_vtype(Ps, point, col_comp) comp_t;
return ps.pmin().vec()[mlc_value(comp_t)];
}
template <typename Ps>
oln_coord(Ps) max_col(const abstract::point_set_having_bbox<Ps>& ps)
{
- typedef oln_deduce_type_of(Ps, point, col_comp) comp_t;
+ typedef oln_deduce_vtype(Ps, point, col_comp) comp_t;
return ps.pmax().vec()[mlc_value(comp_t)];
}
@@ -138,14 +138,14 @@
template <typename I>
oln_coord(I) min_col(const abstract::image_having_bbox<I>& ps)
{
- typedef oln_deduce_type_of(I, point, col_comp) comp_t;
+ typedef oln_deduce_vtype(I, point, col_comp) comp_t;
return ps.pmin().vec()[mlc_value(comp_t)];
}
template <typename I>
oln_coord(I) max_col(const abstract::image_having_bbox<I>& ps)
{
- typedef oln_deduce_type_of(I, point, col_comp) comp_t;
+ typedef oln_deduce_vtype(I, point, col_comp) comp_t;
return ps.pmax().vec()[mlc_value(comp_t)];
}
Index: oln/core/spe/slice.hh
===================================================================
--- oln/core/spe/slice.hh (revision 712)
+++ oln/core/spe/slice.hh (working copy)
@@ -81,14 +81,14 @@
template <typename P>
oln_coord(P) slice(const abstract::point<P>& p)
{
- typedef oln_type_of(P, slice_comp) comp_t;
+ typedef oln_vtype(P, slice_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
template <typename P>
oln_coord(P)& slice(abstract::point<P>& p)
{
- typedef oln_type_of(P, slice_comp) comp_t;
+ typedef oln_vtype(P, slice_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
@@ -97,14 +97,14 @@
template <typename D>
oln_coord(D) slice(const abstract::dpoint<D>& p)
{
- typedef oln_type_of(D, slice_comp) comp_t;
+ typedef oln_vtype(D, slice_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
template <typename D>
oln_coord(D)& slice(abstract::dpoint<D>& p)
{
- typedef oln_type_of(D, slice_comp) comp_t;
+ typedef oln_vtype(D, slice_comp) comp_t;
return p.vec()[mlc_value(comp_t)];
}
@@ -113,7 +113,7 @@
template <typename P>
oln_coord(P) slice(const abstract::iterator_on_points<P>& it)
{
- typedef oln_deduce_type_of(P, point, slice_comp) comp_t;
+ typedef oln_deduce_vtype(P, point, slice_comp) comp_t;
return it.to_point().vec()[mlc_value(comp_t)];
}
@@ -122,14 +122,14 @@
template <typename Ps>
oln_coord(Ps) min_slice(const abstract::point_set_having_bbox<Ps>& ps)
{
- typedef oln_deduce_type_of(Ps, point, slice_comp) comp_t;
+ typedef oln_deduce_vtype(Ps, point, slice_comp) comp_t;
return ps.pmin().vec()[mlc_value(comp_t)];
}
template <typename Ps>
oln_coord(Ps) max_slice(const abstract::point_set_having_bbox<Ps>& ps)
{
- typedef oln_deduce_type_of(Ps, point, slice_comp) comp_t;
+ typedef oln_deduce_vtype(Ps, point, slice_comp) comp_t;
return ps.pmax().vec()[mlc_value(comp_t)];
}
@@ -138,14 +138,14 @@
template <typename I>
oln_coord(I) min_slice(const abstract::image_having_bbox<I>& ps)
{
- typedef oln_deduce_type_of(I, point, slice_comp) comp_t;
+ typedef oln_deduce_vtype(I, point, slice_comp) comp_t;
return ps.pmin().vec()[mlc_value(comp_t)];
}
template <typename I>
oln_coord(I) max_slice(const abstract::image_having_bbox<I>& ps)
{
- typedef oln_deduce_type_of(I, point, slice_comp) comp_t;
+ typedef oln_deduce_vtype(I, point, slice_comp) comp_t;
return ps.pmax().vec()[mlc_value(comp_t)];
}
Index: oln/core/topology_entry.hh
===================================================================
--- oln/core/topology_entry.hh (revision 712)
+++ oln/core/topology_entry.hh (working copy)
@@ -39,15 +39,22 @@
template <typename E> struct topology_entry;
+ template <typename E>
+ struct set_super_type< topology_entry<E> >
+ {
+ typedef mlc::none ret;
+ };
+
+
/// Virtual types associated to topology_entry<E>.
template <typename E>
struct vtypes< topology_entry<E> >
{
- typedef mlc::undefined point_type;
- typedef mlc::undefined bbox_type;
+ typedef stc::abstract point_type;
+ typedef stc::abstract bbox_type;
typedef mlc::none neighborhood_type;
- typedef mlc::undefined is_random_accessible_type;
+ typedef stc::abstract is_random_accessible_type;
typedef mlc::none subset_type;
typedef mlc::none morpher_type;
Index: oln/core/image_entry.hh
===================================================================
--- oln/core/image_entry.hh (revision 712)
+++ oln/core/image_entry.hh (working copy)
@@ -42,29 +42,34 @@
template <typename E> struct image_entry;
+ template <typename E>
+ struct set_super_type< image_entry<E> >
+ {
+ typedef mlc::none ret;
+ };
+
/// Virtual types associated to image_entry<E>.
template <typename E>
struct vtypes< image_entry<E> >
{
- typedef mlc::undefined topo_type;
- typedef mlc::undefined grid_type;
- typedef mlc::undefined point_type;
- typedef mlc::undefined is_computed_type;
- typedef mlc::undefined value_type;
+ typedef stc::abstract topo_type;
- typedef mlc::undefined fwd_piter_type;
- typedef mlc::undefined bkd_piter_type;
+ typedef stc::abstract point_type;
+ typedef stc::final<oln_deduce_deferred_vtype(E, point, grid)> grid_type;
+ typedef stc::final<oln_deduce_deferred_vtype(E, point, coord)> coord_type;
- typedef mlc::undefined fwd_qiter_type;
- typedef mlc::undefined bkd_qiter_type;
+ typedef stc::abstract is_computed_type;
+ typedef stc::abstract value_type;
- // final definitions:
- typedef oln_deduce(E, point, coord) coord_type;
- typedef oln_fwd_piter(E) piter_type;
+ typedef stc::abstract fwd_piter_type;
+ typedef stc::abstract bkd_piter_type;
- // default definitions:
+ // FIXME: final definitions:
+ typedef oln_fwd_piter(E) piter_type;
+
+ // FIXME: default definitions:
typedef oln_point(E) psite_type;
typedef oln_value(E) rvalue_type;
Index: oln/core/iterator_vtypes.hh
===================================================================
--- oln/core/iterator_vtypes.hh (revision 712)
+++ oln/core/iterator_vtypes.hh (working copy)
@@ -183,7 +183,7 @@
struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::fwd_piter_type >
{
- typedef piter_isubset_<oln_type_of(Image, fwd_piter), Isubset> ret;
+ typedef piter_isubset_<oln_vtype(Image, fwd_piter), Isubset> ret;
};
/// bkd_piter vtype on morpher::add_isubset.
@@ -191,7 +191,7 @@
struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::bkd_piter_type >
{
- typedef piter_isubset_<oln_type_of(Image, bkd_piter), Isubset> ret;
+ typedef piter_isubset_<oln_vtype(Image, bkd_piter), Isubset> ret;
};
@@ -202,7 +202,7 @@
struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::fwd_qiter_type >
{
- typedef piter_isubset_<oln_type_of(Image, fwd_qiter), Isubset> ret;
+ typedef piter_isubset_<oln_vtype(Image, fwd_qiter), Isubset> ret;
};
/// bkd_qiter vtype on morpher::add_isubset.
@@ -210,7 +210,7 @@
struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::bkd_qiter_type >
{
- typedef piter_isubset_<oln_type_of(Image, bkd_qiter), Isubset> ret;
+ typedef piter_isubset_<oln_vtype(Image, bkd_qiter), Isubset> ret;
};
@@ -221,7 +221,7 @@
struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::fwd_niter_type >
{
- typedef piter_isubset_<oln_type_of(Image, fwd_niter), Isubset> ret;
+ typedef piter_isubset_<oln_vtype(Image, fwd_niter), Isubset> ret;
};
/// bkd_niter vtype on morpher::add_isubset.
@@ -229,7 +229,7 @@
struct single_vtype< morpher::add_isubset<Image, Isubset>,
typedef_::bkd_niter_type >
{
- typedef piter_isubset_<oln_type_of(Image, bkd_niter), Isubset> ret;
+ typedef piter_isubset_<oln_vtype(Image, bkd_niter), Isubset> ret;
};
@@ -254,7 +254,7 @@
typedef_::fwd_niter_type >
{
private:
- typedef oln_type_of(Image, point) point_t;
+ typedef oln_vtype(Image, point) point_t;
public:
typedef fwd_niter_neighb_<point_t> ret;
};
@@ -265,7 +265,7 @@
typedef_::bkd_niter_type >
{
private:
- typedef oln_type_of(Image, point) point_t;
+ typedef oln_vtype(Image, point) point_t;
public:
typedef bkd_niter_neighb_<point_t> ret;
};
Index: oln/core/abstract/iterator_on_points.hh
===================================================================
--- oln/core/abstract/iterator_on_points.hh (revision 712)
+++ oln/core/abstract/iterator_on_points.hh (working copy)
@@ -53,8 +53,8 @@
template <typename E>
struct vtypes< abstract::iterator_on_points<E> >
{
- typedef mlc::undefined point_type;
- typedef oln_deduce(E, point, coord) coord_type;
+ typedef stc::abstract point_type;
+ typedef oln_deduce_deferred_vtype(E, point, coord) coord_type;
};
Index: oln/core/abstract/image.hh
===================================================================
--- oln/core/abstract/image.hh (revision 712)
+++ oln/core/abstract/image.hh (working copy)
@@ -79,8 +79,8 @@
oln_virtual_typedef(point);
// FIXME: Rec?
-// oln_virtual_typedef(fwd_piter);
-// oln_virtual_typedef(bkd_piter);
+ oln_virtual_typedef(fwd_piter);
+ oln_virtual_typedef(bkd_piter);
oln_virtual_typedef(is_computed);
oln_virtual_typedef(value);
@@ -144,11 +144,11 @@
image<E>::decl::decl()
{
// FIXME: Rec?
-// mlc::assert_< mlc_is_a(topo, abstract::topology) >::check();
-// mlc::assert_< mlc_is_a(grid, abstract::grid) >::check();
-// mlc::assert_< mlc_is_a(point, abstract::point) >::check();
-// mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check();
-// mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check();
+ mlc::assert_< mlc_is_a(topo, abstract::topology) >::check();
+ mlc::assert_< mlc_is_a(grid, abstract::grid) >::check();
+ mlc::assert_< mlc_is_a(point, abstract::point) >::check();
+ mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check();
+ mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check();
// FIXME: Rec?
// mlc::assert_< mlc_is_a(plain, abstract::image) >::check();
Index: oln/core/abstract/image/hybrid/classical.hh
===================================================================
--- oln/core/abstract/image/hybrid/classical.hh (revision 712)
+++ oln/core/abstract/image/hybrid/classical.hh (working copy)
@@ -174,9 +174,9 @@
/// 1D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 1 > :
- where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid1d >,
- mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
- mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
+ where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid1d >,
+ mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
>
>
{
@@ -187,9 +187,9 @@
/// 2D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 2 > :
- where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid2d >,
- mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
- mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
+ where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid2d >,
+ mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
>
>
{
@@ -200,9 +200,9 @@
/// 3D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 3 > :
- where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid3d >,
- mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
- mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
+ where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid3d >,
+ mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
>
>
{
@@ -213,8 +213,8 @@
/// General case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 4 > :
- where_< mlc::and_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >,
- mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found >
+ where_< mlc::and_< mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
>
>
{
Index: oln/core/abstract/image/type/integre.hh
===================================================================
--- oln/core/abstract/image/type/integre.hh (revision 712)
+++ oln/core/abstract/image/type/integre.hh (working copy)
@@ -97,9 +97,9 @@
/// Binary case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 5 > :
- where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), ntg::bin>,
- ntg::eq_<ntg::int_u, 1, oln_type_of(E, value)>,
- ntg::eq_<ntg::int_s, 1, oln_type_of(E, value)> > >
+ where_< mlc::or_list_< mlc::eq_<oln_vtype(E, value), ntg::bin>,
+ ntg::eq_<ntg::int_u, 1, oln_vtype(E, value)>,
+ ntg::eq_<ntg::int_s, 1, oln_vtype(E, value)> > >
{
// Definition of the super class corresponding to this case.
typedef abstract::binary_image<E> ret;
@@ -108,7 +108,7 @@
/// Grey-level case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 6 > :
- where_< mlc_is_a( oln_type_of(E, value), ntg::real_value ) >
+ where_< mlc_is_a( oln_vtype(E, value), ntg::real_value ) >
{
// Definition of the super class corresponding to this case
// (abstract::grey_level_image_ is the conjunction of
@@ -119,7 +119,7 @@
/// Label case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 7 > :
- where_< mlc_is_a( oln_type_of(E, value), ntg::enum_value ) >
+ where_< mlc_is_a( oln_vtype(E, value), ntg::enum_value ) >
{
// Definition of the super class corresponding to this case
// (abstract::label_image_ is the conjunction of
@@ -130,7 +130,7 @@
/// Color case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 8 > :
- where_< mlc_is_a( oln_type_of(E, value), ntg::color_value ) >
+ where_< mlc_is_a( oln_vtype(E, value), ntg::color_value ) >
{
// Definition of the super class corresponding to this case
// (abstract::color_image_ is the conjunction of
Index: oln/core/abstract/image/type/hierarchy.hh
===================================================================
--- oln/core/abstract/image/type/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/type/hierarchy.hh (working copy)
@@ -66,7 +66,7 @@
(a concrete image)
- Default case: If no known value type is returned by `oln_type_of(I, value)',
+ Default case: If no known value type is returned by `oln_vtype(I, value)',
the entry is plugged to abstract::data_image<I>. */
@@ -103,7 +103,7 @@
/// Binary case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 1 > :
- where_< value::is_binary<oln_type_of(E, value)> >
+ where_< value::is_binary<oln_vtype(E, value)> >
{
// Definition of the super class corresponding to this case.
typedef abstract::binary_image<E> ret;
@@ -112,7 +112,7 @@
/// Color case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 2 > :
- where_< value::is_color<oln_type_of(E, value)> >
+ where_< value::is_color<oln_vtype(E, value)> >
{
// Definition of the super class corresponding to this case.
typedef abstract::color_image<E> ret;
@@ -121,7 +121,7 @@
/// Grey-level case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 3 > :
- where_< value::is_grey_level<oln_type_of(E, value)> >
+ where_< value::is_grey_level<oln_vtype(E, value)> >
{
// Definition of the super class corresponding to this case.
typedef abstract::grey_level_image<E> ret;
@@ -130,7 +130,7 @@
/// Label case.
template <typename E>
struct case_< image_hierarchy_wrt_type, E, 4 > :
- where_< value::is_label<oln_type_of(E, value)> >
+ where_< value::is_label<oln_vtype(E, value)> >
{
// Definition of the super class corresponding to this case.
typedef abstract::label_image<E> ret;
Index: oln/core/abstract/image/mutability/hierarchy.hh
===================================================================
--- oln/core/abstract/image/mutability/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/mutability/hierarchy.hh (working copy)
@@ -108,7 +108,7 @@
/// With mutability.
template <typename E>
struct case_< image_hierarchy_wrt_mutability, E, 1 > :
- where_< mlc_is_ok(oln_lvalue(E)) >
+ where_< mlc::is_found_< oln_find_vtype(E, lvalue) > >
{
typedef abstract::mutable_image<E> ret;
};
Index: oln/core/abstract/image/computability/hierarchy.hh
===================================================================
--- oln/core/abstract/image/computability/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/computability/hierarchy.hh (working copy)
@@ -105,14 +105,14 @@
/// With computability.
template <typename E>
struct case_< image_hierarchy_wrt_computability, E, 1 > :
- where_< mlc::eq_< oln_type_of(E, is_computed), mlc::true_ > >
+ where_< mlc::eq_< oln_vtype(E, is_computed), mlc::true_ > >
{
typedef abstract::computed_image<E> ret;
};
template <typename E>
struct case_< image_hierarchy_wrt_computability, E, 2 > :
- where_< mlc::eq_< oln_type_of(E, is_computed), mlc::false_ > >
+ where_< mlc::eq_< oln_vtype(E, is_computed), mlc::false_ > >
{
typedef abstract::plain_image<E> ret;
};
Index: oln/core/abstract/image/dimension/1d.hh
===================================================================
--- oln/core/abstract/image/dimension/1d.hh (revision 712)
+++ oln/core/abstract/image/dimension/1d.hh (working copy)
@@ -67,8 +67,8 @@
public:
// Resolve an ambiguity w.r.t. impl_at().
// FIXME: Too hacky!
- using automatic::set_impl<abstract::image1d, oln_type_of(E, morpher), E>::impl_at;
- using automatic::set_impl<abstract::mutable_image1d, oln_type_of(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::image1d, oln_vtype(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::mutable_image1d, oln_vtype(E, morpher), E>::impl_at;
using image1d<E>::at;
Index: oln/core/abstract/image/dimension/2d.hh
===================================================================
--- oln/core/abstract/image/dimension/2d.hh (revision 712)
+++ oln/core/abstract/image/dimension/2d.hh (working copy)
@@ -67,8 +67,8 @@
public:
// Resolve an ambiguity w.r.t. impl_at().
// FIXME: Too hacky!
- using automatic::set_impl<abstract::image2d, oln_type_of(E, morpher), E>::impl_at;
- using automatic::set_impl<abstract::mutable_image2d, oln_type_of(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::image2d, oln_vtype(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::mutable_image2d, oln_vtype(E, morpher), E>::impl_at;
using image2d<E>::at;
Index: oln/core/abstract/image/dimension/3d.hh
===================================================================
--- oln/core/abstract/image/dimension/3d.hh (revision 712)
+++ oln/core/abstract/image/dimension/3d.hh (working copy)
@@ -72,8 +72,8 @@
public:
// Resolve an ambiguity w.r.t. impl_at().
// FIXME: Too hacky!
- using automatic::set_impl<abstract::image3d, oln_type_of(E, morpher), E>::impl_at;
- using automatic::set_impl<abstract::mutable_image3d, oln_type_of(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::image3d, oln_vtype(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::mutable_image3d, oln_vtype(E, morpher), E>::impl_at;
using image3d<E>::at;
Index: oln/core/abstract/image/dimension/hierarchy.hh
===================================================================
--- oln/core/abstract/image/dimension/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/dimension/hierarchy.hh (working copy)
@@ -62,7 +62,7 @@
(a concrete image)
- Default case: If no known grid type is returned by `oln_type_of(I, grid)',
+ Default case: If no known grid type is returned by `oln_vtype(I, grid)',
the entry is directly plugged to abstract::image<I>. */
// FIXME: Figure above is obsolete because of the introduction of
@@ -97,7 +97,7 @@
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 1 > :
where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid1d >,
- mlc_is_ok(oln_lvalue(E)) > >
+ mlc::is_found_< oln_find_vtype(E, lvalue) > > >
{
typedef abstract::mutable_image1d<E> ret;
};
@@ -114,7 +114,7 @@
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 3 > :
where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid2d >,
- mlc_is_ok(oln_lvalue(E)) > >
+ mlc::is_found_< oln_find_vtype(E, lvalue) > > >
{
typedef abstract::mutable_image2d<E> ret;
};
@@ -131,7 +131,7 @@
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 5 > :
where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid3d >,
- mlc_is_ok(oln_lvalue(E)) > >
+ mlc::is_found_< oln_find_vtype(E, lvalue) > > >
{
typedef abstract::mutable_image3d<E> ret;
};
Index: oln/core/abstract/image/neighborhood/hierarchy.hh
===================================================================
--- oln/core/abstract/image/neighborhood/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/neighborhood/hierarchy.hh (working copy)
@@ -50,7 +50,7 @@
public automatic::get_impl<image_having_neighborhood, E>
{
private:
- typedef oln_type_of(E, neighborhood) neighborhood_t;
+ typedef oln_vtype(E, neighborhood) neighborhood_t;
public:
@@ -106,7 +106,7 @@
/// With neighborhood.
template <typename E>
struct case_< image_hierarchy_wrt_neighborhood, E, 1 > :
- where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::not_found > >
+ where_< mlc::neq_< oln_find_vtype(E, neighborhood), mlc::not_found > >
{
typedef abstract::image_having_neighborhood<E> ret;
};
Index: oln/core/abstract/image/point_wise_accessibility/hierarchy.hh
===================================================================
--- oln/core/abstract/image/point_wise_accessibility/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/point_wise_accessibility/hierarchy.hh (working copy)
@@ -49,7 +49,7 @@
public virtual image<E>,
public automatic::get_impl< image_being_point_wise_random_accessible, E >
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
public:
@@ -98,7 +98,7 @@
/// With point-wise accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_point_wise_accessibility, E, 1 > :
- where_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ > >
+ where_< mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ > >
{
typedef abstract::image_being_point_wise_random_accessible<E> ret;
};
Index: oln/core/abstract/image/bbox/hierarchy.hh
===================================================================
--- oln/core/abstract/image/bbox/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/bbox/hierarchy.hh (working copy)
@@ -51,8 +51,8 @@
{
private:
- typedef oln_type_of(E, bbox) bbox_t;
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, bbox) bbox_t;
+ typedef oln_vtype(E, point) point_t;
public:
@@ -135,7 +135,7 @@
/// With bbox.
template <typename E>
struct case_< image_hierarchy_wrt_bbox, E, 1 > :
- where_< mlc::neq_< oln_deduce(E, topo, bbox), mlc::not_found > >
+ where_< mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > >
{
typedef abstract::image_having_bbox<E> ret;
};
@@ -146,7 +146,7 @@
template <typename E>
struct single_vtype< image_entry<E>, typedef_::bbox_type >
{
- typedef oln_deduce(E, topo, bbox) ret;
+ typedef oln_deduce_vtype(E, topo, bbox) ret;
};
} // end of namespace oln
Index: oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
===================================================================
--- oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 712)
+++ oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (working copy)
@@ -52,8 +52,8 @@
public virtual image<E>,
public automatic::get_impl< image_being_value_wise_random_accessible, E >
{
- typedef oln_type_of(E, value) value_t;
- typedef oln_type_of(E, value_proxy) value_proxy_t;
+ typedef oln_vtype(E, value) value_t;
+ typedef oln_vtype(E, value_proxy) value_proxy_t;
public:
/// Get a (read-only) value descriptor from a value.
@@ -75,8 +75,8 @@
public virtual image_being_value_wise_random_accessible<E>,
public automatic::get_impl< mutable_image_being_value_wise_random_accessible, E >
{
- typedef oln_type_of(E, value) value_t;
- typedef oln_type_of(E, mutable_value_proxy) mutable_value_proxy_t;
+ typedef oln_vtype(E, value) value_t;
+ typedef oln_vtype(E, mutable_value_proxy) mutable_value_proxy_t;
public:
using image_being_value_wise_random_accessible<E>::value;
@@ -133,8 +133,8 @@
/// With mutable value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 1 > :
- where_< mlc_and( mlc_is_ok(oln_type_of(E, fwd_viter)),
- mlc_is_ok(oln_type_of(E, mutable_value_proxy)) ) >
+ where_< mlc_and( mlc_is_ok(oln_find_vtype(E, fwd_viter)),
+ mlc_is_ok(oln_find_vtype(E, mutable_value_proxy)) ) >
{
typedef abstract::mutable_image_being_value_wise_random_accessible<E> ret;
};
@@ -142,7 +142,7 @@
/// With (constant) value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 2 > :
- where_< mlc_is_ok(oln_type_of(E, fwd_viter)) >
+ where_< mlc_is_ok(oln_find_vtype(E, fwd_viter)) >
{
typedef abstract::image_being_value_wise_random_accessible<E> ret;
};
Index: oln/core/abstract/grid.hh
===================================================================
--- oln/core/abstract/grid.hh (revision 712)
+++ oln/core/abstract/grid.hh (working copy)
@@ -44,7 +44,7 @@
template <typename E>
struct vtypes< abstract::grid<E> >
{
- typedef mlc::undefined dimvalue_type;
+ typedef stc::abstract dimvalue_type;
};
namespace abstract {
Index: oln/core/abstract/iterator.hh
===================================================================
--- oln/core/abstract/iterator.hh (revision 712)
+++ oln/core/abstract/iterator.hh (working copy)
@@ -35,7 +35,16 @@
namespace oln
{
+ namespace abstract { template <typename E> class iterator; }
+
+ template <typename E>
+ struct set_super_type< abstract::iterator<E> >
+ {
+ typedef mlc::none ret;
+ };
+
+
namespace abstract
{
Index: oln/core/abstract/point.hh
===================================================================
--- oln/core/abstract/point.hh (revision 712)
+++ oln/core/abstract/point.hh (working copy)
@@ -55,14 +55,22 @@
namespace abstract { template <typename E> class point; }
+ template <typename E>
+ struct set_super_type< abstract::point<E> >
+ {
+ typedef mlc::none ret;
+ };
+
+
/// Virtual types associated to abstract::point<E>.
template <typename E>
struct vtypes< abstract::point<E> >
{
- typedef mlc::undefined grid_type;
- typedef mlc::undefined dpoint_type;
- typedef oln_deduce(E, dpoint, coord) coord_type;
- typedef mlc::undefined dim_type;
+ // FIXME: Prefer to use final<deduce..> when possible.
+ typedef stc::abstract grid_type;
+ typedef stc::abstract dpoint_type;
+ typedef oln_deduce_deferred_vtype(E, dpoint, coord) coord_type;
+ typedef stc::abstract dim_type;
typedef oln_dim(E) dim_t;
typedef xtd::vec<mlc_value(dim_t), coord_type> vec_type;
@@ -232,8 +240,8 @@
template <typename P>
bool point<E>::operator==(const abstract::point<P>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(P, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(P, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return this->exact().impl_equal(rhs.exact());
}
@@ -248,8 +256,8 @@
template <typename P>
bool point<E>::operator!=(const abstract::point<P>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(P, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(P, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return not (*this == rhs);
}
@@ -264,8 +272,8 @@
template <typename P>
bool point<E>::operator<(const abstract::point<P>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(P, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(P, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return this->exact().impl_less(rhs.exact());
}
@@ -280,8 +288,8 @@
template <typename P>
bool point<E>::operator>(const abstract::point<P>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(P, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(P, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return rhs < *this;
}
@@ -296,8 +304,8 @@
template <typename P>
bool point<E>::operator>=(const abstract::point<P>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(P, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(P, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return not (*this < rhs);
}
@@ -312,8 +320,8 @@
template <typename P>
bool point<E>::operator<=(const abstract::point<P>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(P, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(P, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return not (rhs < *this);
}
@@ -328,8 +336,8 @@
template <typename D>
E& point<E>::operator+=(const abstract::dpoint<D>& rhs)
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(D, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(D, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return this->exact().impl_plus_equal(rhs.exact());
}
@@ -344,8 +352,8 @@
template <typename D>
xtd_op_plus_trait(E,D) point<E>::operator+(const abstract::dpoint<D>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(D, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(D, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return this->exact().impl_plus(rhs.exact());
}
@@ -360,8 +368,8 @@
template <typename D>
E& point<E>::operator-=(const abstract::dpoint<D>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(D, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(D, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return this->exact().impl_minus_equal(rhs.exact());
}
@@ -376,8 +384,8 @@
template <typename D>
xtd_op_minus_trait(E, D) point<E>::operator-(const abstract::dpoint<D>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(D, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(D, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return this->exact().impl_minus(rhs.exact());
}
@@ -392,8 +400,8 @@
template <typename P>
xtd_op_minus_trait(E, P) point<E>::operator-(const abstract::point<P>& rhs) const
{
- mlc::assert_equal_< oln_type_of(E, grid),
- oln_type_of(P, grid),
+ mlc::assert_equal_< oln_vtype(E, grid),
+ oln_vtype(P, grid),
oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check();
return this->exact().impl_minus(rhs.exact());
}
@@ -420,10 +428,10 @@
// template <typename E>
// point<E>::~point()
// {
-// mlc::assert_defined_< oln_type_of(E, grid) >::check();
-// mlc::assert_defined_< oln_type_of(E, dpoint) >::check();
-// mlc::assert_defined_< oln_type_of(E, coord) >::check();
-// mlc::assert_defined_< oln_type_of(E, dim) >::check();
+// mlc::assert_defined_< oln_vtype(E, grid) >::check();
+// mlc::assert_defined_< oln_vtype(E, dpoint) >::check();
+// mlc::assert_defined_< oln_vtype(E, coord) >::check();
+// mlc::assert_defined_< oln_vtype(E, dim) >::check();
// }
# endif
Index: oln/core/abstract/dpoint.hh
===================================================================
--- oln/core/abstract/dpoint.hh (revision 712)
+++ oln/core/abstract/dpoint.hh (working copy)
@@ -50,14 +50,22 @@
namespace abstract { template <typename E> class dpoint; }
+ template <typename E>
+ struct set_super_type< abstract::dpoint<E> >
+ {
+ typedef mlc::none ret;
+ };
+
+
/// Virtual types associated to abstract::dpoint<E>.
template <typename E>
struct vtypes< abstract::dpoint<E> >
{
- typedef mlc::undefined grid_type;
- typedef mlc::undefined point_type;
- typedef mlc::undefined coord_type;
- typedef mlc::undefined dim_type;
+ // FIXME: Prefer to use final<deduce..> when possible.
+ typedef stc::abstract grid_type;
+ typedef stc::abstract point_type;
+ typedef stc::abstract coord_type;
+ typedef stc::abstract dim_type;
};
@@ -123,10 +131,10 @@
// template <typename E>
// dpoint<E>::~dpoint() {
-// mlc::assert_defined_< oln_type_of(E, grid) >::check();
-// mlc::assert_defined_< oln_type_of(E, point) >::check();
-// mlc::assert_defined_< oln_type_of(E, coord) >::check();
-// mlc::assert_defined_< oln_type_of(E, dim) >::check();
+// mlc::assert_defined_< oln_vtype(E, grid) >::check();
+// mlc::assert_defined_< oln_vtype(E, point) >::check();
+// mlc::assert_defined_< oln_vtype(E, coord) >::check();
+// mlc::assert_defined_< oln_vtype(E, dim) >::check();
// }
# endif
Index: oln/core/abstract/iterator_on_values.hh
===================================================================
--- oln/core/abstract/iterator_on_values.hh (revision 712)
+++ oln/core/abstract/iterator_on_values.hh (working copy)
@@ -52,7 +52,7 @@
template <typename E>
struct vtypes< abstract::iterator_on_values<E> >
{
- typedef mlc::undefined value_type;
+ typedef stc::abstract value_type;
};
@@ -64,7 +64,7 @@
class iterator_on_values : public abstract::iterator<E>
{
public:
- typedef oln_type_of(E, value) value_type;
+ typedef oln_vtype(E, value) value_type;
value_type to_value() const;
Index: oln/core/abstract/point_set/point_set_being_random_accessible.hh
===================================================================
--- oln/core/abstract/point_set/point_set_being_random_accessible.hh (revision 712)
+++ oln/core/abstract/point_set/point_set_being_random_accessible.hh (working copy)
@@ -43,7 +43,7 @@
template <typename E>
class point_set_being_random_accessible : public virtual point_set<E>
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
public:
@@ -75,7 +75,7 @@
template <typename E>
struct case_ < point_set_hierarchy_wrt_accessibility, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, is_random_accessible), mlc::true_ > >
+ : where_< mlc::eq_< oln_vtype(E, is_random_accessible), mlc::true_ > >
{
typedef abstract::point_set_being_random_accessible<E> ret;
};
Index: oln/core/abstract/point_set/point_set_having_known_size.hh
===================================================================
--- oln/core/abstract/point_set/point_set_having_known_size.hh (revision 712)
+++ oln/core/abstract/point_set/point_set_having_known_size.hh (working copy)
@@ -73,7 +73,7 @@
template <typename E>
struct case_ < point_set_hierarchy_wrt_known_size, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, has_known_size), mlc::true_ > >
+ : where_< mlc::eq_< oln_vtype(E, has_known_size), mlc::true_ > >
{
typedef abstract::point_set_having_known_size<E> ret;
};
Index: oln/core/abstract/point_set/point_set_being_connected.hh
===================================================================
--- oln/core/abstract/point_set/point_set_being_connected.hh (revision 712)
+++ oln/core/abstract/point_set/point_set_being_connected.hh (working copy)
@@ -166,9 +166,9 @@
template <typename E>
struct case_ < point_set_hierarchy_wrt_connectivity, E, 1 >
: where_< mlc::and_list_<
- mlc::neq_< oln_type_of(E, bbox), mlc::none >,
- mlc::eq_< oln_type_of(E, is_connected), mlc::true_ >,
- mlc::eq_< oln_type_of(E, grid), grid1d >
+ mlc::neq_< oln_vtype(E, bbox), mlc::none >,
+ mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >,
+ mlc::eq_< oln_vtype(E, grid), grid1d >
> >
{
typedef abstract::point_set_being_1d_connected<E> ret;
@@ -177,9 +177,9 @@
template <typename E>
struct case_ < point_set_hierarchy_wrt_connectivity, E, 2 >
: where_< mlc::and_list_<
- mlc::neq_< oln_type_of(E, bbox), mlc::none >,
- mlc::eq_< oln_type_of(E, is_connected), mlc::true_ >,
- mlc::eq_< oln_type_of(E, grid), grid2d >
+ mlc::neq_< oln_vtype(E, bbox), mlc::none >,
+ mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >,
+ mlc::eq_< oln_vtype(E, grid), grid2d >
> >
{
typedef abstract::point_set_being_2d_connected<E> ret;
@@ -188,9 +188,9 @@
template <typename E>
struct case_ < point_set_hierarchy_wrt_connectivity, E, 3 >
: where_< mlc::and_list_<
- mlc::neq_< oln_type_of(E, bbox), mlc::none >,
- mlc::eq_< oln_type_of(E, is_connected), mlc::true_ >,
- mlc::eq_< oln_type_of(E, grid), grid3d >
+ mlc::neq_< oln_vtype(E, bbox), mlc::none >,
+ mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >,
+ mlc::eq_< oln_vtype(E, grid), grid3d >
> >
{
typedef abstract::point_set_being_3d_connected<E> ret;
Index: oln/core/abstract/point_set/point_set_having_bbox.hh
===================================================================
--- oln/core/abstract/point_set/point_set_having_bbox.hh (revision 712)
+++ oln/core/abstract/point_set/point_set_having_bbox.hh (working copy)
@@ -138,7 +138,7 @@
template <typename E>
struct case_ < point_set_hierarchy_wrt_bbox, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, bbox), E > >
+ : where_< mlc::eq_< oln_vtype(E, bbox), E > >
{
typedef abstract::bbox<E> ret;
};
@@ -146,7 +146,7 @@
template <typename E>
struct case_ < point_set_hierarchy_wrt_bbox, E, 2 >
- : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
+ : where_< mlc::neq_< oln_vtype(E, bbox), mlc::none > >
{
typedef abstract::point_set_having_bbox<E> ret;
};
Index: oln/core/abstract/window.hh
===================================================================
--- oln/core/abstract/window.hh (revision 712)
+++ oln/core/abstract/window.hh (working copy)
@@ -34,6 +34,16 @@
namespace oln
{
+ namespace abstract { template <typename E> class window; }
+
+
+ template <typename E>
+ struct set_super_type< abstract::window<E> >
+ {
+ typedef mlc::none ret;
+ };
+
+
namespace abstract
{
Index: oln/core/abstract/topology/topology_having_bbox.hh
===================================================================
--- oln/core/abstract/topology/topology_having_bbox.hh (revision 712)
+++ oln/core/abstract/topology/topology_having_bbox.hh (working copy)
@@ -44,7 +44,7 @@
: public virtual topology<E>,
public automatic::get_impl<topology_having_bbox, E>
{
- typedef oln_type_of(E, bbox) bbox_t;
+ typedef oln_vtype(E, bbox) bbox_t;
public:
@@ -66,21 +66,21 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- const oln_type_of(E, bbox)&
+ const oln_vtype(E, bbox)&
topology_having_bbox<E>::bbox() const
{
return this->exact().impl_bbox();
}
template <typename E>
- oln_type_of(E, bbox)&
+ oln_vtype(E, bbox)&
topology_having_bbox<E>::bbox()
{
return this->exact().impl_bbox();
}
template <typename E>
- topology_having_bbox<E>::operator oln_type_of(E, bbox)() const
+ topology_having_bbox<E>::operator oln_vtype(E, bbox)() const
{
return this->bbox();
}
@@ -98,7 +98,7 @@
template <typename E>
struct case_ < topology_hierarchy_wrt_bbox, E, 1 >
- : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
+ : where_< mlc::neq_< oln_vtype(E, bbox), mlc::none > >
{
typedef abstract::topology_having_bbox<E> ret;
};
Index: oln/core/abstract/topology/topology_being_random_accessible.hh
===================================================================
--- oln/core/abstract/topology/topology_being_random_accessible.hh (revision 712)
+++ oln/core/abstract/topology/topology_being_random_accessible.hh (working copy)
@@ -44,7 +44,7 @@
: public virtual topology<E>,
public automatic::get_impl<topology_being_random_accessible, E>
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
public:
@@ -62,13 +62,13 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- bool topology_being_random_accessible<E>::has(const oln_type_of(E, point)& p) const
+ bool topology_being_random_accessible<E>::has(const oln_vtype(E, point)& p) const
{
return this->exact().impl_has(p);
}
template <typename E>
- bool topology_being_random_accessible<E>::has_large(const oln_type_of(E, point)& p) const
+ bool topology_being_random_accessible<E>::has_large(const oln_vtype(E, point)& p) const
{
return this->exact().impl_has_large(p);
}
@@ -86,7 +86,7 @@
template <typename E>
struct case_ < topology_hierarchy_wrt_accessibility, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, is_random_accessible), mlc::true_ > >
+ : where_< mlc::eq_< oln_vtype(E, is_random_accessible), mlc::true_ > >
{
typedef abstract::topology_being_random_accessible<E> ret;
};
Index: oln/core/abstract/topology/topology_having_subset.hh
===================================================================
--- oln/core/abstract/topology/topology_having_subset.hh (revision 712)
+++ oln/core/abstract/topology/topology_having_subset.hh (working copy)
@@ -44,7 +44,7 @@
: public virtual topology<E>,
public automatic::get_impl<topology_having_subset, E>
{
- typedef oln_type_of(E, subset) subset_t;
+ typedef oln_vtype(E, subset) subset_t;
public:
@@ -60,7 +60,7 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- const oln_type_of(E, subset)&
+ const oln_vtype(E, subset)&
topology_having_subset<E>::subset() const
{
return this->exact().impl_subset();
@@ -78,7 +78,7 @@
template <typename E>
struct case_ < topology_hierarchy_wrt_subset, E, 1 >
- : where_< mlc::neq_< oln_type_of(E, subset), mlc::none > >
+ : where_< mlc::neq_< oln_vtype(E, subset), mlc::none > >
{
typedef abstract::topology_having_subset<E> ret;
};
Index: oln/core/abstract/topology/topology_having_neighborhood.hh
===================================================================
--- oln/core/abstract/topology/topology_having_neighborhood.hh (revision 712)
+++ oln/core/abstract/topology/topology_having_neighborhood.hh (working copy)
@@ -44,7 +44,7 @@
: public virtual topology<E>,
public automatic::get_impl<topology_having_neighborhood, E>
{
- typedef oln_type_of(E, neighborhood) neighborhood_t;
+ typedef oln_vtype(E, neighborhood) neighborhood_t;
public:
@@ -64,14 +64,14 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- const oln_type_of(E, neighborhood)&
+ const oln_vtype(E, neighborhood)&
topology_having_neighborhood<E>::neighborhood() const
{
return this->exact().impl_neighborhood();
}
template <typename E>
- topology_having_neighborhood<E>::operator oln_type_of(E, neighborhood)() const
+ topology_having_neighborhood<E>::operator oln_vtype(E, neighborhood)() const
{
return this->neighborhood();
}
@@ -89,7 +89,7 @@
template <typename E>
struct case_ < topology_hierarchy_wrt_neighborhood, E, 1 >
- : where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::none > >
+ : where_< mlc::neq_< oln_vtype(E, neighborhood), mlc::none > >
{
typedef abstract::topology_having_neighborhood<E> ret;
};
Index: oln/core/abstract/internal/image_impl.hh
===================================================================
--- oln/core/abstract/internal/image_impl.hh (revision 712)
+++ oln/core/abstract/internal/image_impl.hh (working copy)
@@ -75,8 +75,8 @@
(client)
- The D parameter is the delegated type. If there is no
- delegated type (i.e. D = mlc::none), get_image_impl inherits
+ The D parameter is the delegatee type. If there is no
+ delegatee type (i.e. D = mlc::none), get_image_impl inherits
from oln::any_best_speed (trough get_image_impl_helper);
otherwise, get_image_impl is plugged to set_image_impl, a
class than can be specialized by the user.
@@ -91,7 +91,7 @@
// Entry point.
template <typename A, typename E>
struct get_image_impl :
- public get_image_impl_helper <A, oln_type_of(E, delegated), E>
+ public get_image_impl_helper <A, oln_vtype(E, delegatee), E>
{
};
@@ -120,7 +120,7 @@
struct image_impl :
public virtual oln::abstract::any_best_speed<E>
{
- typedef oln_type_of(E, delegated) D;
+ typedef oln_vtype(E, delegatee) D;
D& delegate() { return this->exact().impl_delegate(); }
const D& delegate() const { return this->exact().impl_delegate(); }
};
Index: oln/core/1d/image1d.hh
===================================================================
--- oln/core/1d/image1d.hh (revision 712)
+++ oln/core/1d/image1d.hh (working copy)
@@ -51,7 +51,6 @@
struct vtypes< image1d<T> >
{
typedef topo1d topo_type;
- typedef grid1d grid_type;
typedef point1d point_type;
Index: oln/core/2d/image2d.hh
===================================================================
--- oln/core/2d/image2d.hh (revision 712)
+++ oln/core/2d/image2d.hh (working copy)
@@ -51,7 +51,6 @@
struct vtypes< image2d<T> >
{
typedef topo2d topo_type;
- typedef grid2d grid_type;
typedef point2d point_type;
Index: oln/core/3d/image3d.hh
===================================================================
--- oln/core/3d/image3d.hh (revision 712)
+++ oln/core/3d/image3d.hh (working copy)
@@ -51,7 +51,6 @@
struct vtypes< image3d<T> >
{
typedef topo3d topo_type;
- typedef grid3d grid_type;
typedef point3d point_type;
Index: oln/core/gen/piter_isubset.hh
===================================================================
--- oln/core/gen/piter_isubset.hh (revision 712)
+++ oln/core/gen/piter_isubset.hh (working copy)
@@ -54,10 +54,10 @@
template <typename piter_t, typename isubset_t>
struct vtypes< piter_isubset_<piter_t, isubset_t> >
{
- typedef oln_type_of(piter_t, point) point_type;
- typedef oln_type_of(piter_t, grid) grid_type;
+ typedef oln_vtype(piter_t, point) point_type;
+ typedef oln_vtype(piter_t, grid) grid_type;
- typedef topo_add_isubset<oln_type_of(piter_t, topo), isubset_t> topo_type;
+ typedef topo_add_isubset<oln_vtype(piter_t, topo), isubset_t> topo_type;
};
@@ -69,8 +69,8 @@
typedef piter_isubset_<piter_t, isubset_t> self_t;
typedef abstract::iterator_on_points<self_t> super_t;
- typedef oln_type_of(self_t, topo) topo_t;
- typedef oln_type_of(self_t, point) point_t;
+ typedef oln_vtype(self_t, topo) topo_t;
+ typedef oln_vtype(self_t, point) point_t;
public:
Index: oln/core/gen/topo_add_isubset.hh
===================================================================
--- oln/core/gen/topo_add_isubset.hh (revision 712)
+++ oln/core/gen/topo_add_isubset.hh (working copy)
@@ -63,7 +63,7 @@
: public internal::topology_morpher<topo_t, topo_add_isubset<topo_t, isubset_t> >
{
typedef topo_add_isubset<topo_t, isubset_t> self_t;
- typedef oln_type_of(self_t, point) point_t;
+ typedef oln_vtype(self_t, point) point_t;
public:
Index: oln/core/gen/bbox.hh
===================================================================
--- oln/core/gen/bbox.hh (revision 712)
+++ oln/core/gen/bbox.hh (working copy)
@@ -62,7 +62,7 @@
typedef bbox_<point_t> bbox_type;
typedef mlc::true_ is_random_accessible_type;
- typedef mlc::true_ has_know_size_type;
+ typedef mlc::true_ has_known_size_type;
typedef mlc::true_ is_connected_type;
};
@@ -80,9 +80,9 @@
private:
typedef point_set_entry<self_type> super_t;
- typedef oln_type_of(point_t, coord) coord_t;
+ typedef oln_vtype(point_t, coord) coord_t;
- typedef oln_type_of(point_t, dim) dim;
+ typedef oln_vtype(point_t, dim) dim;
enum { n = mlc_value(dim) };
public:
Index: oln/core/gen/topo_bbox.hh
===================================================================
--- oln/core/gen/topo_bbox.hh (revision 712)
+++ oln/core/gen/topo_bbox.hh (working copy)
@@ -118,7 +118,7 @@
{
typedef topo_bbox_<point> self_t;
typedef topology_entry<self_t> super_t;
- typedef oln_type_of(self_t, bbox) bbox_t;
+ typedef oln_vtype(self_t, bbox) bbox_t;
public:
Index: oln/core/gen/neighb.hh
===================================================================
--- oln/core/gen/neighb.hh (revision 712)
+++ oln/core/gen/neighb.hh (working copy)
@@ -56,15 +56,17 @@
template <typename dpoint>
struct vtypes< neighb_<dpoint> >
{
- typedef oln_type_of(dpoint, grid) grid_type;
+ typedef oln_vtype(dpoint, grid) grid_type;
};
+ struct FIXME_ERR;
+
/// Abstract forward dpoint iterator class.
template <typename dpoint>
class neighb_ : public neighborhood_entry< neighb_<dpoint> >,
- private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint) >
+ private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint), FIXME_ERR >
{
typedef neighb_<dpoint> self_t;
typedef neighborhood_entry<self_t> super_t;
Index: oln/core/gen/bkd_viter_lut.hh
===================================================================
--- oln/core/gen/bkd_viter_lut.hh (revision 712)
+++ oln/core/gen/bkd_viter_lut.hh (working copy)
@@ -70,11 +70,11 @@
{
typedef bkd_viter_lut<Lut> self_t;
typedef abstract::iterator_on_values<self_t> super_t;
- typedef oln_type_of(self_t, lut_iter) lut_iter_t;
+ typedef oln_vtype(self_t, lut_iter) lut_iter_t;
public:
- typedef oln_type_of(self_t, lut) lut_type;
- typedef oln_type_of(self_t, value) value_type;
+ typedef oln_vtype(self_t, lut) lut_type;
+ typedef oln_vtype(self_t, value) value_type;
public:
/// Construct a backward value iterator from a look-up table (LUT).
Index: oln/core/gen/pset_list.hh
===================================================================
--- oln/core/gen/pset_list.hh (revision 712)
+++ oln/core/gen/pset_list.hh (working copy)
@@ -61,7 +61,7 @@
typedef bkd_piter_on_std_based_pset< std::list<point_t> > bkd_piter_type;
typedef mlc::false_ is_random_accessible_type;
- typedef mlc::true_ has_know_size_type;
+ typedef mlc::true_ has_known_size_type;
typedef mlc::false_ is_connected_type;
};
Index: oln/core/gen/window.hh
===================================================================
--- oln/core/gen/window.hh (revision 712)
+++ oln/core/gen/window.hh (working copy)
@@ -44,9 +44,16 @@
template <typename dpoint>
+ struct set_super_type< window_<dpoint> >
+ {
+ typedef abstract::window< window_<dpoint> > ret;
+ };
+
+
+ template <typename dpoint>
struct vtypes< window_<dpoint> >
{
- typedef oln_type_of(dpoint, grid) grid_type;
+ typedef oln_vtype(dpoint, grid) grid_type;
};
Index: oln/core/gen/topo_lbbox.hh
===================================================================
--- oln/core/gen/topo_lbbox.hh (revision 712)
+++ oln/core/gen/topo_lbbox.hh (working copy)
@@ -66,7 +66,7 @@
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef topo_lbbox_<point> self_t;
- typedef oln_type_of(self_t, bbox) bbox_t;
+ typedef oln_vtype(self_t, bbox) bbox_t;
public:
@@ -103,7 +103,7 @@
unsigned border)
: bb_(bb), border_(border)
{
- typedef oln_type_of(point, dpoint) dpoint_t;
+ typedef oln_vtype(point, dpoint) dpoint_t;
dpoint_t dp;
dp.set_all(border);
lbb_ = bbox_<point>(bb_.pmin() - dp, bb_.pmax() + dp);
@@ -114,7 +114,7 @@
unsigned border)
: bb_(pmin, pmax), border_(border)
{
- typedef oln_type_of(point, dpoint) dpoint_t;
+ typedef oln_vtype(point, dpoint) dpoint_t;
dpoint_t dp;
dp.set_all(border);
lbb_ = bbox_<point>(bb_.pmin() - dp, bb_.pmax() + dp);
Index: oln/core/gen/pset_vec.hh
===================================================================
--- oln/core/gen/pset_vec.hh (revision 712)
+++ oln/core/gen/pset_vec.hh (working copy)
@@ -61,7 +61,7 @@
typedef bkd_piter_on_std_based_pset< std::vector<point_t> > bkd_piter_type;
typedef mlc::false_ is_random_accessible_type;
- typedef mlc::true_ has_know_size_type;
+ typedef mlc::true_ has_known_size_type;
typedef mlc::false_ is_connected_type;
};
Index: oln/core/gen/pset_.hh
===================================================================
--- oln/core/gen/pset_.hh (revision 712)
+++ oln/core/gen/pset_.hh (working copy)
@@ -61,7 +61,7 @@
typedef bkd_piter_on_std_based_pset< std::set<point_t> > bkd_piter_type;
typedef mlc::false_ is_random_accessible_type;
- typedef mlc::true_ has_know_size_type;
+ typedef mlc::true_ has_known_size_type;
typedef mlc::false_ is_connected_type;
};
Index: oln/core/gen/fwd_viter_lut.hh
===================================================================
--- oln/core/gen/fwd_viter_lut.hh (revision 712)
+++ oln/core/gen/fwd_viter_lut.hh (working copy)
@@ -70,11 +70,11 @@
{
typedef fwd_viter_lut<Lut> self_t;
typedef abstract::iterator_on_values<self_t> super_t;
- typedef oln_type_of(self_t, lut_iter) lut_iter_t;
+ typedef oln_vtype(self_t, lut_iter) lut_iter_t;
public:
- typedef oln_type_of(self_t, lut) lut_type;
- typedef oln_type_of(self_t, value) value_type;
+ typedef oln_vtype(self_t, lut) lut_type;
+ typedef oln_vtype(self_t, value) value_type;
public:
/// Construct a forward value iterator from a look-up table (LUT).
Index: oln/core/gen/mapimage.hh
===================================================================
--- oln/core/gen/mapimage.hh (revision 712)
+++ oln/core/gen/mapimage.hh (working copy)
@@ -48,7 +48,6 @@
struct vtypes< mapimage<point_t, value_t> >
{
typedef topo_bbox_<point_t> topo_type;
- typedef oln_type_of(point_t, grid) grid_type;
typedef point_t point_type;
@@ -77,7 +76,7 @@
class mapimage : public image_entry< mapimage<point_t, value_t> >
{
typedef mapimage<point_t, value_t> self_t;
- typedef oln_type_of(self_t, topo) topo_t;
+ typedef oln_vtype(self_t, topo) topo_t;
public:
Index: oln/core/gen/topo_add_nbh.hh
===================================================================
--- oln/core/gen/topo_add_nbh.hh (revision 712)
+++ oln/core/gen/topo_add_nbh.hh (working copy)
@@ -54,7 +54,7 @@
struct vtypes< topo_add_nbh<topo, nbh> >
{
typedef nbh neighborhood_type;
- typedef topo delegated_type;
+ typedef topo delegatee_type;
};
Index: oln/core/internal/topology_morpher.hh
===================================================================
--- oln/core/internal/topology_morpher.hh (revision 712)
+++ oln/core/internal/topology_morpher.hh (working copy)
@@ -42,17 +42,23 @@
} // end of namespace oln::internal
+
+ /// Super type.
template <typename Topo, typename E>
- struct set_pseudosuper_type< internal::topology_morpher<Topo, E> >
+ struct set_super_type< internal::topology_morpher<Topo, E> >
{
- typedef Topo ret;
+ typedef topology_entry<E> ret;
};
+
+ /// Vtypes.
template <typename Topo, typename E>
struct vtypes< internal::topology_morpher<Topo, E> >
{
typedef morpher::tag::identity morpher_type;
- typedef Topo delegated_type;
+
+ /// Delegatee type.
+ typedef Topo delegatee_type;
};
Index: oln/core/internal/point_nd.hh
===================================================================
--- oln/core/internal/point_nd.hh (revision 712)
+++ oln/core/internal/point_nd.hh (working copy)
@@ -72,8 +72,8 @@
struct vtypes< internal::point_nd<E> >
{
private:
- typedef oln_dim(E) dim_t;
- typedef oln_coord(E) coord_t;
+ typedef oln_deferred_vtype(E, dim) dim_t;
+ typedef oln_deferred_vtype(E, coord) coord_t;
public:
typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type;
};
@@ -124,9 +124,7 @@
point_nd(const vec_t& v);
/// Dtor.
- ~point_nd()
- {
- }
+ ~point_nd();
vec_t v_;
};
@@ -221,9 +219,9 @@
v_(v)
{}
-// template <typename E>
-// point_nd<E>::~point_nd()
-// {}
+ template <typename E>
+ point_nd<E>::~point_nd()
+ {}
# endif
@@ -256,10 +254,10 @@
: where_< mlc::and_< mlc_is_a(P, internal::point_nd),
mlc_is_a(D, internal::dpoint_nd) > >
{
- typedef oln_type_of(P, coord) P_coord;
- typedef oln_type_of(D, coord) D_coord;
+ typedef oln_vtype(P, coord) P_coord;
+ typedef oln_vtype(D, coord) D_coord;
typedef xtd_op_plus_trait(P_coord, D_coord) coord;
- typedef oln_type_of(P, dim) dim;
+ typedef oln_vtype(P, dim) dim;
typedef typename point_<mlc_value(dim), coord>::ret ret;
};
@@ -271,10 +269,10 @@
: where_< mlc::and_< mlc_is_a(P, internal::point_nd),
mlc_is_a(D, internal::dpoint_nd) > >
{
- typedef oln_type_of(P, coord) P_coord;
- typedef oln_type_of(D, coord) D_coord;
+ typedef oln_vtype(P, coord) P_coord;
+ typedef oln_vtype(D, coord) D_coord;
typedef xtd_op_minus_trait(P_coord, D_coord) coord;
- typedef oln_type_of(P, dim) dim;
+ typedef oln_vtype(P, dim) dim;
typedef typename point_<mlc_value(dim), coord>::ret ret;
};
@@ -286,10 +284,10 @@
: where_< mlc::and_< mlc_is_a(P1, internal::point_nd),
mlc_is_a(P2, internal::point_nd) > >
{
- typedef oln_type_of(P1, coord) P1_coord;
- typedef oln_type_of(P2, coord) P2_coord;
+ typedef oln_vtype(P1, coord) P1_coord;
+ typedef oln_vtype(P2, coord) P2_coord;
typedef xtd_op_minus_trait(P1_coord, P2_coord) coord;
- typedef oln_type_of(P1, dim) dim;
+ typedef oln_vtype(P1, dim) dim;
typedef typename dpoint_<mlc_value(dim), coord>::ret ret;
};
Index: oln/core/internal/bbox_bkd_piter.hh
===================================================================
--- oln/core/internal/bbox_bkd_piter.hh (revision 712)
+++ oln/core/internal/bbox_bkd_piter.hh (working copy)
@@ -61,7 +61,7 @@
template <typename E>
class bbox_bkd_piter : public abstract::iterator_on_points<E>
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
public:
@@ -95,7 +95,7 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- bbox_bkd_piter<E>::bbox_bkd_piter(const bbox_<oln_type_of(E, point)>& bb)
+ bbox_bkd_piter<E>::bbox_bkd_piter(const bbox_<oln_vtype(E, point)>& bb)
: p_(),
bb_(bb)
{
@@ -104,7 +104,7 @@
}
template <typename E>
- const bbox_<oln_type_of(E, point)>&
+ const bbox_<oln_vtype(E, point)>&
bbox_bkd_piter<E>::bbox() const
{
return bb_;
@@ -122,7 +122,7 @@
void
bbox_bkd_piter<E>::impl_next()
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
invariant(implies(p_ != nop_, bb_.has(p_)));
for (int i = point_t::n - 1; i >= 0; --i)
if (p_[i] == bb_.pmin(i))
@@ -153,14 +153,14 @@
}
template <typename E>
- oln_type_of(E, point)
+ oln_vtype(E, point)
bbox_bkd_piter<E>::impl_to_point() const
{
return p_;
}
template <typename E>
- const oln_type_of(E, point)*
+ const oln_vtype(E, point)*
bbox_bkd_piter<E>::impl_point_adr() const
{
return &p_;
Index: oln/core/internal/bbox_fwd_piter.hh
===================================================================
--- oln/core/internal/bbox_fwd_piter.hh (revision 712)
+++ oln/core/internal/bbox_fwd_piter.hh (working copy)
@@ -61,7 +61,7 @@
template <typename E>
class bbox_fwd_piter : public abstract::iterator_on_points<E>
{
- typedef oln_type_of(E, point) point_t;
+ typedef oln_vtype(E, point) point_t;
public:
Index: oln/core/internal/dpoint_nd.hh
===================================================================
--- oln/core/internal/dpoint_nd.hh (revision 712)
+++ oln/core/internal/dpoint_nd.hh (working copy)
@@ -55,8 +55,8 @@
struct vtypes< internal::dpoint_nd<E> >
{
private:
- typedef oln_dim(E) dim_t;
- typedef oln_coord(E) coord_t;
+ typedef oln_deferred_vtype(E, dim) dim_t;
+ typedef oln_deferred_vtype(E, coord) coord_t;
public:
typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type;
};
@@ -72,7 +72,7 @@
typedef dpoint_nd<E> self_t;
typedef oln_dim(E) dim_t;
typedef oln_coord(E) coord_t;
- typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t;
+ typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t;
public:
Index: oln/morpher/add_isubset.hh
===================================================================
--- oln/morpher/add_isubset.hh (revision 712)
+++ oln/morpher/add_isubset.hh (working copy)
@@ -103,7 +103,7 @@
super_t(image),
topo_(image.topo(), isubset)
{
- // mlc::assert_equal_<oln_type_of(Image, grid), oln_type_of(Isubset, grid)>::check();
+ // mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Isubset, grid)>::check();
// FIXME: check that Image is without a isubset
}
@@ -144,7 +144,7 @@
operator | (const abstract::image<I>& image,
const abstract::binary_image<S>& isubset)
{
- mlc::assert_equal_<oln_type_of(I, grid), oln_type_of(S, grid)>::check();
+ mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(S, grid)>::check();
// FIXME: check that Image does not have yet a subset
morpher::add_isubset<I, S> tmp(image.exact(), isubset.exact());
return tmp;
Index: oln/morpher/value_cast.hh
===================================================================
--- oln/morpher/value_cast.hh (revision 712)
+++ oln/morpher/value_cast.hh (working copy)
@@ -78,8 +78,8 @@
typedef value_cast<Image, Value> self_t;
typedef internal::image_value_morpher<Image, self_t> super_t;
- typedef oln_type_of(self_t, psite) psite_t;
- typedef oln_type_of(self_t, rvalue) rvalue_t;
+ typedef oln_vtype(self_t, psite) psite_t;
+ typedef oln_vtype(self_t, rvalue) rvalue_t;
public:
Index: oln/morpher/thru_fun.hh
===================================================================
--- oln/morpher/thru_fun.hh (revision 712)
+++ oln/morpher/thru_fun.hh (working copy)
@@ -59,7 +59,7 @@
struct vtypes< morpher::thru_fun<Image, Fun> >
{
private:
- typedef oln_type_of(Image, rvalue) old_value_type;
+ typedef oln_vtype(Image, rvalue) old_value_type;
typedef morpher::thru_fun<Image, Fun> self_t;
public:
typedef mlc::true_ is_computed_type;
Index: oln/morpher/slice.hh
===================================================================
--- oln/morpher/slice.hh (revision 712)
+++ oln/morpher/slice.hh (working copy)
@@ -61,6 +61,7 @@
};
+
/// Virtual types associated to oln::morpher::slice<Image>
/// \{
template <typename Image>
@@ -69,28 +70,24 @@
private:
typedef morpher::slice<Image> self_t;
- typedef oln_deduce_type_of(Image, grid, dimvalue) orig_dimvalue_type;
+ typedef oln_deduce_vtype(Image, grid, dimvalue) orig_dimvalue_type;
typedef mlc::uint_< mlc_value(orig_dimvalue_type) - 1 > dimvalue_type;
- typedef oln_type_of(Image, fwd_piter) orig_fwd_piter;
- typedef oln_type_of(Image, bkd_piter) orig_bkd_piter;
- typedef oln_type_of(Image, fwd_qiter) orig_fwd_qiter;
- typedef oln_type_of(Image, bkd_qiter) orig_bkd_qiter;
+ typedef oln_vtype(Image, fwd_piter) orig_fwd_piter;
+ typedef oln_vtype(Image, bkd_piter) orig_bkd_piter;
+ typedef oln_vtype(Image, fwd_qiter) orig_fwd_qiter;
+ typedef oln_vtype(Image, bkd_qiter) orig_bkd_qiter;
public:
typedef typename
- type_fun::slice_topo< oln_type_of(Image, topo) >::ret topo_type;
+ type_fun::slice_topo< oln_vtype(Image, topo) >::ret topo_type;
- typedef grid_<mlc_value(orig_dimvalue_type) - 1> grid_type;
+ typedef typename point_< mlc_value(dimvalue_type),
+ oln_deduce_vtype(Image, point, coord) >::ret point_type;
+ typedef point_type psite_type;
+ // FIXME: A better (when overriding is involved) is oln_deferred_vtype(self_t, point).
- // psite_type: see below.
- typedef typename
- point_< mlc_value(dimvalue_type),
- oln_deduce_type_of(Image, point, coord) >::ret
- point_type;
-
- // piter_type: see below.
-
+ typedef oln_is_computed(Image) is_computed_type;
typedef oln_value(Image) value_type;
// rvalue_type: see below.
// lvalue_type: see below.
@@ -104,8 +101,6 @@
typedef oln::morpher::tag::slice morpher_type;
// Final.
- typedef oln_deduce(Image, point, coord) coord_type;
- typedef oln_point(self_t) psite_type;
typedef oln_fwd_piter(Image) piter_type;
typedef oln_rvalue(Image) rvalue_type;
typedef oln_lvalue(Image) lvalue_type;
@@ -127,15 +122,15 @@
{
typedef slice<Image> self_t;
- typedef oln_type_of(self_t, topo) topo_t;
- typedef oln_type_of(self_t, rvalue) rvalue_t;
- typedef oln_type_of(self_t, lvalue) lvalue_t;
- typedef oln_type_of(self_t, point) point_t;
+ typedef oln_vtype(self_t, topo) topo_t;
+ typedef oln_vtype(self_t, rvalue) rvalue_t;
+ typedef oln_vtype(self_t, lvalue) lvalue_t;
+ typedef oln_vtype(self_t, point) point_t;
- typedef oln_type_of(Image, topo) orig_topo_t;
- typedef oln_type_of(Image, point) orig_point_t;
+ typedef oln_vtype(Image, topo) orig_topo_t;
+ typedef oln_vtype(Image, point) orig_point_t;
- typedef oln_deduce_type_of(Image, point, coord) coord_t;
+ typedef oln_deduce_vtype(Image, point, coord) coord_t;
public:
Index: oln/morpher/with_lut.hh
===================================================================
--- oln/morpher/with_lut.hh (revision 712)
+++ oln/morpher/with_lut.hh (working copy)
@@ -60,7 +60,7 @@
struct vtypes< morpher::with_lut<Image, Lut> >
{
private:
- typedef oln_type_of(Image, rvalue) orig_value_type;
+ typedef oln_vtype(Image, rvalue) orig_value_type;
typedef morpher::with_lut<Image, Lut> self_t;
public:
typedef mlc::true_ is_computed_type;
@@ -68,7 +68,6 @@
// Value type.
typedef typename Lut::new_value_type value_type;
typedef value_type rvalue_type;
- typedef mlc::not_ok lvalue_type;
// Look-up table type.
typedef Lut lut_type;
@@ -103,11 +102,11 @@
public:
typedef Lut lut_type;
- typedef oln_type_of(self_t, value) value_type;
- typedef oln_type_of(self_t, rvalue) rvalue_type;
- typedef oln_type_of(self_t, psite) psite_type;
- typedef oln_type_of(self_t, value_proxy) value_proxy_type;
- typedef oln_type_of(self_t, mutable_value_proxy) mutable_value_proxy_type;
+ typedef oln_vtype(self_t, value) value_type;
+ typedef oln_vtype(self_t, rvalue) rvalue_type;
+ typedef oln_vtype(self_t, psite) psite_type;
+ typedef oln_vtype(self_t, value_proxy) value_proxy_type;
+ typedef oln_vtype(self_t, mutable_value_proxy) mutable_value_proxy_type;
public:
with_lut(const Image& image, const Lut& lut);
Index: oln/morpher/thru_mfun.hh
===================================================================
--- oln/morpher/thru_mfun.hh (revision 712)
+++ oln/morpher/thru_mfun.hh (working copy)
@@ -59,7 +59,7 @@
struct vtypes< morpher::thru_mfun<Image, Fun> >
{
private:
- typedef oln_type_of(Image, rvalue) old_value_type;
+ typedef oln_vtype(Image, rvalue) old_value_type;
typedef morpher::thru_mfun<Image, Fun> self_t;
public:
typedef mlc::false_ is_computed_type;
Index: oln/morpher/internal/image_value_morpher.hh
===================================================================
--- oln/morpher/internal/image_value_morpher.hh (revision 712)
+++ oln/morpher/internal/image_value_morpher.hh (working copy)
@@ -48,27 +48,30 @@
} // end of namespace oln::morpher
- /// Create an ``uplink'' from
- /// oln::morpher::internal::image_value_morpher to the morphed \a Image,
- /// so as to get all its virtual types.
+ /// Super type.
template <typename Image, typename Exact>
- struct
- set_pseudosuper_type< morpher::internal::image_value_morpher<Image, Exact> >
+ struct set_super_type< morpher::internal::image_value_morpher<Image, Exact> >
{
- typedef Image ret;
+ typedef oln::image_entry<Exact> ret;
};
+ /// Vtypes.
template <typename Image, typename Exact>
struct vtypes< morpher::internal::image_value_morpher<Image, Exact> >
{
// Morpher type.
typedef oln::morpher::tag::identity morpher_type; // FIXME: Wrong!
- typedef mlc::not_found is_computed_type;
- typedef mlc::not_found value_type;
- typedef mlc::not_found lvalue_type;
- typedef mlc::not_found rvalue_type;
+ typedef stc::not_delegated is_computed_type;
+ typedef stc::not_delegated value_type;
+ typedef stc::not_delegated lvalue_type;
+ typedef stc::not_delegated rvalue_type;
+
+ /// Create an ``uplink'' from
+ /// oln::morpher::internal::image_value_morpher to the morphed \a Image,
+ /// so as to get all its virtual types.
+ typedef Image delegatee_type;
};
Index: oln/morpher/internal/image_extension.hh
===================================================================
--- oln/morpher/internal/image_extension.hh (revision 712)
+++ oln/morpher/internal/image_extension.hh (working copy)
@@ -48,22 +48,26 @@
} // end of namespace oln::morpher
- /// Create an ``uplink'' from
- /// oln::morpher::internal::image_extension to the morphed \a Image,
- /// so as to get all its virtual types.
+ /// Super type.
template <typename Image, typename Exact>
- struct
- set_pseudosuper_type< morpher::internal::image_extension<Image, Exact> >
+ struct set_super_type< morpher::internal::image_extension<Image, Exact> >
{
- typedef Image ret;
+ typedef oln::image_entry<Exact> ret;
};
+ /// Vtypes.
template <typename Image, typename Exact>
struct vtypes< morpher::internal::image_extension<Image, Exact> >
{
// Morpher type.
typedef oln::morpher::tag::identity morpher_type;
+
+ /// Delegatee type:
+ /// Create an ``uplink'' from
+ /// oln::morpher::internal::image_extension to the morphed \a Image,
+ /// so as to get all its virtual types.
+ typedef Image delegatee_type;
};
Index: oln/morpher/add_neighborhood.hh
===================================================================
--- oln/morpher/add_neighborhood.hh (revision 712)
+++ oln/morpher/add_neighborhood.hh (working copy)
@@ -58,7 +58,7 @@
struct vtypes< morpher::add_neighborhood<Image, Neighb> >
{
// Topology type.
- typedef topo_add_nbh< oln_type_of(Image, topo), Neighb > topo_type;
+ typedef topo_add_nbh< oln_vtype(Image, topo), Neighb > topo_type;
// Neighborhood type.
typedef Neighb neighborhood_type;
@@ -103,7 +103,7 @@
super_t(image),
topo_(image.topo(), nbh)
{
- mlc::assert_equal_<oln_type_of(Image, grid), oln_type_of(Neighb, grid)>::check();
+ mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Neighb, grid)>::check();
// FIXME: check that Image is without a nbh
}
@@ -132,7 +132,7 @@
operator + (const abstract::image<I>& image,
const abstract::neighborhood<N>& nbh)
{
- mlc::assert_equal_<oln_type_of(I, grid), oln_type_of(N, grid)>::check();
+ mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(N, grid)>::check();
// FIXME: check that Image is without a nbh
morpher::add_neighborhood<I, N> tmp(image.exact(), nbh.exact());
return tmp;
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* stc/scoop.hh: Convert to Unix line terminators.
0 files changed
Index: stc/scoop.hh
1
0