cartodata  5.0.5
volumeref_d_operators.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTODATA_VOLUME_VOLUMEREF_D_OPERATORS_H
35 #define CARTODATA_VOLUME_VOLUMEREF_D_OPERATORS_H
36 
37 
38 //--- cartodata --------------------------------------------------------------
42 //----------------------------------------------------------------------------
43 
44 // Extern operators should be defined inside the library namespace because of
45 // Koenig's lookup:
46 // - https://en.wikipedia.org/wiki/Argument-dependent_name_lookup
47 namespace carto {
48 
49 #ifdef CARTO_VOLUME_AUTO_DEREFERENCE
50 
51  //==========================================================================
52  // BOOLEANS
53  //==========================================================================
54 
55  template <typename T>
56  inline
57  bool VolumeRef<T>::all() const
58  {
59  return (*this)->all();
60  }
61 
62  template <typename T>
63  inline
64  bool VolumeRef<T>::any() const
65  {
66  return (*this)->any();
67  }
68 
69 #if 0 // would change rc_ptr cast operator (equivalent to get())
70  template <typename T>
71  inline
72  operator VolumeRef<T>::bool() const
73  {
74  return (bool)(**this);
75  }
76 #endif
77 
78  template <typename T>
79  inline
81  {
82  return (*this)->min();
83  }
84 
85  template <typename T>
86  inline
88  {
89  return (*this)->max();
90  }
91 
92  template <typename T>
93  inline
95  {
96  return (*this)->sum();
97  }
98 
99 
100  //==========================================================================
101  // FILL / REPLACE
102  //==========================================================================
103 
104  template <typename T>
105  inline
106  void VolumeRef<T>::fill( const T & value )
107  {
108  (*this)->fill(value);
109  }
110 
111  template <typename T>
112  inline
114  {
115  (**this) = value;
116  return *this;
117  }
118 
119  //==========================================================================
120  // COPY
121  //==========================================================================
122  // This is defined with the operators because it needs volumeutil.h
123 
124  template <typename T>
125  inline
127  {
128  return ::carto::copy<T,T>( *this );
129  }
130 
131  template <typename T>
132  template <typename OUTP>
133  inline
135  {
136  return ::carto::copy<OUTP,T>( *this );
137  }
138 
139  template <typename T>
140  inline
142  {
143  return ::carto::deepcopy<T,T>( *this );
144  }
145 
146  template <typename T>
147  template <typename OUTP>
148  inline
150  {
151  return ::carto::deepcopy<OUTP,T>( *this );
152  }
153 
154  template <typename T>
155  inline
157  {
158  return ::carto::copyStructure<T,T>( *this );
159  }
160 
161  template <typename T>
162  template <typename OUTP>
163  inline
165  {
166  return ::carto::copyStructure<OUTP,T>( *this );
167  }
168 
169  template <typename T>
170  template <typename OUTP>
171  inline
173  {
174  return ::carto::deepcopy<OUTP,T>( *this );
175  }
176 
177  //============================================================================
178  // EXTERN OPERATORS : COMPARISONS
179  //============================================================================
180 
181  //--- VolumeRef [op] Scalar --------------------------------------------------
182 
183  template <typename T, typename U>
184  inline
186  {
187  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
188  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::equal_to<T,U>(), value ) );
189  return output;
190  }
191 
192  template <typename T, typename U>
193  inline
195  {
196  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
197  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::not_equal_to<T,U>(), value ) );
198  return output;
199  }
200 
201  template <typename T, typename U>
202  inline
204  {
205  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
206  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::greater_equal<T,U>(), value ) );
207  return output;
208  }
209 
210  template <typename T, typename U>
211  inline
212  carto::VolumeRef<bool> operator<= ( const carto::VolumeRef<T> & vol, const U & value )
213  {
214  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
215  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::less_equal<T,U>(), value ) );
216  return output;
217  }
218 
219  template <typename T, typename U>
220  inline
221  carto::VolumeRef<bool> operator> ( const carto::VolumeRef<T> & vol, const U & value )
222  {
223  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
224  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::greater<T,U>(), value ) );
225  return output;
226  }
227 
228  template <typename T, typename U>
229  inline
230  carto::VolumeRef<bool> operator< ( const carto::VolumeRef<T> & vol, const U & value )
231  {
232  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
233  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::less<T,U>(), value ) );
234  return output;
235  }
236 
237  //--- Scalar [op] VolumeRef --------------------------------------------------
238 
239  template <typename T, typename U>
240  inline
242  {
243  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
244  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::equal_to<U,T>(), value ) );
245  return output;
246  }
247 
248  template <typename T, typename U>
249  inline
251  {
252  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
253  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::not_equal_to<U,T>(), value ) );
254  return output;
255  }
256 
257  template <typename T, typename U>
258  inline
260  {
261  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
262  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::greater_equal<U,T>(), value ) );
263  return output;
264  }
265 
266  template <typename T, typename U>
267  inline
268  carto::VolumeRef<bool> operator<= ( const U & value, const carto::VolumeRef<T> & vol )
269  {
270  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
271  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::less_equal<U,T>(), value ) );
272  return output;
273  }
274 
275  template <typename T, typename U>
276  inline
277  carto::VolumeRef<bool> operator> ( const U & value, const carto::VolumeRef<T> & vol )
278  {
279  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
280  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::greater<U,T>(), value ) );
281  return output;
282  }
283 
284  template <typename T, typename U>
285  inline
286  carto::VolumeRef<bool> operator< ( const U & value, const carto::VolumeRef<T> & vol )
287  {
288  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
289  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::less<U,T>(), value ) );
290  return output;
291  }
292 
293  //--- VolumeRef [op] Volume --------------------------------------------------
294 
295  template <typename T, typename U>
296  inline
298  {
299  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
301  return output;
302  }
303 
304  template <typename T, typename U>
305  inline
307  {
308  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
310  return output;
311  }
312 
313  template <typename T, typename U>
314  inline
316  {
317  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
319  return output;
320  }
321 
322  template <typename T, typename U>
323  inline
324  carto::VolumeRef<bool> operator<= ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
325  {
326  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
328  return output;
329  }
330 
331  template <typename T, typename U>
332  inline
334  {
335  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
337  return output;
338  }
339 
340  template <typename T, typename U>
341  inline
342  carto::VolumeRef<bool> operator< ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
343  {
344  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
346  return output;
347  }
348 
349  //--- Volume [op] VolumeRef --------------------------------------------------
350 
351  template <typename T, typename U>
352  inline
354  {
355  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
356  return carto::volumeutil::applyTowards( vol, *other, output, carto::volumeutil::equal_to<T,U>() );
357  }
358 
359  template <typename T, typename U>
360  inline
362  {
363  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
365  }
366 
367  template <typename T, typename U>
368  inline
370  {
371  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
373  }
374 
375  template <typename T, typename U>
376  inline
377 carto::VolumeRef<bool> operator<= ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
378  {
379  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
381  }
382 
383  template <typename T, typename U>
384  inline
386  {
387  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
388  return carto::volumeutil::applyTowards( vol, *other, output, carto::volumeutil::greater<T,U>() );
389  }
390 
391  template <typename T, typename U>
392  inline
393 carto::VolumeRef<bool> operator< ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
394  {
395  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
396  return carto::volumeutil::applyTowards( vol, *other, output, carto::volumeutil::less<T,U>() );
397  }
398 
399  //--- VolumeRef [op] VolumeRef -----------------------------------------------
400 
401  #if 0 // Would change rc_ptr behaviour
402  template <typename T, typename U>
403  inline
405  {
406  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
408  return output;
409  }
410 
411  template <typename T, typename U>
412  inline
414  {
415  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
417  return output;
418  }
419  #endif
420 
421  template <typename T, typename U>
422  inline
424  {
425  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
427  return output;
428  }
429 
430  template <typename T, typename U>
431  inline
432  carto::VolumeRef<bool> operator<= ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
433  {
434  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
436  return output;
437  }
438 
439  template <typename T, typename U>
440  inline
442  {
443  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
445  return output;
446  }
447 
448  template <typename T, typename U>
449  inline
450  carto::VolumeRef<bool> operator< ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
451  {
452  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
454  return output;
455  }
456 
457  //============================================================================
458  // EXTERN OPERATORS : ARITHMETICS
459  //============================================================================
460 
461  //--- [op] VolumeRef ---------------------------------------------------------
462 
463  template <typename T>
464  inline
466  {
468  }
469 
470  template <typename T>
471  inline
473  {
475  }
476 
477  template <typename T>
478  inline
480  {
481  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
483  return output;
484  }
485 
486  //--- VolumeRef [op] Scalar --------------------------------------------------
487 
488  template <typename T, typename U>
489  inline
491  operator+ ( const carto::VolumeRef<T> & vol, const U & value )
492  {
493  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::plus<T,U>(), value ) );
494  }
495 
496  template <typename T, typename U>
497  inline
499  operator- ( const carto::VolumeRef<T> & vol, const U & value )
500  {
501  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::minus<T,U>(), value ) );
502  }
503 
504  template <typename T, typename U>
505  inline
507  operator* ( const carto::VolumeRef<T> & vol, const U & value )
508  {
509  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::multiplies<T,U>(), value ) );
510  }
511 
512  template <typename T, typename U>
513  inline
515  operator/ ( const carto::VolumeRef<T> & vol, const U & value )
516  {
517  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::divides<T,U>(), value ) );
518  }
519 
520  template <typename T, typename U>
521  inline
523  operator% ( const carto::VolumeRef<T> & vol, const U & value )
524  {
525  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::modulus<T,U>(), value ) );
526  }
527 
528  template <typename T, typename U>
529  inline
531  operator& ( const carto::VolumeRef<T> & vol, const U & value )
532  {
533  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_and<T,U>(), value ) );
534  }
535 
536  template <typename T, typename U>
537  inline
539  operator| ( const carto::VolumeRef<T> & vol, const U & value )
540  {
541  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_or<T,U>(), value ) );
542  }
543 
544  template <typename T, typename U>
545  inline
547  operator^ ( const carto::VolumeRef<T> & vol, const U & value )
548  {
549  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_xor<T,U>(), value ) );
550  }
551 
552  template <typename T, typename U>
553  inline
555  {
556  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
557  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::logical_and<T,U>(), value ) );
558  return output;
559  }
560 
561  template <typename T, typename U>
562  inline
564  {
565  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
566  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::logical_or<T,U>(), value ) );
567  return output;
568  }
569 
570  //--- Scalar [op] VolumeRef --------------------------------------------------
571 
572  template <typename T, typename U>
573  inline
575  operator+ ( const U & value, const carto::VolumeRef<T> & vol )
576  {
577  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::plus<U,T>(), value ) );
578  }
579 
580  template <typename T, typename U>
581  inline
583  operator- ( const U & value, const carto::VolumeRef<T> & vol )
584  {
585  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::minus<U,T>(), value ) );
586  }
587 
588  template <typename T, typename U>
589  inline
591  operator* ( const U & value, const carto::VolumeRef<T> & vol )
592  {
593  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::multiplies<U,T>(), value ) );
594  }
595 
596  template <typename T, typename U>
597  inline
599  operator/ ( const U & value, const carto::VolumeRef<T> & vol )
600  {
601  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::divides<U,T>(), value ) );
602  }
603 
604  //--- VolumeRef [op] Volume --------------------------------------------------
605 
606  template <typename T, typename U>
607  inline
609  operator+ ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
610  {
612  }
613 
614  template <typename T, typename U>
615  inline
617  operator- ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
618  {
620  }
621 
622  template <typename T, typename U>
623  inline
625  operator* ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
626  {
628  }
629 
630  template <typename T, typename U>
631  inline
633  operator/ ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
634  {
636  }
637 
638  template <typename T, typename U>
639  inline
641  operator% ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
642  {
644  }
645 
646  template <typename T, typename U>
647  inline
649  operator& ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
650  {
652  }
653 
654  template <typename T, typename U>
655  inline
657  operator| ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
658  {
660  }
661 
662  template <typename T, typename U>
663  inline
665  operator^ ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
666  {
668  }
669 
670  template <typename T, typename U>
671  inline
673  {
674  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
676  return output;
677  }
678 
679  template <typename T, typename U>
680  inline
682  {
683  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
685  return output;
686  }
687 
688  //--- Volume [op] VolumeRef --------------------------------------------------
689 
690  template <typename T, typename U>
691  inline
693  operator+ ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
694  {
696  }
697 
698  template <typename T, typename U>
699  inline
701  operator- ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
702  {
704  }
705 
706  template <typename T, typename U>
707  inline
709  operator* ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
710  {
712  }
713 
714  template <typename T, typename U>
715  inline
717  operator/ ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
718  {
720  }
721 
722  template <typename T, typename U>
723  inline
725  operator% ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
726  {
728  }
729 
730  template <typename T, typename U>
731  inline
733  operator& ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
734  {
736  }
737 
738  template <typename T, typename U>
739  inline
741  operator| ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
742  {
744  }
745 
746  template <typename T, typename U>
747  inline
749  operator^ ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
750  {
752  }
753 
754  template <typename T, typename U>
755  inline
757  {
758  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
760  }
761  template <typename T, typename U>
762  inline
764  {
765  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
767  }
768 
769  //--- VolumeRef [op] VolumeRef -----------------------------------------------
770 
771  template <typename T, typename U>
772  inline
774  operator+ ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
775  {
777  }
778 
779  template <typename T, typename U>
780  inline
782  operator- ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
783  {
785  }
786 
787  template <typename T, typename U>
788  inline
790  operator* ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
791  {
793  }
794 
795  template <typename T, typename U>
796  inline
798  operator/ ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
799  {
801  }
802 
803  template <typename T, typename U>
804  inline
806  operator% ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
807  {
809  }
810 
811  template <typename T, typename U>
812  inline
814  operator& ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
815  {
817  }
818 
819  template <typename T, typename U>
820  inline
822  operator| ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
823  {
825  }
826 
827  template <typename T, typename U>
828  inline
830  operator^ ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
831  {
833  }
834 
835  template <typename T, typename U>
836  inline
838  {
839  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
841  return output;
842  }
843  template <typename T, typename U>
844  inline
846  {
847  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
849  return output;
850  }
851 
852  //============================================================================
853  // OPERATORS: ARITHMETIC MODIFIERS
854  //============================================================================
855 
856  //--- VolumeRef [op] Scalar --------------------------------------------------
857 
858  template <typename T, typename U>
859  inline
861  {
862  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::plus<T,U>(), value ) );
863  return vol;
864  }
865 
866  template <typename T, typename U>
867  inline
869  {
870  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::minus<T,U>(), value ) );
871  return vol;
872  }
873 
874  template <typename T, typename U>
875  inline
877  {
878  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::multiplies<T,U>(), value ) );
879  return vol;
880  }
881 
882  template <typename T, typename U>
883  inline
885  {
886  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::divides<T,U>(), value ) );
887  return vol;
888  }
889 
890  template <typename T, typename U>
891  inline
893  {
894  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::modulus<T,U>(), value ) );
895  return vol;
896  }
897 
898  template <typename T, typename U>
899  inline
901  {
902  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_and<T,U>(), value ) );
903  return vol;
904  }
905 
906  template <typename T, typename U>
907  inline
909  {
910  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_or<T,U>(), value ) );
911  return vol;
912  }
913 
914  template <typename T, typename U>
915  inline
917  {
918  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_xor<T,U>(), value ) );
919  return vol;
920  }
921 
922  //--- VolumeRef [op] Volume --------------------------------------------------
923 
924  template <typename T, typename U>
925  inline
927  {
929  return vol;
930  }
931 
932  template <typename T, typename U>
933  inline
935  {
937  return vol;
938  }
939 
940  template <typename T, typename U>
941  inline
943  {
945  return vol;
946  }
947 
948  template <typename T, typename U>
949  inline
951  {
953  return vol;
954  }
955 
956  template <typename T, typename U>
957  inline
959  {
961  return vol;
962  }
963 
964  template <typename T, typename U>
965  inline
967  {
969  return vol;
970  }
971 
972  template <typename T, typename U>
973  inline
975  {
977  return vol;
978  }
979 
980  template <typename T, typename U>
981  inline
983  {
985  return vol;
986  }
987 
988  //--- Volume [op]= VolumeRef -------------------------------------------------
989 
990  template <typename T, typename U>
991  inline
993  {
995  }
996 
997  template <typename T, typename U>
998  inline
1000  {
1002  }
1003 
1004  template <typename T, typename U>
1005  inline
1007  {
1009  }
1010 
1011  template <typename T, typename U>
1012  inline
1014  {
1016  }
1017 
1018  template <typename T, typename U>
1019  inline
1021  {
1023  }
1024 
1025  template <typename T, typename U>
1026  inline
1028  {
1030  }
1031 
1032  template <typename T, typename U>
1033  inline
1035  {
1037  }
1038 
1039  template <typename T, typename U>
1040  inline
1042  {
1044  }
1045 
1046  //--- VolumeRef [op] VolumeRef -----------------------------------------------
1047 
1048  template <typename T, typename U>
1049  inline
1051  {
1053  return vol;
1054  }
1055 
1056  template <typename T, typename U>
1057  inline
1059  {
1061  return vol;
1062  }
1063 
1064  template <typename T, typename U>
1065  inline
1067  {
1069  return vol;
1070  }
1071 
1072  template <typename T, typename U>
1073  inline
1075  {
1077  return vol;
1078  }
1079 
1080  template <typename T, typename U>
1081  inline
1083  {
1085  return vol;
1086  }
1087 
1088  template <typename T, typename U>
1089  inline
1091  {
1093  return vol;
1094  }
1095 
1096  template <typename T, typename U>
1097  inline
1099  {
1101  return vol;
1102  }
1103 
1104  template <typename T, typename U>
1105  inline
1107  {
1109  return vol;
1110  }
1111 
1112 
1113  //============================================================================
1114  // INCREMENTS
1115  //============================================================================
1116 
1117  template <typename T>
1118  inline
1120  {
1121  carto::VolumeRef<T> output = carto::deepcopy(vol);
1122  ++vol;
1123  return output;
1124  }
1125 
1126  template <typename T>
1127  inline
1129  {
1131  return vol;
1132  }
1133 
1134  template <typename T>
1135  inline
1137  {
1138  carto::VolumeRef<T> output = carto::deepcopy(vol);
1139  --vol;
1140  return output;
1141  }
1142 
1143  template <typename T>
1144  inline
1146  {
1148  return vol;
1149  }
1150 
1151 #endif // CARTO_VOLUME_AUTO_DEREFERENCE
1152 
1153 } // namespace carto
1154 
1155 #endif // CARTODATA_VOLUME_VOLUMEREF_D_OPERATORS_H
carto::Volume< T > operator--(carto::Volume< T > &vol, int)
N-D Volume main class.
carto::Volume< bool > operator!(const carto::Volume< T > &vol)
Volume< T > & selfApply(Volume< T > &vol, UnaryFunction func)
Apply a function to all the elements of a volume (in place version)
Definition: volumeutil.h:396
VolumeRef< T > deepcopy() const
VoxelRGB operator/(const VoxelRGB &aa, const uint8_t &bb)
carto::Volume< bool > operator>=(const carto::Volume< T > &vol, const U &value)
VolumeRef< T > copyStructure() const
carto::Volume< bool > operator &&(const carto::Volume< T > &vol, const U &value)
VoxelRGB operator+(const VoxelRGB &aa, const VoxelRGB &bb)
carto::Volume< bool > operator>(const carto::Volume< T > &vol, const U &value)
Convenient handle for a Volume - this is normally the entry point for all volumes handling...
carto::Volume< T > operator~(const carto::Volume< T > &vol)
bool any() const
True if at least one value compares to true.
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)
carto::Volume< bool > operator==(const carto::Volume< T > &vol, const U &value)
carto::Volume< T > & operator &=(carto::Volume< T > &vol, const U &value)
carto::Volume< typename carto::volumeutil::modulus< T, U >::result_type > operator%(const carto::Volume< T > &vol, const U &value)
carto::Volume< typename carto::volumeutil::bitwise_xor< T, U >::result_type > operator^(const carto::Volume< T > &vol, const U &value)
void fill(const T &value)
Fills the volume with a given value.
VolumeRef< T > & operator=(const T &value)
carto::Volume< T > & operator%=(carto::Volume< T > &vol, const U &value)
VolumeRef< T > copy() const
carto::Volume< bool > operator!=(const carto::Volume< T > &vol, const U &value)
carto::Volume< typename carto::volumeutil::bitwise_or< T, U >::result_type > operator|(const carto::Volume< T > &vol, const U &value)
carto::Volume< T > & operator^=(carto::Volume< T > &vol, const U &value)
Volume< T > deepcopy(const Volume< T > &src)
Performs a copy of the data (not only a reference copy) The whole view hierarchy is fully duplicated...
Definition: volumeutil.h:506
carto::Volume< bool > operator||(const carto::Volume< T > &vol, const U &value)
carto::Volume< T > & operator*=(carto::Volume< T > &vol, const U &value)
carto::Volume< T > & operator+=(carto::Volume< T > &vol, const U &value)
carto::Volume< T > & operator-=(carto::Volume< T > &vol, const U &value)
carto::Volume< typename carto::volumeutil::bitwise_and< T, U >::result_type > operator &(const carto::Volume< T > &vol, const U &value)
VoxelRGB operator-(const VoxelRGB &aa, const VoxelRGB &bb)
Volume< OUTP > & applyTowards(const Volume< T > &vol, Volume< OUTP > &dst, UnaryFunction func)
Apply a function to all the elements of a volume (already allocated output version) ...
Definition: volumeutil.h:428
Volume< typename UnaryFunction::result_type > apply(const Volume< T > &vol, UnaryFunction func)
Used by the actual Volume and VolumeRef operators It allows to keep the loops in one place and to spe...
Definition: volumeutil.h:353
DataTypeTraits< T >::LongType sum() const
To avoid overflow, the biggest possible type (intmax_t, uintmax_t, double...) is used for computation...
bool all() const
True if all values compare to true.
carto::Volume< T > operator++(carto::Volume< T > &vol, int)
carto::Volume< T > & operator|=(carto::Volume< T > &vol, const U &value)
carto::Volume< T > & operator/=(carto::Volume< T > &vol, const U &value)