cartodata  5.1.2
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
113  void VolumeRef<T>::fillBorder( const T & value )
114  {
115  (*this)->fillBorder(value);
116  }
117 
118  template <typename T>
119  inline
121  {
122  (**this) = value;
123  return *this;
124  }
125 
126  //==========================================================================
127  // COPY
128  //==========================================================================
129  // This is defined with the operators because it needs volumeutil.h
130 
131  template <typename T>
132  inline
134  {
135  return ::carto::copy<T,T>( *this );
136  }
137 
138  template <typename T>
139  template <typename OUTP>
140  inline
142  {
143  return ::carto::copy<OUTP,T>( *this );
144  }
145 
146  template <typename T>
147  inline
149  {
150  return ::carto::deepcopy<T,T>( *this );
151  }
152 
153  template <typename T>
154  template <typename OUTP>
155  inline
157  {
158  return ::carto::deepcopy<OUTP,T>( *this );
159  }
160 
161  template <typename T>
162  inline
164  {
165  return ::carto::copyStructure<T,T>( *this );
166  }
167 
168  template <typename T>
169  template <typename OUTP>
170  inline
172  {
173  return ::carto::copyStructure<OUTP,T>( *this );
174  }
175 
176  template <typename T>
177  template <typename OUTP>
178  inline
180  {
181  return ::carto::deepcopy<OUTP,T>( *this );
182  }
183 
184  //============================================================================
185  // EXTERN OPERATORS : COMPARISONS
186  //============================================================================
187 
188  //--- VolumeRef [op] Scalar --------------------------------------------------
189 
190  template <typename T, typename U>
191  inline
193  {
194  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
195  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::equal_to<T,U>(), value ) );
196  return output;
197  }
198 
199  template <typename T, typename U>
200  inline
202  {
203  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
204  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::not_equal_to<T,U>(), value ) );
205  return output;
206  }
207 
208  template <typename T, typename U>
209  inline
211  {
212  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
213  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::greater_equal<T,U>(), value ) );
214  return output;
215  }
216 
217  template <typename T, typename U>
218  inline
219  carto::VolumeRef<bool> operator<= ( const carto::VolumeRef<T> & vol, const U & value )
220  {
221  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
222  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::less_equal<T,U>(), value ) );
223  return output;
224  }
225 
226  template <typename T, typename U>
227  inline
228  carto::VolumeRef<bool> operator> ( const carto::VolumeRef<T> & vol, const U & value )
229  {
230  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
231  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::greater<T,U>(), value ) );
232  return output;
233  }
234 
235  template <typename T, typename U>
236  inline
237  carto::VolumeRef<bool> operator< ( const carto::VolumeRef<T> & vol, const U & value )
238  {
239  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
240  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::less<T,U>(), value ) );
241  return output;
242  }
243 
244  //--- Scalar [op] VolumeRef --------------------------------------------------
245 
246  template <typename T, typename U>
247  inline
249  {
250  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
251  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::equal_to<U,T>(), value ) );
252  return output;
253  }
254 
255  template <typename T, typename U>
256  inline
258  {
259  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
260  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::not_equal_to<U,T>(), value ) );
261  return output;
262  }
263 
264  template <typename T, typename U>
265  inline
267  {
268  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
269  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::greater_equal<U,T>(), value ) );
270  return output;
271  }
272 
273  template <typename T, typename U>
274  inline
275  carto::VolumeRef<bool> operator<= ( const U & value, const carto::VolumeRef<T> & vol )
276  {
277  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
278  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::less_equal<U,T>(), value ) );
279  return output;
280  }
281 
282  template <typename T, typename U>
283  inline
284  carto::VolumeRef<bool> operator> ( const U & value, const carto::VolumeRef<T> & vol )
285  {
286  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
287  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::greater<U,T>(), value ) );
288  return output;
289  }
290 
291  template <typename T, typename U>
292  inline
293  carto::VolumeRef<bool> operator< ( const U & value, const carto::VolumeRef<T> & vol )
294  {
295  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
296  carto::volumeutil::applyTowards( *vol, *output, std::bind1st( carto::volumeutil::less<U,T>(), value ) );
297  return output;
298  }
299 
300  //--- VolumeRef [op] Volume --------------------------------------------------
301 
302  template <typename T, typename U>
303  inline
305  {
306  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
308  return output;
309  }
310 
311  template <typename T, typename U>
312  inline
314  {
315  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
317  return output;
318  }
319 
320  template <typename T, typename U>
321  inline
323  {
324  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
326  return output;
327  }
328 
329  template <typename T, typename U>
330  inline
332  {
333  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
335  return output;
336  }
337 
338  template <typename T, typename U>
339  inline
341  {
342  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
344  return output;
345  }
346 
347  template <typename T, typename U>
348  inline
350  {
351  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
353  return output;
354  }
355 
356  //--- Volume [op] VolumeRef --------------------------------------------------
357 
358  template <typename T, typename U>
359  inline
361  {
362  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
363  return carto::volumeutil::applyTowards( vol, *other, output, carto::volumeutil::equal_to<T,U>() );
364  }
365 
366  template <typename T, typename U>
367  inline
369  {
370  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
372  }
373 
374  template <typename T, typename U>
375  inline
377  {
378  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
380  }
381 
382  template <typename T, typename U>
383  inline
385  {
386  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
388  }
389 
390  template <typename T, typename U>
391  inline
393  {
394  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
395  return carto::volumeutil::applyTowards( vol, *other, output, carto::volumeutil::greater<T,U>() );
396  }
397 
398  template <typename T, typename U>
399  inline
401  {
402  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
403  return carto::volumeutil::applyTowards( vol, *other, output, carto::volumeutil::less<T,U>() );
404  }
405 
406  //--- VolumeRef [op] VolumeRef -----------------------------------------------
407 
408  #if 0 // Would change rc_ptr behaviour
409  template <typename T, typename U>
410  inline
412  {
413  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
415  return output;
416  }
417 
418  template <typename T, typename U>
419  inline
421  {
422  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
424  return output;
425  }
426  #endif
427 
428  template <typename T, typename U>
429  inline
431  {
432  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
434  return output;
435  }
436 
437  template <typename T, typename U>
438  inline
440  {
441  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
443  return output;
444  }
445 
446  template <typename T, typename U>
447  inline
449  {
450  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
452  return output;
453  }
454 
455  template <typename T, typename U>
456  inline
458  {
459  carto::VolumeRef<bool> output = carto::copyStructure<bool, T>( vol );
461  return output;
462  }
463 
464  //============================================================================
465  // EXTERN OPERATORS : ARITHMETICS
466  //============================================================================
467 
468  //--- [op] VolumeRef ---------------------------------------------------------
469 
470  template <typename T>
471  inline
473  {
475  }
476 
477  template <typename T>
478  inline
480  {
482  }
483 
484  template <typename T>
485  inline
487  {
488  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
490  return output;
491  }
492 
493  //--- VolumeRef [op] Scalar --------------------------------------------------
494 
495  template <typename T, typename U>
496  inline
498  operator+ ( const carto::VolumeRef<T> & vol, const U & value )
499  {
500  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::plus<T,U>(), value ) );
501  }
502 
503  template <typename T, typename U>
504  inline
506  operator- ( const carto::VolumeRef<T> & vol, const U & value )
507  {
508  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::minus<T,U>(), value ) );
509  }
510 
511  template <typename T, typename U>
512  inline
514  operator* ( const carto::VolumeRef<T> & vol, const U & value )
515  {
516  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::multiplies<T,U>(), value ) );
517  }
518 
519  template <typename T, typename U>
520  inline
522  operator/ ( const carto::VolumeRef<T> & vol, const U & value )
523  {
524  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::divides<T,U>(), value ) );
525  }
526 
527  template <typename T, typename U>
528  inline
530  operator% ( const carto::VolumeRef<T> & vol, const U & value )
531  {
532  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::modulus<T,U>(), value ) );
533  }
534 
535  template <typename T, typename U>
536  inline
538  operator& ( const carto::VolumeRef<T> & vol, const U & value )
539  {
540  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_and<T,U>(), value ) );
541  }
542 
543  template <typename T, typename U>
544  inline
546  operator| ( const carto::VolumeRef<T> & vol, const U & value )
547  {
548  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_or<T,U>(), value ) );
549  }
550 
551  template <typename T, typename U>
552  inline
554  operator^ ( const carto::VolumeRef<T> & vol, const U & value )
555  {
556  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_xor<T,U>(), value ) );
557  }
558 
559  template <typename T, typename U>
560  inline
562  {
563  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
564  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::logical_and<T,U>(), value ) );
565  return output;
566  }
567 
568  template <typename T, typename U>
569  inline
571  {
572  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
573  carto::volumeutil::applyTowards( *vol, *output, std::bind2nd( carto::volumeutil::logical_or<T,U>(), value ) );
574  return output;
575  }
576 
577  //--- Scalar [op] VolumeRef --------------------------------------------------
578 
579  template <typename T, typename U>
580  inline
582  operator+ ( const U & value, const carto::VolumeRef<T> & vol )
583  {
584  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::plus<U,T>(), value ) );
585  }
586 
587  template <typename T, typename U>
588  inline
590  operator- ( const U & value, const carto::VolumeRef<T> & vol )
591  {
592  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::minus<U,T>(), value ) );
593  }
594 
595  template <typename T, typename U>
596  inline
598  operator* ( const U & value, const carto::VolumeRef<T> & vol )
599  {
600  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::multiplies<U,T>(), value ) );
601  }
602 
603  template <typename T, typename U>
604  inline
606  operator/ ( const U & value, const carto::VolumeRef<T> & vol )
607  {
608  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::divides<U,T>(), value ) );
609  }
610 
611  //--- VolumeRef [op] Volume --------------------------------------------------
612 
613  template <typename T, typename U>
614  inline
616  operator+ ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
617  {
619  }
620 
621  template <typename T, typename U>
622  inline
624  operator- ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
625  {
627  }
628 
629  template <typename T, typename U>
630  inline
632  operator* ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
633  {
635  }
636 
637  template <typename T, typename U>
638  inline
640  operator/ ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
641  {
643  }
644 
645  template <typename T, typename U>
646  inline
648  operator% ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
649  {
651  }
652 
653  template <typename T, typename U>
654  inline
656  operator& ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
657  {
659  }
660 
661  template <typename T, typename U>
662  inline
664  operator| ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
665  {
667  }
668 
669  template <typename T, typename U>
670  inline
672  operator^ ( const carto::VolumeRef<T> & vol, const carto::Volume<U> & other )
673  {
675  }
676 
677  template <typename T, typename U>
678  inline
680  {
681  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
683  return output;
684  }
685 
686  template <typename T, typename U>
687  inline
689  {
690  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
692  return output;
693  }
694 
695  //--- Volume [op] VolumeRef --------------------------------------------------
696 
697  template <typename T, typename U>
698  inline
700  operator+ ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
701  {
703  }
704 
705  template <typename T, typename U>
706  inline
708  operator- ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
709  {
711  }
712 
713  template <typename T, typename U>
714  inline
716  operator* ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
717  {
719  }
720 
721  template <typename T, typename U>
722  inline
724  operator/ ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
725  {
727  }
728 
729  template <typename T, typename U>
730  inline
732  operator% ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
733  {
735  }
736 
737  template <typename T, typename U>
738  inline
740  operator& ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
741  {
743  }
744 
745  template <typename T, typename U>
746  inline
748  operator| ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
749  {
751  }
752 
753  template <typename T, typename U>
754  inline
756  operator^ ( const carto::Volume<T> & vol, const carto::VolumeRef<U> & other )
757  {
759  }
760 
761  template <typename T, typename U>
762  inline
764  {
765  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
767  }
768  template <typename T, typename U>
769  inline
771  {
772  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
774  }
775 
776  //--- VolumeRef [op] VolumeRef -----------------------------------------------
777 
778  template <typename T, typename U>
779  inline
781  operator+ ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
782  {
784  }
785 
786  template <typename T, typename U>
787  inline
789  operator- ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
790  {
792  }
793 
794  template <typename T, typename U>
795  inline
797  operator* ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
798  {
800  }
801 
802  template <typename T, typename U>
803  inline
805  operator/ ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
806  {
808  }
809 
810  template <typename T, typename U>
811  inline
813  operator% ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
814  {
816  }
817 
818  template <typename T, typename U>
819  inline
821  operator& ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
822  {
824  }
825 
826  template <typename T, typename U>
827  inline
829  operator| ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
830  {
832  }
833 
834  template <typename T, typename U>
835  inline
837  operator^ ( const carto::VolumeRef<T> & vol, const carto::VolumeRef<U> & other )
838  {
840  }
841 
842  template <typename T, typename U>
843  inline
845  {
846  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
848  return output;
849  }
850  template <typename T, typename U>
851  inline
853  {
854  carto::VolumeRef<bool> output = carto::copyStructure<bool,T>( vol );
856  return output;
857  }
858 
859  //============================================================================
860  // OPERATORS: ARITHMETIC MODIFIERS
861  //============================================================================
862 
863  //--- VolumeRef [op] Scalar --------------------------------------------------
864 
865  template <typename T, typename U>
866  inline
868  {
869  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::plus<T,U>(), value ) );
870  return vol;
871  }
872 
873  template <typename T, typename U>
874  inline
876  {
877  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::minus<T,U>(), value ) );
878  return vol;
879  }
880 
881  template <typename T, typename U>
882  inline
884  {
885  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::multiplies<T,U>(), value ) );
886  return vol;
887  }
888 
889  template <typename T, typename U>
890  inline
892  {
893  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::divides<T,U>(), value ) );
894  return vol;
895  }
896 
897  template <typename T, typename U>
898  inline
900  {
901  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::modulus<T,U>(), value ) );
902  return vol;
903  }
904 
905  template <typename T, typename U>
906  inline
908  {
909  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_and<T,U>(), value ) );
910  return vol;
911  }
912 
913  template <typename T, typename U>
914  inline
916  {
917  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_or<T,U>(), value ) );
918  return vol;
919  }
920 
921  template <typename T, typename U>
922  inline
924  {
925  carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_xor<T,U>(), value ) );
926  return vol;
927  }
928 
929  //--- VolumeRef [op] Volume --------------------------------------------------
930 
931  template <typename T, typename U>
932  inline
934  {
936  return vol;
937  }
938 
939  template <typename T, typename U>
940  inline
942  {
944  return vol;
945  }
946 
947  template <typename T, typename U>
948  inline
950  {
952  return vol;
953  }
954 
955  template <typename T, typename U>
956  inline
958  {
960  return vol;
961  }
962 
963  template <typename T, typename U>
964  inline
966  {
968  return vol;
969  }
970 
971  template <typename T, typename U>
972  inline
974  {
976  return vol;
977  }
978 
979  template <typename T, typename U>
980  inline
982  {
984  return vol;
985  }
986 
987  template <typename T, typename U>
988  inline
990  {
992  return vol;
993  }
994 
995  //--- Volume [op]= VolumeRef -------------------------------------------------
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  template <typename T, typename U>
1047  inline
1049  {
1051  }
1052 
1053  //--- VolumeRef [op] VolumeRef -----------------------------------------------
1054 
1055  template <typename T, typename U>
1056  inline
1058  {
1060  return vol;
1061  }
1062 
1063  template <typename T, typename U>
1064  inline
1066  {
1068  return vol;
1069  }
1070 
1071  template <typename T, typename U>
1072  inline
1074  {
1076  return vol;
1077  }
1078 
1079  template <typename T, typename U>
1080  inline
1082  {
1084  return vol;
1085  }
1086 
1087  template <typename T, typename U>
1088  inline
1090  {
1092  return vol;
1093  }
1094 
1095  template <typename T, typename U>
1096  inline
1098  {
1100  return vol;
1101  }
1102 
1103  template <typename T, typename U>
1104  inline
1106  {
1108  return vol;
1109  }
1110 
1111  template <typename T, typename U>
1112  inline
1114  {
1116  return vol;
1117  }
1118 
1119 
1120  //============================================================================
1121  // INCREMENTS
1122  //============================================================================
1123 
1124  template <typename T>
1125  inline
1127  {
1128  carto::VolumeRef<T> output = carto::deepcopy(vol);
1129  ++vol;
1130  return output;
1131  }
1132 
1133  template <typename T>
1134  inline
1136  {
1138  return vol;
1139  }
1140 
1141  template <typename T>
1142  inline
1144  {
1145  carto::VolumeRef<T> output = carto::deepcopy(vol);
1146  --vol;
1147  return output;
1148  }
1149 
1150  template <typename T>
1151  inline
1153  {
1155  return vol;
1156  }
1157 
1158 #endif // CARTO_VOLUME_AUTO_DEREFERENCE
1159 
1160 } // namespace carto
1161 
1162 #endif // CARTODATA_VOLUME_VOLUMEREF_D_OPERATORS_H
Convenient handle for a Volume - this is normally the entry point for all volumes handling.
Definition: volumeref.h:60
bool any() const
True if at least one value compares to true.
void fillBorder(const T &value)
Fill border with a constant value.
VolumeRef< T > deepcopy() const
VolumeRef< T > copyStructure() const
VolumeRef< T > & operator=(const T &value)
DataTypeTraits< T >::LongType sum() const
To avoid overflow, the biggest possible type (intmax_t, uintmax_t, double...) is used for computation...
void fill(const T &value)
Fills the volume with a given value.
bool all() const
True if all values compare to true.
VolumeRef< T > copy() const
N-D Volume main class.
Definition: volumebase.h:119
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:603
Volume< T > & selfApply(Volume< T > &vol, UnaryFunction func)
Apply a function to all the elements of a volume (in place version)
Definition: volumeutil.h:567
Volume< typename UnaryFunction::result_type > apply(const Volume< T > &vol, UnaryFunction func)
Apply a function to all the elements of a volume (create output version)
Definition: volumeutil.h:518
carto::Volume< T > & operator*=(carto::Volume< T > &vol, const U &value)
carto::Volume< T > & operator^=(carto::Volume< T > &vol, const U &value)
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< bool > operator>=(const carto::Volume< T > &vol, const U &value)
carto::Volume< bool > operator!=(const carto::Volume< T > &vol, const U &value)
VoxelRGB operator/(const VoxelRGB &aa, const uint8_t &bb)
Volume< T > deepcopy(const Volume< T > &src, const std::vector< int > &size=std::vector< int >())
Performs a copy of the data (not only a reference copy) The whole view hierarchy is fully duplicated.
Definition: volumeutil.h:877
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)
VoxelRGB operator-(const VoxelRGB &aa, const VoxelRGB &bb)
carto::Volume< bool > operator!(const carto::Volume< T > &vol)
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)
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)
carto::Volume< typename carto::volumeutil::bitwise_and< T, U >::result_type > 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::bitwise_xor< T, U >::result_type > 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~(const carto::Volume< T > &vol)
carto::Volume< T > & operator%=(carto::Volume< T > &vol, const U &value)
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< bool > operator||(const carto::Volume< T > &vol, const U &value)
carto::Volume< bool > operator==(const carto::Volume< T > &vol, const U &value)
carto::Volume< T > operator++(carto::Volume< T > &vol, int)
carto::Volume< T > operator--(carto::Volume< T > &vol, int)
carto::Volume< T > & operator+=(carto::Volume< T > &vol, const U &value)