Milena (Olena)  User documentation 2.0a Id
 All Classes Namespaces Functions Variables Typedefs Enumerator Groups Pages
image/props.hh
1 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2 //
3 // This file is part of Olena.
4 //
5 // Olena is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation, version 2 of the License.
8 //
9 // Olena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // As a special exception, you may use this file as part of a free
18 // software project without restriction. Specifically, if other files
19 // instantiate templates or use macros or inline functions from this
20 // file, or you compile this file and link it with other files to produce
21 // an executable, this file does not by itself cause the resulting
22 // executable to be covered by the GNU General Public License. This
23 // exception does not however invalidate any other reasons why the
24 // executable file might be covered by the GNU General Public License.
25 
26 #ifndef MLN_TRAIT_IMAGE_PROPS_HH
27 # define MLN_TRAIT_IMAGE_PROPS_HH
28 
36 # include <string>
37 # include <mln/trait/undef.hh>
38 # include <mln/trait/value/kind.hh>
39 
40 # include <mln/core/def/coord.hh> // Move along with space_from_point...
41 
42 
43 
44 // Properties of images.
45 // =====================
46 
47 // * misc
48 
49 // category: /any/
50 // |
51 // + -- primary
52 // |
53 // + -- /morpher/
54 // |
55 // + -- domain_morpher
56 // |
57 // + -- value_morpher
58 // |
59 // + -- identity_morpher
60 //
61 // Interface related to the category property:
62 // morpher
63 // => .delegatee_(): returns a pointer on the reference image.
64 // => .unmorph() : returns the reference image.
65 // => .rw() : States that the morpher is writable.
66 
67 
68 
69 
70 
71 // * value access
72 
73 // pw_io: /any/
74 // |
75 // +-- read
76 // |
77 // +-- read_write
78 //
79 // Interface related to the pw_io property
80 // read_write
81 // => .operator(p : psite) : lvalue, writes access to the value localized at
82 // p.
83 
84 // speed: /any/
85 // |
86 // + -- slow
87 // |
88 // + -- fast
89 // |
90 // + -- fastest
91 //
92 // Note that:
93 // fastest value implies value_storage::oneblock and ext_domain::some
94 
95 // vw_io: /any/
96 // |
97 // +-- read
98 // |
99 // +-- read_write
100 
101 // vw_set: /any/
102 // |
103 // +-- /some/
104 // | |
105 // | +-- uni
106 // | |
107 // | +-- multi
108 // |
109 // +-- none
110 //
111 // Interface related to vw_io and vw_set properties
112 // multi and vw_io::read
113 // => .cells_() : const vset, returns the image cell lists.
114 // multi and vw_io::read_write
115 // => .cells_() : vset, returns the image cell lists.
116 // uni and vw_io::read
117 // => .values_taken_() : const vset, returns the value_taken set.
118 // => .cells_(): const vset, same as .values_taken_().
119 // uni (and vw_io::read_write)
120 // => .values_taken() : vset, returns the value_taken set.
121 // => .cells_() : vset, same as .values_taken_().
122 
123 
124 
125 
126 
127 // * organization in memory
128 
129 // value_access: /any/
130 // |
131 // +-- direct
132 // |
133 // +-- indirect
134 // |
135 // +-- computed
136 
137 // value_storage:/any/
138 // |
139 // + -- /organized/
140 // | |
141 // | + -- singleton
142 // | |
143 // | + -- one_block
144 // | |
145 // | + -- piecewise
146 // |
147 // + -- disrupted
148 //
149 // Interface related to the value_storage and value_access properties
150 // singleton and value_access::direct
151 // => .value_() : lvalue, returns the flat value
152 // => .value_() : rvalue, returns the flat value
153 // one_block
154 // => .nelements_() : unsigned, number of buffer elements
155 // => .point_at_index_(unsigned index) : point,
156 // point corresponding to the index index
157 // => .delta_index_(deltapoint dp) : unsigned
158 // Return the delta index associated to dp
159 // one_block and value_access::direct
160 // => element_(unsigned index) : rvalue, returns the element at index.
161 // => element_(unsigned index) : lvalue, returns the element at index.
162 // => buffer_() : const value*: Give a hook to the value buffer
163 // => buffer_() : value*: Give a hook to the value buffer
164 // piecewise
165 // => npieces_() const : unsigned, returns the number of memory pieces
166 // piecewise and value_access::direct
167 // => piece_size_(i) : unsigned, returns the size of piece memory i
168 // => piece_(i) : value*: Give a hook to the i memory piece
169 // => piece_(i) : const value*: Give a hook to the i memory piece
170 
171 // size: /any/
172 // |
173 // + -- regular
174 // |
175 // + -- huge
176 
177 
178 
179 
180 
181 
182 // * image geometry
183 
184 // value_alignment:/any/
185 // |
186 // +-- with_grid
187 // |
188 // +-- not_aligned
189 // |
190 // +-- irrelevant
191 
192 // localization: /any/
193 // |
194 // + -- none
195 // |
196 // + -- space
197 // |
198 // + -- /grid/
199 // |
200 // + -- isotropic_grid
201 // | |
202 // | + -- basic_grid
203 // |
204 // + -- anisotropic_grid
205 
206 // dimension: /any/
207 // |
208 // + -- none
209 // |
210 // + -- /some/
211 // |
212 // + -- one_d
213 // |
214 // + -- two_d
215 // |
216 // + -- three_d
217 //
218 // Interface related to the dimension and pw_iw properties
219 // one_d
220 // => .at_(unsigned index) : rvalue
221 // one_d and pw_io::read_write
222 // => .at_(unsigned index) : lvalue
223 // two_d
224 // => .at_(unsigned row, unsigned col) : rvalue
225 // two_d and pw_io::read_write
226 // => .at_(unsigned row, unsigned col) : lvalue
227 // three_d
228 // => .at_(unsigned slice, unsigned row, unsigned col) : rvalue
229 // three_d and pw_io::read_write
230 // => .at_(unsigned slice, unsigned row, unsigned col) : lvalue
231 
232 
233 
234 
235 
236 // * extended domain
237 
238 // ext_domain: /any/
239 // |
240 // + -- none
241 // |
242 // + -- /some/
243 // |
244 // + -- fixed
245 // | |
246 // | + -- infinite
247 // |
248 // + -- extendable
249 // Interface related to the border property:
250 // some
251 // => .border_() : unsigned, returns the border thickness.
252 
253 // ext_io: /any/
254 // |
255 // + -- irrelevant
256 // |
257 // + -- read_only
258 // |
259 // + -- read_write
260 
261 // ext_value: /any/
262 // |
263 // + -- irrelevant
264 // |
265 // + -- single
266 // |
267 // + -- multiple
268 // Interface related to ext_io and ext_value properties:
269 // single
270 // => extension() : const mln_value(I)&
271 // single and ext_io::read_write
272 // => extension() : const mln_value(I)&
273 // => extension() : mln_value(I)&
274 
275 
276 
277 
278 
279 // * data (related to I::value)
280 
281 // kind: /any/
282 // |
283 // + -- color
284 // |
285 // + -- gray
286 // |
287 // + ----------- label
288 // | |
289 // | +-- named
290 // + -- /logic/ |
291 // | | |
292 // | + -- /mvlogic/
293 // | | |
294 // | | + -- binary
295 // | | |
296 // | | + -- ternary
297 // | |
298 // | + -- fuzzy
299 // |
300 // + -- data
301 // |
302 // |
303 // + -- /map/
304 // |
305 // + -- distance
306 
307 // nature: /any/
308 // |
309 // + -- scalar
310 // |
311 // + -- vectorial
312 // |
313 // + -- structed
314 // |
315 // + -- pointer
316 
317 // quant: /any/
318 // |
319 // + -- low
320 // |
321 // + -- high
322 
323 
324 
325 
326 
327 
328 // DEPRECATED
329 // value_browsing:/any/
330 // |
331 // + -- site_wise_only
332 // |
333 // + -------- cell_wise
334 // | |
335 // + -- value_wise |
336 // \ |
337 // -- + -- cell_and_value_wise
338 
339 // DEPRECATED
340 // value_io: /any/
341 // |
342 // + -- read_only
343 // |
344 // + -- read_write
345 
346 
347 namespace mln
348 {
349 
350  namespace trait
351  {
352 
353  namespace image
354  {
355 
356 // category: /any/
357 // |
358 // + -- primary
359 // |
360 // + -- /morpher/
361 // |
362 // + -- domain_morpher
363 // |
364 // + -- value_morpher
365 // |
366 // + -- identity_morpher
367 
368  struct category
369  {
370  struct any { protected: any() {} };
371  struct primary : any { std::string name() const { return "category::primary"; } };
372  struct morpher : any { protected: morpher() {} };
373  struct domain_morpher
374  : morpher { std::string name() const { return "category::domain_morpher"; } };
375  struct value_morpher
376  : morpher { std::string name() const { return "category::value_morpher"; } };
377  struct identity_morpher
378  : morpher { std::string name() const { return "category::identity_morpher"; } };
379  };
380 
381 
382 // speed: /any/
383 // |
384 // + -- slow
385 // |
386 // + -- fast
387 // |
388 // + -- fastest
389 
390  struct speed
391  {
392  struct any { protected: any() {} };
393  struct slow : any { std::string name() const { return "speed::slow"; } };
394  struct fast : any { std::string name() const { return "speed::fast"; } };
395  struct fastest
396  : fast { std::string name() const { return "speed::fastest"; } };
397  };
398 
399 
400 // size: /any/
401 // |
402 // + -- regular
403 // |
404 // + -- huge
405 
406  struct size
407  {
408  struct any { protected: any() {} };
409  struct huge : any { std::string name() const { return "size::huge"; } };
410  struct regular : any { std::string name() const { return "size::regular"; } };
411  };
412 
413 
414 // value_access: /any/
415 // |
416 // +-- direct
417 // |
418 // +-- indirect
419 // |
420 // +-- computed
421 
422  struct value_access
423  {
424  struct any { protected: any() {} };
425  struct direct : any { std::string name() const { return "value_access::direct"; } };
426  struct indirect : any { std::string name() const { return "value_access::indirect"; } };
427  struct computed : any { std::string name() const { return "value_access::computed"; } };
428  };
429 
430 
431 
432 
433 // value_storage:/any/
434 // |
435 // + -- /organized/
436 // | |
437 // | + -- singleton
438 // | |
439 // | + -- one_block
440 // | |
441 // | + -- piecewise
442 // |
443 // + -- disrupted
444 
445  struct value_storage
446  {
447  struct any { protected: any() {} };
448  struct organized
449  : any { protected: organized() {} };
450  struct singleton
451  : organized { std::string name() const { return "value_storage::singleton"; } };
452  struct one_block
453  : organized { std::string name() const { return "value_storage::one_block"; } };
454  struct piecewise
455  : organized { std::string name() const { return "value_storage::piecewise"; } };
456  struct disrupted : any { std::string name() const { return "value_storage::disrupted"; } };
457  };
458 
459 // value_alignment:/any/
460 // |
461 // +-- with_grid
462 // |
463 // +-- not_aligned
464 // |
465 // +-- irrelevant
466  struct value_alignment
467  {
468  struct any { protected: any() {} };
469  struct with_grid
470  : any { std::string name() const { return "value_alignment::with_grid"; } };
471  struct not_aligned
472  : any { std::string name() const { return "value_alignment::not_aligned"; } };
473  struct irrelevant
474  : any { std::string name() const { return "value_alignment::irrelevant"; } };
475  };
476 
477 // pw_io: /any/
478 // |
479 // +-- read
480 // |
481 // +-- read_write
482 
483  struct pw_io
484  {
485  struct any { protected: any() {} };
486  struct read
487  : any { std::string name() const { return "pw_io::read"; } };
488  struct read_write
489  : any { std::string name() const { return "pw_io::read_write"; } };
490  };
491 
492 // vw_io: /any/
493 // |
494 // +-- read
495 // |
496 // +-- read_write
497 
498  struct vw_io
499  {
500  struct any { protected: any() {} };
501  struct some : any { protected: some() {} };
502  struct read
503  : some { std::string name() const { return "vw_io::read"; } };
504  struct read_write
505  : some { std::string name() const { return "vw_io::read_write"; } };
506  struct none
507  : any { std::string name() const { return "vw_io::none"; } };
508  };
509 
510 // vw_set: /any/
511 // |
512 // +-- /some/
513 // | |
514 // | +-- uni
515 // | |
516 // | +-- multi
517 // |
518 // +-- none
519 
520  struct vw_set
521  {
522  struct any { protected: any() {} };
523  struct some : any { protected: some() {} };
524  struct none
525  : any { std::string name() const { return "vw_set::none";} };
526  struct uni
527  : some { std::string name() const { return "vw_set::uni";} };
528  struct multi
529  : some { std::string name() const { return "vw_set::multi";} };
530  };
531 
532 
533 // DEPRECATED PROPERTY
534 // value_browsing:/any/
535 // |
536 // + -- site_wise_only
537 // |
538 // + -------- cell_wise
539 // | |
540 // + -- value_wise |
541 // \ |
542 // -- + -- cell_and_value_wise
543 
544  struct value_browsing
545  {
546  struct any { protected: any() {} };
547  struct site_wise_only
548  : any { std::string name() const { return "value_browsing::site_wise_only"; } };
549  struct cell_wise
550  : virtual any { std::string name() const { return "value_browsing::cell_wise"; } };
551  struct value_wise
552  : virtual any { std::string name() const { return "value_browsing::value_wise"; } };
553  struct cell_and_value_wise
554  : cell_wise,
555  value_wise
556  { std::string name() const { return "value_browsing::cell_and_value_wise"; } };
557  };
558 
559 
560 // DEPRECATED PROPERTY
561 // value_io: /any/
562 // |
563 // + -- read_only
564 // |
565 // + -- read_write
566 
567  struct value_io
568  {
569  struct any { protected: any() {} };
570  struct read_only
571  : any { std::string name() const { return "value_io::read_only"; } };
572  struct read_write
573  : any { std::string name() const { return "value_io::read_write"; } };
574  };
575 
576 
577 // localization: /any/
578 // |
579 // + -- none
580 // |
581 // + -- space
582 // |
583 // + -- /grid/
584 // |
585 // + -- isotropic_grid
586 // | |
587 // | + -- basic_grid
588 // |
589 // + -- anisotropic_grid
590 
591  struct localization
592  {
593  struct any { protected: any() {} };
594  struct none : any { std::string name() const { return "localization::none"; } };
595  struct space : any { std::string name() const { return "localization::space"; } };
596  struct grid : space { protected: grid() {} };
597  struct isotropic_grid
598  : grid { std::string name() const { return "localization::isotropic_grid"; } };
599  struct basic_grid
600  : isotropic_grid { std::string name() const { return "localization::basic_grid"; } };
601  struct anisotropic_grid
602  : grid { std::string name() const { return "localization::anisotropic_grid"; } };
603  };
604 
605 
606 // dimension: /any/
607 // |
608 // + -- none
609 // |
610 // + -- /some/
611 // |
612 // + -- one_d
613 // |
614 // + -- two_d
615 // |
616 // + -- three_d
617 
618  struct dimension
619  {
620  struct any { protected: any() {} };
621  struct none : any { std::string name() const { return "dimension::none"; } };
622  struct some
623  : any { protected: some() {} };
624  struct one_d : some { std::string name() const { return "dimension::one_d"; } };
625  struct two_d : some { std::string name() const { return "dimension::two_d"; } };
626  struct three_d : some { std::string name() const { return "dimension::three_d"; } };
627  };
628 
629 
630 // ext_domain: /any/
631 // |
632 // + -- none
633 // |
634 // + -- /some/
635 // |
636 // + -- fixed
637 // | |
638 // | + -- infinite
639 // |
640 // + -- extendable
641 
642  struct ext_domain
643  {
644  struct any { protected: any() {} };
645  struct none : any { std::string name() const { return "ext_domain::none"; } };
646  struct some
647  : any { protected: some() {} };
648  struct extendable : some { std::string name() const { return "ext_domain::extendable"; } };
649  struct fixed : some { std::string name() const { return "ext_domain::fixed"; } };
650  struct infinite : fixed { std::string name() const { return "ext_domain::infinite"; } };
651  };
652 
653 
654 // ext_value: /any/
655 // |
656 // + -- irrelevant
657 // |
658 // + -- single
659 // |
660 // + -- multiple
661 
662  struct ext_value
663  {
664  struct any { protected: any() {} };
665  struct irrelevant : any { std::string name() const { return "ext_value::irrelevant"; } };
666  struct single : any { std::string name() const { return "ext_value::single"; } };
667  struct multiple : any { std::string name() const { return "ext_value::multiple"; } };
668  };
669 
670 
671 // ext_io: /any/
672 // |
673 // + -- irrelevant
674 // |
675 // + -- read_only
676 // |
677 // + -- read_write
678 
679  struct ext_io
680  {
681  struct any { protected: any() {} };
682  struct irrelevant
683  : any { std::string name() const { return "ext_io::irrelevant"; } };
684  struct read_only
685  : any { std::string name() const { return "ext_io::read_only"; } };
686  struct read_write
687  : any { std::string name() const { return "ext_io::read_write"; } };
688  };
689 
690 
691 // kind: /any/
692 // |
693 // + -- color
694 // |
695 // + -- gray
696 // |
697 // + ----------- label
698 // | |
699 // | +-- named
700 // + -- /logic/ |
701 // | | |
702 // | + -- /mvlogic/
703 // | | |
704 // | | + -- binary
705 // | | |
706 // | | + -- ternary
707 // | |
708 // | + -- fuzzy
709 // |
710 // + -- data
711 // |
712 // |
713 // + -- /map/
714 // |
715 // + -- distance
716 
717  typedef mln::trait::value::kind kind; // Fetch the 'kind' structure from value traits.
718 
719 
720 // nature: /any/
721 // |
722 // + -- scalar
723 // |
724 // + -- vectorial
725 // |
726 // + -- structed
727 // |
728 // + -- pointer
729 
730  struct nature
731  {
732  struct any { protected: any() {} };
733  struct scalar : any { std::string name() const { return "nature::scalar"; } };
734  struct vectorial : any { std::string name() const { return "nature::vectorial"; } };
735  struct structed : any { std::string name() const { return "nature::structed"; } };
736  struct pointer : any { std::string name() const { return "nature::pointer"; } };
737  };
738 
739 
740 // quant: /any/
741 // |
742 // + -- low
743 // |
744 // + -- high
745 
746  struct quant
747  {
748  struct any { protected: any() {} };
749  struct low : any { std::string name() const { return "quant::low"; } };
750  struct high : any { std::string name() const { return "quant::high"; } };
751  };
752 
753 
754  } // end of namespace mln::trait::image
755 
756  } // end of namespace mln::trait
757 
758 
759 
760  // FIXME: To be moved elsewhere?
761 
764 
765  // Fwd decl. (used by trait::image::space_from_point).
766  namespace grid
767  {
768  struct tick;
769  struct square;
770  struct hexa;
771  struct cube;
772  }
773 
774  template <typename M, typename C> struct point;
775  typedef point<grid::tick, def::coord> point1d;
776  typedef point<grid::square, def::coord> point2d;
777  typedef point<grid::hexa, def::coord> point2d_h;
778  typedef point<grid::cube, def::coord> point3d;
779 
780  namespace trait
781  {
782  namespace image
783  {
784 
787  template <typename P>
788  struct space_from_point
789  { typedef undef ret; };
790 
791  template <>
792  struct space_from_point<point1d>
793  { typedef trait::image::dimension::one_d ret; };
794 
795  template <>
796  struct space_from_point<point2d>
797  { typedef trait::image::dimension::two_d ret; };
798 
799  template <>
800  struct space_from_point<point3d>
801  { typedef trait::image::dimension::three_d ret; };
803 
804  } // end of namespace mln::trait::image
805 
806  } // end of namespace mln::trait
807 
808 } // end of namespace mln
809 
810 
811 #endif // ! MLN_TRAIT_IMAGE_PROPS_HH