Damien Thivolle wrote:
Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/Makefile.am: Add files from oln/morpher/
* olena/oln/morpher/generic_morpher.hh: Correct comments and code.
* olena/oln/morpher/subq_morpher.hh: Likewise.
* olena/oln/morpher/color_morpher.hh: Likewise.
* olena/tests/morpher/tests/compose_morph: New file, contains
morpher composition tests.
* olena/tests/morpher/tests/sq_morph: New file, contains sub quantifying
morpher tests.
* olena/tests/morpher/tests/color_morph: New file, contains color morpher
80 colonnes.
+ /// The exact type of the morpher.
typedef Exact exact_type;
+ /// The morpher point type.
typedef oln_point_type(DestType) point_type;
+ /// The morpher dpoint type.
typedef oln_dpoint_type(DestType) dpoint_type;
+ /// The morpher iterator type.
typedef oln_iter_type(DestType) iter_type;
+ /// The morpher forward iterator type.
typedef oln_fwd_iter_type(DestType) fwd_iter_type;
+ /// The morpher backward iterator type.
typedef oln_bkd_iter_type(DestType) bkd_iter_type;
+ /// The morpher value type.
typedef oln_value_type(DestType) value_type;
+ /// The morpher size type.
typedef oln_size_type(DestType) size_type;
+ /// The morpher underlying implementation.
typedef oln_impl_type(DestType) impl_type;
Il faut récupérer tout ça dans les traits.
Exemple: si le type de morpher redéfinit l'iter
type la fonction suivante ne va pas fonctionner
correctement vis à vis du morpher exact:
f(abstract::generic_morpher<...> toto)
{
abstract::generic_morpher<...>::iter_type it_t;
// fonctionne si iter_type est recupéré dans les traits.
}
+ /// Instantiate and return the image that the
morpher simulates.
+ DestType*
+ unmorph() const
+ {
+ DestType* im = new DestType(to_exact(*this).size());
+ oln_iter_type(DestType) it(*im);
+
+ for_all(it)
+ (*im)[it] = to_exact(*this).operator[](it);
+ return im;
+ }
Il y a une bonne raison pourquoi tu retournes du "DestType *",
et non pas du "DestType"?
--- olena/oln/morpher/color_morpher.hh Mon, 29 Mar
2004 00:39:14 +0200 thivol_d (oln/m/26_color_morp 1.1 600)
+++ olena/oln/morpher/color_morpher.hh Tue, 30 Mar 2004 19:08:32 +0200 thivol_d
(oln/m/26_color_morp 1.1 600)
--- olena/tests/morpher/tests/compose_morph Tue, 30 Mar 2004 22:08:16 +0200 thivol_d ()
+++ olena/tests/morpher/tests/compose_morph Sun, 28 Mar 2004 20:57:30 +0200 thivol_d
(oln/m/43_compose_mo 644)
J'ai survolé le reste; de haut ça à l'air très bien!
--
Niels