Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) 00002 // 00003 // This file is part of Olena. 00004 // 00005 // Olena is free software: you can redistribute it and/or modify it under 00006 // the terms of the GNU General Public License as published by the Free 00007 // Software Foundation, version 2 of the License. 00008 // 00009 // Olena is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // As a special exception, you may use this file as part of a free 00018 // software project without restriction. Specifically, if other files 00019 // instantiate templates or use macros or inline functions from this 00020 // file, or you compile this file and link it with other files to produce 00021 // an executable, this file does not by itself cause the resulting 00022 // executable to be covered by the GNU General Public License. This 00023 // exception does not however invalidate any other reasons why the 00024 // executable file might be covered by the GNU General Public License. 00025 00026 #ifndef MLN_TRAIT_IMAGE_PROPS_HH 00027 # define MLN_TRAIT_IMAGE_PROPS_HH 00028 00036 # include <string> 00037 # include <mln/trait/undef.hh> 00038 # include <mln/trait/value/kind.hh> 00039 00040 # include <mln/core/def/coord.hh> // Move along with space_from_point... 00041 00042 00043 00044 // Properties of images. 00045 // ===================== 00046 00047 // * misc 00048 00049 // category: /any/ 00050 // | 00051 // + -- primary 00052 // | 00053 // + -- /morpher/ 00054 // | 00055 // + -- domain_morpher 00056 // | 00057 // + -- value_morpher 00058 // | 00059 // + -- identity_morpher 00060 // 00061 // Interface related to the category property: 00062 // morpher 00063 // => .delegatee_(): returns a pointer on the reference image. 00064 // => .unmorph() : returns the reference image. 00065 // => .rw() : States that the morpher is writable. 00066 00067 00068 00069 00070 00071 // * value access 00072 00073 // pw_io: /any/ 00074 // | 00075 // +-- read 00076 // | 00077 // +-- read_write 00078 // 00079 // Interface related to the pw_io property 00080 // read_write 00081 // => .operator(p : psite) : lvalue, writes access to the value localized at 00082 // p. 00083 00084 // speed: /any/ 00085 // | 00086 // + -- slow 00087 // | 00088 // + -- fast 00089 // | 00090 // + -- fastest 00091 // 00092 // Note that: 00093 // fastest value implies value_storage::oneblock and ext_domain::some 00094 00095 // vw_io: /any/ 00096 // | 00097 // +-- read 00098 // | 00099 // +-- read_write 00100 00101 // vw_set: /any/ 00102 // | 00103 // +-- /some/ 00104 // | | 00105 // | +-- uni 00106 // | | 00107 // | +-- multi 00108 // | 00109 // +-- none 00110 // 00111 // Interface related to vw_io and vw_set properties 00112 // multi and vw_io::read 00113 // => .cells_() : const vset, returns the image cell lists. 00114 // multi and vw_io::read_write 00115 // => .cells_() : vset, returns the image cell lists. 00116 // uni and vw_io::read 00117 // => .values_taken_() : const vset, returns the value_taken set. 00118 // => .cells_(): const vset, same as .values_taken_(). 00119 // uni (and vw_io::read_write) 00120 // => .values_taken() : vset, returns the value_taken set. 00121 // => .cells_() : vset, same as .values_taken_(). 00122 00123 00124 00125 00126 00127 // * organization in memory 00128 00129 // value_access: /any/ 00130 // | 00131 // +-- direct 00132 // | 00133 // +-- indirect 00134 // | 00135 // +-- computed 00136 00137 // value_storage:/any/ 00138 // | 00139 // + -- /organized/ 00140 // | | 00141 // | + -- singleton 00142 // | | 00143 // | + -- one_block 00144 // | | 00145 // | + -- piecewise 00146 // | 00147 // + -- disrupted 00148 // 00149 // Interface related to the value_storage and value_access properties 00150 // singleton and value_access::direct 00151 // => .value_() : lvalue, returns the flat value 00152 // => .value_() : rvalue, returns the flat value 00153 // one_block 00154 // => .nelements_() : unsigned, number of buffer elements 00155 // => .point_at_index_(unsigned index) : point, 00156 // point corresponding to the index index 00157 // => .delta_index_(deltapoint dp) : unsigned 00158 // Return the delta index associated to dp 00159 // one_block and value_access::direct 00160 // => element_(unsigned index) : rvalue, returns the element at index. 00161 // => element_(unsigned index) : lvalue, returns the element at index. 00162 // => buffer_() : const value*: Give a hook to the value buffer 00163 // => buffer_() : value*: Give a hook to the value buffer 00164 // piecewise 00165 // => npieces_() const : unsigned, returns the number of memory pieces 00166 // piecewise and value_access::direct 00167 // => piece_size_(i) : unsigned, returns the size of piece memory i 00168 // => piece_(i) : value*: Give a hook to the i memory piece 00169 // => piece_(i) : const value*: Give a hook to the i memory piece 00170 00171 // size: /any/ 00172 // | 00173 // + -- regular 00174 // | 00175 // + -- huge 00176 00177 00178 00179 00180 00181 00182 // * image geometry 00183 00184 // value_alignment:/any/ 00185 // | 00186 // +-- with_grid 00187 // | 00188 // +-- not_aligned 00189 // | 00190 // +-- irrelevant 00191 00192 // localization: /any/ 00193 // | 00194 // + -- none 00195 // | 00196 // + -- space 00197 // | 00198 // + -- /grid/ 00199 // | 00200 // + -- isotropic_grid 00201 // | | 00202 // | + -- basic_grid 00203 // | 00204 // + -- anisotropic_grid 00205 00206 // dimension: /any/ 00207 // | 00208 // + -- none 00209 // | 00210 // + -- /some/ 00211 // | 00212 // + -- one_d 00213 // | 00214 // + -- two_d 00215 // | 00216 // + -- three_d 00217 // 00218 // Interface related to the dimension and pw_iw properties 00219 // one_d 00220 // => .at_(unsigned index) : rvalue 00221 // one_d and pw_io::read_write 00222 // => .at_(unsigned index) : lvalue 00223 // two_d 00224 // => .at_(unsigned row, unsigned col) : rvalue 00225 // two_d and pw_io::read_write 00226 // => .at_(unsigned row, unsigned col) : lvalue 00227 // three_d 00228 // => .at_(unsigned slice, unsigned row, unsigned col) : rvalue 00229 // three_d and pw_io::read_write 00230 // => .at_(unsigned slice, unsigned row, unsigned col) : lvalue 00231 00232 00233 00234 00235 00236 // * extended domain 00237 00238 // ext_domain: /any/ 00239 // | 00240 // + -- none 00241 // | 00242 // + -- /some/ 00243 // | 00244 // + -- fixed 00245 // | | 00246 // | + -- infinite 00247 // | 00248 // + -- extendable 00249 // Interface related to the border property: 00250 // some 00251 // => .border_() : unsigned, returns the border thickness. 00252 00253 // ext_io: /any/ 00254 // | 00255 // + -- irrelevant 00256 // | 00257 // + -- read_only 00258 // | 00259 // + -- read_write 00260 00261 // ext_value: /any/ 00262 // | 00263 // + -- irrelevant 00264 // | 00265 // + -- single 00266 // | 00267 // + -- multiple 00268 // Interface related to ext_io and ext_value properties: 00269 // single 00270 // => extension() : const mln_value(I)& 00271 // single and ext_io::read_write 00272 // => extension() : const mln_value(I)& 00273 // => extension() : mln_value(I)& 00274 00275 00276 00277 00278 00279 // * data (related to I::value) 00280 00281 // kind: /any/ 00282 // | 00283 // + -- color 00284 // | 00285 // + -- gray 00286 // | 00287 // + ----------- label 00288 // | | 00289 // | +-- named 00290 // + -- /logic/ | 00291 // | | | 00292 // | + -- /mvlogic/ 00293 // | | | 00294 // | | + -- binary 00295 // | | | 00296 // | | + -- ternary 00297 // | | 00298 // | + -- fuzzy 00299 // | 00300 // + -- data 00301 // | 00302 // | 00303 // + -- /map/ 00304 // | 00305 // + -- distance 00306 00307 // nature: /any/ 00308 // | 00309 // + -- scalar 00310 // | 00311 // + -- vectorial 00312 // | 00313 // + -- structed 00314 // | 00315 // + -- pointer 00316 00317 // quant: /any/ 00318 // | 00319 // + -- low 00320 // | 00321 // + -- high 00322 00323 00324 00325 00326 00327 00328 // DEPRECATED 00329 // value_browsing:/any/ 00330 // | 00331 // + -- site_wise_only 00332 // | 00333 // + -------- cell_wise 00334 // | | 00335 // + -- value_wise | 00336 // \ | 00337 // -- + -- cell_and_value_wise 00338 00339 // DEPRECATED 00340 // value_io: /any/ 00341 // | 00342 // + -- read_only 00343 // | 00344 // + -- read_write 00345 00346 00347 namespace mln 00348 { 00349 00350 namespace trait 00351 { 00352 00353 namespace image 00354 { 00355 00356 // category: /any/ 00357 // | 00358 // + -- primary 00359 // | 00360 // + -- /morpher/ 00361 // | 00362 // + -- domain_morpher 00363 // | 00364 // + -- value_morpher 00365 // | 00366 // + -- identity_morpher 00367 00368 struct category 00369 { 00370 struct any { protected: any() {} }; 00371 struct primary : any { std::string name() const { return "category::primary"; } }; 00372 struct morpher : any { protected: morpher() {} }; 00373 struct domain_morpher 00374 : morpher { std::string name() const { return "category::domain_morpher"; } }; 00375 struct value_morpher 00376 : morpher { std::string name() const { return "category::value_morpher"; } }; 00377 struct identity_morpher 00378 : morpher { std::string name() const { return "category::identity_morpher"; } }; 00379 }; 00380 00381 00382 // speed: /any/ 00383 // | 00384 // + -- slow 00385 // | 00386 // + -- fast 00387 // | 00388 // + -- fastest 00389 00390 struct speed 00391 { 00392 struct any { protected: any() {} }; 00393 struct slow : any { std::string name() const { return "speed::slow"; } }; 00394 struct fast : any { std::string name() const { return "speed::fast"; } }; 00395 struct fastest 00396 : fast { std::string name() const { return "speed::fastest"; } }; 00397 }; 00398 00399 00400 // size: /any/ 00401 // | 00402 // + -- regular 00403 // | 00404 // + -- huge 00405 00406 struct size 00407 { 00408 struct any { protected: any() {} }; 00409 struct huge : any { std::string name() const { return "size::huge"; } }; 00410 struct regular : any { std::string name() const { return "size::regular"; } }; 00411 }; 00412 00413 00414 // value_access: /any/ 00415 // | 00416 // +-- direct 00417 // | 00418 // +-- indirect 00419 // | 00420 // +-- computed 00421 00422 struct value_access 00423 { 00424 struct any { protected: any() {} }; 00425 struct direct : any { std::string name() const { return "value_access::direct"; } }; 00426 struct indirect : any { std::string name() const { return "value_access::indirect"; } }; 00427 struct computed : any { std::string name() const { return "value_access::computed"; } }; 00428 }; 00429 00430 00431 00432 00433 // value_storage:/any/ 00434 // | 00435 // + -- /organized/ 00436 // | | 00437 // | + -- singleton 00438 // | | 00439 // | + -- one_block 00440 // | | 00441 // | + -- piecewise 00442 // | 00443 // + -- disrupted 00444 00445 struct value_storage 00446 { 00447 struct any { protected: any() {} }; 00448 struct organized 00449 : any { protected: organized() {} }; 00450 struct singleton 00451 : organized { std::string name() const { return "value_storage::singleton"; } }; 00452 struct one_block 00453 : organized { std::string name() const { return "value_storage::one_block"; } }; 00454 struct piecewise 00455 : organized { std::string name() const { return "value_storage::piecewise"; } }; 00456 struct disrupted : any { std::string name() const { return "value_storage::disrupted"; } }; 00457 }; 00458 00459 // value_alignment:/any/ 00460 // | 00461 // +-- with_grid 00462 // | 00463 // +-- not_aligned 00464 // | 00465 // +-- irrelevant 00466 struct value_alignment 00467 { 00468 struct any { protected: any() {} }; 00469 struct with_grid 00470 : any { std::string name() const { return "value_alignment::with_grid"; } }; 00471 struct not_aligned 00472 : any { std::string name() const { return "value_alignment::not_aligned"; } }; 00473 struct irrelevant 00474 : any { std::string name() const { return "value_alignment::irrelevant"; } }; 00475 }; 00476 00477 // pw_io: /any/ 00478 // | 00479 // +-- read 00480 // | 00481 // +-- read_write 00482 00483 struct pw_io 00484 { 00485 struct any { protected: any() {} }; 00486 struct read 00487 : any { std::string name() const { return "pw_io::read"; } }; 00488 struct read_write 00489 : any { std::string name() const { return "pw_io::read_write"; } }; 00490 }; 00491 00492 // vw_io: /any/ 00493 // | 00494 // +-- read 00495 // | 00496 // +-- read_write 00497 00498 struct vw_io 00499 { 00500 struct any { protected: any() {} }; 00501 struct some : any { protected: some() {} }; 00502 struct read 00503 : some { std::string name() const { return "vw_io::read"; } }; 00504 struct read_write 00505 : some { std::string name() const { return "vw_io::read_write"; } }; 00506 struct none 00507 : any { std::string name() const { return "vw_io::none"; } }; 00508 }; 00509 00510 // vw_set: /any/ 00511 // | 00512 // +-- /some/ 00513 // | | 00514 // | +-- uni 00515 // | | 00516 // | +-- multi 00517 // | 00518 // +-- none 00519 00520 struct vw_set 00521 { 00522 struct any { protected: any() {} }; 00523 struct some : any { protected: some() {} }; 00524 struct none 00525 : any { std::string name() const { return "vw_set::none";} }; 00526 struct uni 00527 : some { std::string name() const { return "vw_set::uni";} }; 00528 struct multi 00529 : some { std::string name() const { return "vw_set::multi";} }; 00530 }; 00531 00532 00533 // DEPRECATED PROPERTY 00534 // value_browsing:/any/ 00535 // | 00536 // + -- site_wise_only 00537 // | 00538 // + -------- cell_wise 00539 // | | 00540 // + -- value_wise | 00541 // \ | 00542 // -- + -- cell_and_value_wise 00543 00544 struct value_browsing 00545 { 00546 struct any { protected: any() {} }; 00547 struct site_wise_only 00548 : any { std::string name() const { return "value_browsing::site_wise_only"; } }; 00549 struct cell_wise 00550 : virtual any { std::string name() const { return "value_browsing::cell_wise"; } }; 00551 struct value_wise 00552 : virtual any { std::string name() const { return "value_browsing::value_wise"; } }; 00553 struct cell_and_value_wise 00554 : cell_wise, 00555 value_wise 00556 { std::string name() const { return "value_browsing::cell_and_value_wise"; } }; 00557 }; 00558 00559 00560 // DEPRECATED PROPERTY 00561 // value_io: /any/ 00562 // | 00563 // + -- read_only 00564 // | 00565 // + -- read_write 00566 00567 struct value_io 00568 { 00569 struct any { protected: any() {} }; 00570 struct read_only 00571 : any { std::string name() const { return "value_io::read_only"; } }; 00572 struct read_write 00573 : any { std::string name() const { return "value_io::read_write"; } }; 00574 }; 00575 00576 00577 // localization: /any/ 00578 // | 00579 // + -- none 00580 // | 00581 // + -- space 00582 // | 00583 // + -- /grid/ 00584 // | 00585 // + -- isotropic_grid 00586 // | | 00587 // | + -- basic_grid 00588 // | 00589 // + -- anisotropic_grid 00590 00591 struct localization 00592 { 00593 struct any { protected: any() {} }; 00594 struct none : any { std::string name() const { return "localization::none"; } }; 00595 struct space : any { std::string name() const { return "localization::space"; } }; 00596 struct grid : space { protected: grid() {} }; 00597 struct isotropic_grid 00598 : grid { std::string name() const { return "localization::isotropic_grid"; } }; 00599 struct basic_grid 00600 : isotropic_grid { std::string name() const { return "localization::basic_grid"; } }; 00601 struct anisotropic_grid 00602 : grid { std::string name() const { return "localization::anisotropic_grid"; } }; 00603 }; 00604 00605 00606 // dimension: /any/ 00607 // | 00608 // + -- none 00609 // | 00610 // + -- /some/ 00611 // | 00612 // + -- one_d 00613 // | 00614 // + -- two_d 00615 // | 00616 // + -- three_d 00617 00618 struct dimension 00619 { 00620 struct any { protected: any() {} }; 00621 struct none : any { std::string name() const { return "dimension::none"; } }; 00622 struct some 00623 : any { protected: some() {} }; 00624 struct one_d : some { std::string name() const { return "dimension::one_d"; } }; 00625 struct two_d : some { std::string name() const { return "dimension::two_d"; } }; 00626 struct three_d : some { std::string name() const { return "dimension::three_d"; } }; 00627 }; 00628 00629 00630 // ext_domain: /any/ 00631 // | 00632 // + -- none 00633 // | 00634 // + -- /some/ 00635 // | 00636 // + -- fixed 00637 // | | 00638 // | + -- infinite 00639 // | 00640 // + -- extendable 00641 00642 struct ext_domain 00643 { 00644 struct any { protected: any() {} }; 00645 struct none : any { std::string name() const { return "ext_domain::none"; } }; 00646 struct some 00647 : any { protected: some() {} }; 00648 struct extendable : some { std::string name() const { return "ext_domain::extendable"; } }; 00649 struct fixed : some { std::string name() const { return "ext_domain::fixed"; } }; 00650 struct infinite : fixed { std::string name() const { return "ext_domain::infinite"; } }; 00651 }; 00652 00653 00654 // ext_value: /any/ 00655 // | 00656 // + -- irrelevant 00657 // | 00658 // + -- single 00659 // | 00660 // + -- multiple 00661 00662 struct ext_value 00663 { 00664 struct any { protected: any() {} }; 00665 struct irrelevant : any { std::string name() const { return "ext_value::irrelevant"; } }; 00666 struct single : any { std::string name() const { return "ext_value::single"; } }; 00667 struct multiple : any { std::string name() const { return "ext_value::multiple"; } }; 00668 }; 00669 00670 00671 // ext_io: /any/ 00672 // | 00673 // + -- irrelevant 00674 // | 00675 // + -- read_only 00676 // | 00677 // + -- read_write 00678 00679 struct ext_io 00680 { 00681 struct any { protected: any() {} }; 00682 struct irrelevant 00683 : any { std::string name() const { return "ext_io::irrelevant"; } }; 00684 struct read_only 00685 : any { std::string name() const { return "ext_io::read_only"; } }; 00686 struct read_write 00687 : any { std::string name() const { return "ext_io::read_write"; } }; 00688 }; 00689 00690 00691 // kind: /any/ 00692 // | 00693 // + -- color 00694 // | 00695 // + -- gray 00696 // | 00697 // + ----------- label 00698 // | | 00699 // | +-- named 00700 // + -- /logic/ | 00701 // | | | 00702 // | + -- /mvlogic/ 00703 // | | | 00704 // | | + -- binary 00705 // | | | 00706 // | | + -- ternary 00707 // | | 00708 // | + -- fuzzy 00709 // | 00710 // + -- data 00711 // | 00712 // | 00713 // + -- /map/ 00714 // | 00715 // + -- distance 00716 00717 typedef mln::trait::value::kind kind; // Fetch the 'kind' structure from value traits. 00718 00719 00720 // nature: /any/ 00721 // | 00722 // + -- scalar 00723 // | 00724 // + -- vectorial 00725 // | 00726 // + -- structed 00727 // | 00728 // + -- pointer 00729 00730 struct nature 00731 { 00732 struct any { protected: any() {} }; 00733 struct scalar : any { std::string name() const { return "nature::scalar"; } }; 00734 struct vectorial : any { std::string name() const { return "nature::vectorial"; } }; 00735 struct structed : any { std::string name() const { return "nature::structed"; } }; 00736 struct pointer : any { std::string name() const { return "nature::pointer"; } }; 00737 }; 00738 00739 00740 // quant: /any/ 00741 // | 00742 // + -- low 00743 // | 00744 // + -- high 00745 00746 struct quant 00747 { 00748 struct any { protected: any() {} }; 00749 struct low : any { std::string name() const { return "quant::low"; } }; 00750 struct high : any { std::string name() const { return "quant::high"; } }; 00751 }; 00752 00753 00754 } // end of namespace mln::trait::image 00755 00756 } // end of namespace mln::trait 00757 00758 00759 00760 // FIXME: To be moved elsewhere? 00761 00764 00765 // Fwd decl. (used by trait::image::space_from_point). 00766 namespace grid 00767 { 00768 struct tick; 00769 struct square; 00770 struct hexa; 00771 struct cube; 00772 } 00773 00774 template <typename M, typename C> struct point; 00775 typedef point<grid::tick, def::coord> point1d; 00776 typedef point<grid::square, def::coord> point2d; 00777 typedef point<grid::hexa, def::coord> point2d_h; 00778 typedef point<grid::cube, def::coord> point3d; 00779 00780 namespace trait 00781 { 00782 namespace image 00783 { 00784 00787 template <typename P> 00788 struct space_from_point 00789 { typedef undef ret; }; 00790 00791 template <> 00792 struct space_from_point<point1d> 00793 { typedef trait::image::dimension::one_d ret; }; 00794 00795 template <> 00796 struct space_from_point<point2d> 00797 { typedef trait::image::dimension::two_d ret; }; 00798 00799 template <> 00800 struct space_from_point<point3d> 00801 { typedef trait::image::dimension::three_d ret; }; 00803 00804 } // end of namespace mln::trait::image 00805 00806 } // end of namespace mln::trait 00807 00808 } // end of namespace mln 00809 00810 00811 #endif // ! MLN_TRAIT_IMAGE_PROPS_HH