https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Introduce the new set of image properties.
* mln/trait/image/props.hh: New set of image properties.
* mln/trait/image/print.hh: Update.
* mln/trait/images.hh: Update.
image/print.hh | 27 +-
image/props.hh | 556 +++++++++++++++++++++++++++++++++++++++++++++------------
images.hh | 98 ++++++----
3 files changed, 514 insertions(+), 167 deletions(-)
Index: mln/trait/image/props.hh
--- mln/trait/image/props.hh (revision 2009)
+++ mln/trait/image/props.hh (working copy)
@@ -38,6 +38,177 @@
# include <mln/trait/value/kind.hh>
+
+// Properties of images.
+// =====================
+
+// * misc
+
+// category: /any/
+// |
+// + -- primary
+// |
+// + -- /morpher/
+// |
+// + -- domain_morpher
+// |
+// + -- value_morpher
+// |
+// + -- identity_morpher
+
+// speed: /any/
+// |
+// + -- slow
+// |
+// + -- fast
+// |
+// + -- fastest
+
+// size: /any/
+// |
+// + -- regular
+// |
+// + -- huge
+
+// * value
+
+// value_access: /any/
+// |
+// + -- direct
+// |
+// + -- computed
+
+// value_storage:/any/
+// |
+// + -- /organized/
+// | |
+// | + -- singleton
+// | |
+// | + -- one_block
+// | |
+// | + -- piecewise
+// |
+// + -- disrupted
+
+// value_browsing:/any/
+// |
+// + -- site_wise_only
+// |
+// + ------- cell_wise
+// | \
+// + -- value_wise \
+// \ \
+// ---- + -- cell_and_value_wise
+
+// value_io: /any/
+// |
+// + -- read_only
+// |
+// + -- read_write
+
+// * site localization
+
+// localization: /any/
+// |
+// + -- none
+// |
+// + -- space
+// |
+// + -- /grid/
+// |
+// + -- isotropic_grid
+// | |
+// | + -- basic_grid
+// |
+// + -- anisotropic_grid
+
+// dimension: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- one_d
+// |
+// + -- two_d
+// |
+// + -- three_d
+
+// * extended domain
+
+// ext_domain: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- fixed
+// | |
+// | + -- infinite
+// |
+// + -- extendable
+
+// ext_value: /any/
+// |
+// + -- irrelevant
+// |
+// + -- single
+// |
+// + -- multiple
+
+// ext_io: /any/
+// |
+// + -- irrelevant
+// |
+// + -- read_only
+// |
+// + -- read_write
+
+// * data (related to I::value)
+
+// kind: /any/
+// |
+// + -- color
+// |
+// + -- gray
+// |
+// + ----------- label
+// | |
+// | +-- named
+// + -- /logic/ |
+// | | |
+// | + -- /mvlogic/
+// | | |
+// | | + -- binary
+// | | |
+// | | + -- ternary
+// | |
+// | + -- fuzzy
+// |
+// + -- data
+// |
+// |
+// + -- /map/
+// |
+// + -- distance
+
+// nature: /any/
+// |
+// + -- scalar
+// |
+// + -- vectorial
+// |
+// + -- structed
+// |
+// + -- pointer
+
+// quant: /any/
+// |
+// + -- low
+// |
+// + -- high
+
+
namespace mln
{
@@ -47,43 +218,23 @@
namespace image
{
- // FIXME: For the record:
-
- // template <typename I>
- // struct undefined_image_
- // {
- // typedef undef category; // primary, domain_morpher, value_morpher,
- // // or identity_morpher < morpher
-
- // // related to I::value
- // typedef undef kind; // color, gray, binary < logic < label,
data
- // typedef undef quant; // low or high
- // typedef undef value; // scalar, vectorial, structed, pointer
- // // FIXME: Make the difference between homogeneous and heterogeneous
vectors...
-
- // // related to I::pset
- // typedef undef access; // random, browsing
- // typedef undef space; // one_d, two_d, three_d
- // typedef undef size; // huge or regular
- // typedef undef support; // irregular, aligned < regular
-
- // // global
- // typedef undef border; // none, { stored, computed } < some
- // typedef undef neighb; // none, some
- // typedef undef data; // raw < linear < stored, computed
- // typedef undef io; // read_only < read, write_only < write,
read_write < both read'n write
- // typedef undef speed; // slow, fast, or fastest
- // };
-
- // FIXME: Add nice pictures of those hierarchies.
-
-
+// category: /any/
+// |
+// + -- primary
+// |
+// + -- /morpher/
+// |
+// + -- domain_morpher
+// |
+// + -- value_morpher
+// |
+// + -- identity_morpher
struct category
{
- struct any {};
+ struct any { protected: any() {} };
struct primary : any { std::string name() const { return "category::primary";
} };
- struct morpher : any {};
+ struct morpher : any { protected: morpher() {} };
struct domain_morpher
: morpher { std::string name() const { return "category::domain_morpher"; }
};
struct value_morpher
@@ -93,113 +244,286 @@
};
- typedef mln::trait::value::kind kind; // Fetch the 'kind' structure from
value traits.
-
-
- struct data
- {
- struct any {};
- struct computed : any { std::string name() const { return "data::computed"; }
};
- struct stored : any { std::string name() const { return "data::stored"; }
};
- struct linear
- : stored { std::string name() const { return "data::linear"; } };
- struct raw
- : linear { std::string name() const { return "data::raw"; } };
- };
-
- struct quant
- {
- struct any {};
- struct low : any { std::string name() const { return "quant::low"; } };
- struct high : any { std::string name() const { return "quant::high"; } };
- };
-
- struct value
- {
- struct any {};
- struct scalar : any { std::string name() const { return "value::scalar"; }
};
- struct vectorial : any { std::string name() const { return "value::vectorial";
} };
- struct structed : any { std::string name() const { return "value::structed";
} };
- struct pointer : any { std::string name() const { return "value::pointer"; }
};
-
- struct fixme // So FIXME!
- : any { std::string name() const { return "space::fixme"; } };
- };
-
+// speed: /any/
+// |
+// + -- slow
+// |
+// + -- fast
+// |
+// + -- fastest
- struct access
+ struct speed
{
- struct any {};
- struct random : any { std::string name() const { return "access::random"; }
};
- struct browsing : any { std::string name() const { return "access::browsing";
} };
+ struct any { protected: any() {} };
+ struct slow : any { std::string name() const { return "speed::slow"; } };
+ struct fast : any { std::string name() const { return "speed::fast"; } };
+ struct fastest
+ : fast { std::string name() const { return "speed::fastest"; } };
};
- struct space
- {
- struct any {};
- struct one_d : any { std::string name() const { return "space::one_d"; }
};
- struct two_d : any { std::string name() const { return "space::two_d"; }
};
- struct three_d : any { std::string name() const { return "space::three_d"; }
};
- struct fixme_ // So FIXME!
- : any { std::string name() const { return "space::fixme_"; } };
- };
+// size: /any/
+// |
+// + -- regular
+// |
+// + -- huge
struct size
{
- struct any {};
+ struct any { protected: any() {} };
struct huge : any { std::string name() const { return "size::huge"; } };
struct regular : any { std::string name() const { return "size::regular"; }
};
};
- struct support
- {
- struct any {};
- struct irregular : any { std::string name() const { return
"support::irregular"; } };
- struct regular : any { std::string name() const { return "support::regular";
} };
- struct aligned
- : regular { std::string name() const { return "support::aligned"; } };
- struct fixme_ // So FIXME!
- : any { std::string name() const { return "support::fixme_"; } };
- };
+// value_access: /any/
+// |
+// + -- direct
+// |
+// + -- computed
+
+ struct value_access
+ {
+ struct any { protected: any() {} };
+ struct direct : any { std::string name() const { return
"value_access::direct"; } };
+ struct computed : any { std::string name() const { return
"value_access::computed"; } };
+ };
+
+
+// value_storage:/any/
+// |
+// + -- /organized/
+// | |
+// | + -- singleton
+// | |
+// | + -- one_block
+// | |
+// | + -- piecewise
+// |
+// + -- disrupted
+
+ struct value_storage
+ {
+ struct any { protected: any() {} };
+ struct organized
+ : any { protected: organized() {} };
+ struct singleton
+ : organized { std::string name() const { return "value_storage::singleton";
} };
+ struct one_block
+ : organized { std::string name() const { return "value_storage::one_block";
} };
+ struct piecewise
+ : organized { std::string name() const { return "value_storage::piecewise";
} };
+ struct disrupted : any { std::string name() const { return
"value_storage::disrupted"; } };
+ };
+
+
+// value_browsing:/any/
+// |
+// + -- site_wise_only
+// |
+// + ------- cell_wise
+// | \
+// + -- value_wise \
+// \ \
+// ---- + -- cell_and_value_wise
+
+ struct value_browsing
+ {
+ struct any { protected: any() {} };
+ struct site_wise_only
+ : any { std::string name() const { return "value_browsing::site_wise_only";
} };
+ struct cell_wise
+ : virtual any { std::string name() const { return
"value_browsing::cell_wise"; } };
+ struct value_wise
+ : virtual any { std::string name() const { return
"value_browsing::value_wise"; } };
+ struct cell_and_value_wise
+ : cell_wise,
+ value_wise
+ { std::string name() const { return "value_browsing::cell_and_value_wise"; }
};
+ };
+
+
+// value_io: /any/
+// |
+// + -- read_only
+// |
+// + -- read_write
- struct border
+ struct value_io
{
- struct any {};
- struct none : any { std::string name() const { return "border::none"; }
};
- struct some : any { std::string name() const { return "border::some"; }
};
- struct stored : some { std::string name() const { return "border::stored"; }
};
- struct computed : some { std::string name() const { return "border::computed";
} };
+ struct any { protected: any() {} };
+ struct read_only
+ : any { std::string name() const { return "value_io::read_only"; } };
+ struct read_write
+ : any { std::string name() const { return "value_io::read_write"; } };
};
- struct neighb
- {
- struct any {};
- struct none : any { std::string name() const { return "neighb::none"; }
};
- struct some : any { std::string name() const { return "neighb::some"; }
};
- };
- struct io
+// localization: /any/
+// |
+// + -- none
+// |
+// + -- space
+// |
+// + -- /grid/
+// |
+// + -- isotropic_grid
+// | |
+// | + -- basic_grid
+// |
+// + -- anisotropic_grid
+
+ struct localization
+ {
+ struct any { protected: any() {} };
+ struct none : any { std::string name() const { return "localization::none"; }
};
+ struct space : any { std::string name() const { return "localization::space";
} };
+ struct grid : space { protected: grid() {} };
+ };
+
+// dimension: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- one_d
+// |
+// + -- two_d
+// |
+// + -- three_d
+
+ struct dimension
+ {
+ struct any { protected: any() {} };
+ struct none : any { std::string name() const { return "dimension::none";
} };
+ struct some
+ : any { protected: some() {} };
+ struct one_d : some { std::string name() const { return "dimension::one_d";
} };
+ struct two_d : some { std::string name() const { return "dimension::two_d";
} };
+ struct three_d : some { std::string name() const { return
"dimension::three_d"; } };
+ };
+
+
+// ext_domain: /any/
+// |
+// + -- none
+// |
+// + -- /some/
+// |
+// + -- fixed
+// | |
+// | + -- infinite
+// |
+// + -- extendable
+
+ struct ext_domain
+ {
+ struct any { protected: any() {} };
+ struct none : any { std::string name() const { return "ext_domain::none";
} };
+ struct some
+ : any { protected: some() {} };
+ struct extendable : some { std::string name() const { return
"ext_domain::extendable"; } };
+ struct fixed : some { std::string name() const { return
"ext_domain::fixed"; } };
+ struct infinite : fixed { std::string name() const { return
"ext_domain::infinite"; } };
+ };
+
+
+// ext_value: /any/
+// |
+// + -- irrelevant
+// |
+// + -- single
+// |
+// + -- multiple
+
+ struct ext_value
+ {
+ struct any { protected: any() {} };
+ struct irrelevant : any { std::string name() const { return
"ext_value::irrelevant"; } };
+ struct single : any { std::string name() const { return
"ext_value::single"; } };
+ struct multiple : any { std::string name() const { return
"ext_value::multiple"; } };
+ };
+
+
+// ext_io: /any/
+// |
+// + -- irrelevant
+// |
+// + -- read_only
+// |
+// + -- read_write
+
+ struct ext_io
{
- struct any {};
- struct read : virtual any {};
- struct write : virtual any {};
+ struct any { protected: any() {} };
struct read_only
- : read { std::string name() const { return "io::read_only"; } };
- struct write_only
- : write { std::string name() const { return "io::write_only"; } };
+ : any { std::string name() const { return "ext_io::read_only"; } };
struct read_write
- : read, write { std::string name() const { return "io::read_write"; } };
+ : any { std::string name() const { return "ext_io::read_write"; } };
};
- struct speed
+
+// kind: /any/
+// |
+// + -- color
+// |
+// + -- gray
+// |
+// + ----------- label
+// | |
+// | +-- named
+// + -- /logic/ |
+// | | |
+// | + -- /mvlogic/
+// | | |
+// | | + -- binary
+// | | |
+// | | + -- ternary
+// | |
+// | + -- fuzzy
+// |
+// + -- data
+// |
+// |
+// + -- /map/
+// |
+// + -- distance
+
+ typedef mln::trait::value::kind kind; // Fetch the 'kind' structure from
value traits.
+
+
+// nature: /any/
+// |
+// + -- scalar
+// |
+// + -- vectorial
+// |
+// + -- structed
+// |
+// + -- pointer
+
+ struct nature
+ {
+ struct any { protected: any() {} };
+ struct scalar : any { std::string name() const { return "nature::scalar"; }
};
+ struct vectorial : any { std::string name() const { return
"nature::vectorial"; } };
+ struct structed : any { std::string name() const { return "nature::structed";
} };
+ struct pointer : any { std::string name() const { return "nature::pointer";
} };
+ };
+
+
+// quant: /any/
+// |
+// + -- low
+// |
+// + -- high
+
+ struct quant
{
- struct any {};
- struct slow : any { std::string name() const { return "speed::slow"; } };
- struct fast : any { std::string name() const { return "speed::fast"; } };
- struct fastest
- : fast { std::string name() const { return "speed::fastest"; } };
+ struct any { protected: any() {} };
+ struct low : any { std::string name() const { return "quant::low"; } };
+ struct high : any { std::string name() const { return "quant::high"; } };
};
Index: mln/trait/image/print.hh
--- mln/trait/image/print.hh (revision 2009)
+++ mln/trait/image/print.hh (working copy)
@@ -68,18 +68,21 @@
mlc_is_a(I, Image)::check();
typedef mln::trait::image_<I> the;
ostr << "{ "
- << typename the::category().name() << ", "
- << typename the::data() .name() << ", "
- << typename the::kind() .name() << ", "
- << typename the::quant() .name() << ", "
- << typename the::value() .name() << ", "
- << typename the::access() .name() << ", "
- << typename the::space() .name() << ", "
- << typename the::size() .name() << ", "
- << typename the::support() .name() << ", "
- << typename the::border() .name() << ", "
- << typename the::io() .name() << ", "
- << typename the::speed() .name() << " }" <<
std::endl;
+ << typename the::category.name() << ", "
+ << typename the::speed.name() << ", "
+ << typename the::size.name() << ", "
+ << typename the::value_access.name() << ", "
+ << typename the::value_storage.name() << ", "
+ << typename the::value_browsing.name() << ", "
+ << typename the::value_io.name() << ", "
+ << typename the::localization.name() << ", "
+ << typename the::dimension.name() << ", "
+ << typename the::ext_domain.name() << ", "
+ << typename the::ext_value.name() << ", "
+ << typename the::ext_io.name() << ", "
+ << typename the::kind.name() << ", "
+ << typename the::nature.name() << ", "
+ << typename the::quant.name() << " }" << std::endl;
}
template <typename I>
Index: mln/trait/images.hh
--- mln/trait/images.hh (revision 2009)
+++ mln/trait/images.hh (working copy)
@@ -47,6 +47,21 @@
# include <mln/metal/if.hh>
# include <mln/metal/is_const.hh>
+// category
+// speed
+// size
+// value_access
+// value_storage
+// value_browsing
+// value_io
+// localization
+// dimension
+// ext_domain
+// ext_value
+// ext_io
+// kind
+// nature
+// quant
# define mln_trait_image_category(I) typename mln::trait::image_< I >::category
@@ -107,28 +122,30 @@
template <typename I>
struct undefined_image_
{
- typedef undef category; // primary, domain_morpher, value_morpher,
- // or identity_morpher < morpher
-
- // related to I::value
- typedef undef kind; // color, gray, binary < logic < label, data
- typedef undef quant; // low or high
- typedef undef value; // scalar, vectorial, structed, pointer
- // FIXME: Make the difference between homogeneous and heterogeneous vectors...
-
- // related to I::pset
- typedef undef access; // random, browsing
- // FIXME: Wouldn't it be nicer to use metal::int_<DIM>?
- typedef undef space; // one_d, two_d, three_d
- typedef undef size; // huge or regular
- typedef undef support; // irregular, aligned < regular
-
- // global
- typedef undef border; // none, { stored, computed } < some
- typedef undef neighb; // none, some
- typedef undef data; // raw < linear < stored, computed
- typedef undef io; // read_only < read, write_only < write, read_write
< both read'n write
- typedef undef speed; // slow, fast, or fastest
+ // misc
+ typedef undef category;
+ typedef undef speed;
+ typedef undef size;
+
+ // value
+ typedef undef value_access;
+ typedef undef value_storage;
+ typedef undef value_browsing;
+ typedef undef value_io;
+
+ // site
+ typedef undef localization;
+ typedef undef dimension;
+
+ // extended domain
+ typedef undef ext_domain;
+ typedef undef ext_value;
+ typedef undef ext_io;
+
+ // data (I::value)
+ typedef undef kind;
+ typedef undef nature;
+ typedef undef quant;
};
@@ -160,31 +177,34 @@
// speed is fast by default (neither "fastest" nor "slow")
typedef trait::image::speed::fast speed;
-
- // neighb is absent by default.
- typedef trait::image::neighb::none neighb;
};
template <typename D, typename T, typename I>
struct default_image_morpher_ : default_image_<T, I>
{
- // value-related => delegation
+ // misc => NO delegation
+ // for category, speed, and size
+
+ // value => delegation
+ typedef typename image_<D>::value_access value_access;
+ typedef typename image_<D>::value_storage value_storage;
+ typedef typename image_<D>::value_browsing value_browsing;
+ typedef typename image_<D>::value_io value_io;
+
+ // site => delegation
+ typedef typename image_<D>::localization localization;
+ typedef typename image_<D>::dimension dimension;
+
+ // extended domain => delegation
+ typedef typename image_<D>::ext_domain ext_domain;
+ typedef typename image_<D>::ext_value ext_value;
+ typedef typename image_<D>::ext_io ext_io;
+
+ // data (I::value) => delegation
+ typedef typename image_<D>::nature nature;
typedef typename image_<D>::kind kind;
typedef typename image_<D>::quant quant;
- typedef typename image_<D>::value value;
-
- // domain-related => delegation
- typedef typename image_<D>::access access;
- typedef typename image_<D>::space space;
- typedef typename image_<D>::size size;
- typedef typename image_<D>::support support;
-
- // mostly global-related => delegation
- typedef typename image_<D>::border border;
- typedef typename image_<D>::neighb neighb;
- typedef typename image_<D>::data data;
- typedef typename image_<D>::io io;
};