cartodata  4.5.0
volumebase_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_VOLUMEBASE_D_OPERATORS_H
35 #define CARTODATA_VOLUME_VOLUMEBASE_D_OPERATORS_H
36 
37 
38 //--- cartodata --------------------------------------------------------------
42 //----------------------------------------------------------------------------
43 
44 // Methods that need volumeutil are defined here
45 
46 namespace carto {
47 
48  namespace volumebaseinternal {
49  // Since non template methods risk being instantiated even if
50  // they are not actually called, it is necessary to enable them only
51  // when we are sure they won't cause a compilation error.
52  // This is the aim of this helper.
53  // all(), any(), min(), max(), sum() are concerned
54  template <typename T, bool is_scalar = DataTypeTraits<T>::is_scalar>
55  struct select
56  {
57  static bool all( const Volume<T> & vol )
58  {
59  throw std::logic_error( "Member function all() is only enabled for "
60  "volumes of scalar. Try to use the non-member function "
61  "carto::all(Volume<T>) instead." );
62  }
63 
64  static bool any( const Volume<T> & vol )
65  {
66  throw std::logic_error( "Member function any() is only enabled for "
67  "volumes of scalar. Try to use the non-member function "
68  "carto::any(Volume<T>) instead." );
69  }
70 
71  static T min( const Volume<T> & vol )
72  {
73  throw std::logic_error( "Member function min() is only enabled for "
74  "volumes of scalar. Try to use the non-member function "
75  "carto::min(Volume<T>) instead." );
76  }
77 
78  static T max( const Volume<T> & vol )
79  {
80  throw std::logic_error( "Member function max() is only enabled for "
81  "volumes of scalar. Try to use the non-member function "
82  "carto::max(Volume<T>) instead." );
83  }
84 
85  static T sum( const Volume<T> & vol )
86  {
87  throw std::logic_error( "Member function sum() is only enabled for "
88  "volumes of scalar. Try to use the non-member function "
89  "carto::sum(Volume<T>) instead." );
90  }
91  };
92 
93 
94  template <typename T>
95  struct select<T, true>
96  {
97  static bool all( const Volume<T> & vol )
98  {
99  return all(vol);
100  }
101 
102  static bool any( const Volume<T> & vol )
103  {
104  return any(vol);
105  }
106 
107  static T min( const Volume<T> & vol )
108  {
109  return min(vol);
110  }
111 
112  static T max( const Volume<T> & vol )
113  {
114  return max(vol);
115  }
116 
117  static T sum( const Volume<T> & vol )
118  {
119  return sum(vol);
120  }
121  };
122  }
123 
124  //==========================================================================
125  // BOOLEANS/MIN/MAX...
126  //==========================================================================
127  template <typename T>
128  inline
129  bool Volume<T>::all() const
130  {
131  return volumebaseinternal::select<T>::all( *this );
132  }
133 
134  template <typename T>
135  inline
136  bool Volume<T>::any() const
137  {
138  return volumebaseinternal::select<T>::any( *this );
139  }
140 
141  template <typename T>
142  inline
143  Volume<T>::operator bool() const
144  {
145  return all();
146  }
147 
148  template <typename T>
149  inline
150  T Volume<T>::min() const
151  {
152  return volumebaseinternal::select<T>::min( *this );
153  }
154 
155  template <typename T>
156  inline
157  T Volume<T>::max() const
158  {
159  return volumebaseinternal::select<T>::max( *this );
160  }
161 
162  template <typename T>
163  inline
164  T Volume<T>::sum() const
165  {
166  return volumebaseinternal::select<T>::sum( *this );
167  }
168 
169  template <typename T>
170  template <typename OUTP>
171  inline
172  OUTP Volume<T>::sum() const
173  {
174  return ::carto::sum<OUTP,T>( *this );
175  }
176 
177 
178  //==========================================================================
179  // FILL / REPLACE
180  //==========================================================================
181 
182  template <typename T>
183  inline
184  void Volume<T>::fill( const T & value )
185  {
186  volumeutil::selfApply( *this, std::bind2nd( volumeutil::select_right<T>(), value ) );
187  }
188 
189  template <typename T>
190  inline
191  Volume<T> & Volume<T>::operator= ( const T & value )
192  {
193  this->fill( value );
194  return *this;
195  }
196 
197  //==========================================================================
198  // COPY
199  //==========================================================================
200 
201  template <typename T>
202  inline
204  {
205  return ::carto::copy<T,T>( *this );
206  }
207 
208  template <typename T>
209  template <typename OUTP>
210  inline
212  {
213  return ::carto::copy<OUTP,T>( *this );
214  }
215 
216  template <typename T>
217  inline
219  {
220  return ::carto::deepcopy<T,T>( *this );
221  }
222 
223  template <typename T>
224  template <typename OUTP>
225  inline
227  {
228  return ::carto::deepcopy<OUTP,T>( *this );
229  }
230 
231  template <typename T>
232  inline
234  {
235  return ::carto::copyStructure<T,T>( *this );
236  }
237 
238  template <typename T>
239  template <typename OUTP>
240  inline
242  {
243  return ::carto::copyStructure<OUTP,T>( *this );
244  }
245 
246  template <typename T>
247  template <typename OUTP>
248  inline
250  {
251  return ::carto::deepcopy<OUTP,T>( *this );
252  }
253 
254 } // namespace carto
255 
256 //============================================================================
257 // OPERATORS : COMPARISONS
258 //============================================================================
259 
260 //--- Volume [op] Scalar -----------------------------------------------------
261 
262 template <typename T, typename U>
263 inline
264 carto::Volume<bool> operator== ( const carto::Volume<T> & vol, const U & value )
265 {
266  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
267  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::equal_to<T,U>(), value ) );
268 }
269 
270 template <typename T, typename U>
271 inline
272 carto::Volume<bool> operator!= ( const carto::Volume<T> & vol, const U & value )
273 {
274  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
275  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::not_equal_to<T,U>(), value ) );
276 }
277 
278 template <typename T, typename U>
279 inline
280 carto::Volume<bool> operator>= ( const carto::Volume<T> & vol, const U & value )
281 {
282  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
283  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::greater_equal<T,U>(), value ) );
284 }
285 
286 template <typename T, typename U>
287 inline
288 carto::Volume<bool> operator<= ( const carto::Volume<T> & vol, const U & value )
289 {
290  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
291  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::less_equal<T,U>(), value ) );
292 }
293 
294 template <typename T, typename U>
295 inline
296 carto::Volume<bool> operator> ( const carto::Volume<T> & vol, const U & value )
297 {
298  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
299  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::greater<T,U>(), value ) );
300 }
301 
302 template <typename T, typename U>
303 inline
304 carto::Volume<bool> operator< ( const carto::Volume<T> & vol, const U & value )
305 {
306  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
307  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::less<T,U>(), value ) );
308 }
309 
310 //--- Scalar [op] Volume -----------------------------------------------------
311 
312 template <typename T, typename U>
313 inline
314 carto::Volume<bool> operator== ( const U & value, const carto::Volume<T> & vol )
315 {
316  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
317  return carto::volumeutil::applyTowards( vol, output, std::bind1st( carto::volumeutil::equal_to<U,T>(), value ) );
318 }
319 
320 template <typename T, typename U>
321 inline
322 carto::Volume<bool> operator!= ( const U & value, const carto::Volume<T> & vol )
323 {
324  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
325  return carto::volumeutil::applyTowards( vol, output, std::bind1st( carto::volumeutil::not_equal_to<U,T>(), value ) );
326 }
327 
328 template <typename T, typename U>
329 inline
330 carto::Volume<bool> operator>= ( const U & value, const carto::Volume<T> & vol )
331 {
332  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
333  return carto::volumeutil::applyTowards( vol, output, std::bind1st( carto::volumeutil::greater_equal<U,T>(), value ) );
334 }
335 
336 template <typename T, typename U>
337 inline
338 carto::Volume<bool> operator<= ( const U & value, const carto::Volume<T> & vol )
339 {
340  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
341  return carto::volumeutil::applyTowards( vol, output, std::bind1st( carto::volumeutil::less_equal<U,T>(), value ) );
342 }
343 
344 template <typename T, typename U>
345 inline
346 carto::Volume<bool> operator> ( const U & value, const carto::Volume<T> & vol )
347 {
348  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
349  return carto::volumeutil::applyTowards( vol, output, std::bind1st( carto::volumeutil::greater<U,T>(), value ) );
350 }
351 
352 template <typename T, typename U>
353 inline
354 carto::Volume<bool> operator< ( const U & value, const carto::Volume<T> & vol )
355 {
356  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
357  return carto::volumeutil::applyTowards( vol, output, std::bind1st( carto::volumeutil::less<U,T>(), value ) );
358 }
359 
360 //--- Volume [op] Volume -----------------------------------------------------
361 
362 template <typename T, typename U>
363 inline
365 {
366  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
368 }
369 
370 template <typename T, typename U>
371 inline
373 {
374  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
376 }
377 
378 template <typename T, typename U>
379 inline
381 {
382  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
384 }
385 
386 template <typename T, typename U>
387 inline
388 carto::Volume<bool> operator<= ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
389 {
390  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
392 }
393 
394 template <typename T, typename U>
395 inline
397 {
398  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
400 }
401 
402 template <typename T, typename U>
403 inline
404 carto::Volume<bool> operator< ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
405 {
406  carto::Volume<bool> output = carto::copyStructure<bool, T>( vol );
407  return carto::volumeutil::applyTowards( vol, other, output, carto::volumeutil::less<T,U>() );
408 }
409 
410 //============================================================================
411 // OPERATORS : ARITHMETICS
412 //============================================================================
413 
414 //--- [op] Volume ------------------------------------------------------------
415 
416 template <typename T>
417 inline
419 {
421 }
422 
423 template <typename T>
424 inline
426 {
428 }
429 
430 template <typename T>
431 inline
433 {
434  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
436 }
437 
438 //--- Volume [op] Scalar -----------------------------------------------------
439 
440 template <typename T, typename U>
441 inline
443 operator+ ( const carto::Volume<T> & vol, const U & value )
444 {
445  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::plus<T,U>(), value ) );
446 }
447 
448 template <typename T, typename U>
449 inline
451 operator- ( const carto::Volume<T> & vol, const U & value )
452 {
453  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::minus<T,U>(), value ) );
454 }
455 
456 template <typename T, typename U>
457 inline
459 operator* ( const carto::Volume<T> & vol, const U & value )
460 {
461  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::multiplies<T,U>(), value ) );
462 }
463 
464 template <typename T, typename U>
465 inline
467 operator/ ( const carto::Volume<T> & vol, const U & value )
468 {
469  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::divides<T,U>(), value ) );
470 }
471 
472 template <typename T, typename U>
473 inline
475 operator% ( const carto::Volume<T> & vol, const U & value )
476 {
477  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::modulus<T,U>(), value ) );
478 }
479 
480 template <typename T, typename U>
481 inline
483 operator& ( const carto::Volume<T> & vol, const U & value )
484 {
485  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_and<T,U>(), value ) );
486 }
487 
488 template <typename T, typename U>
489 inline
491 operator| ( const carto::Volume<T> & vol, const U & value )
492 {
493  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_or<T,U>(), value ) );
494 }
495 
496 template <typename T, typename U>
497 inline
499 operator^ ( const carto::Volume<T> & vol, const U & value )
500 {
501  return carto::volumeutil::apply( vol, std::bind2nd( carto::volumeutil::bitwise_xor<T,U>(), value ) );
502 }
503 
504 template <typename T, typename U>
505 inline
506 carto::Volume<bool> operator&& ( const carto::Volume<T> & vol, const U & value )
507 {
508  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
509  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::logical_and<T,U>(), value ) );
510 }
511 
512 template <typename T, typename U>
513 inline
514 carto::Volume<bool> operator|| ( const carto::Volume<T> & vol, const U & value )
515 {
516  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
517  return carto::volumeutil::applyTowards( vol, output, std::bind2nd( carto::volumeutil::logical_or<T,U>(), value ) );
518 }
519 
520 //--- Scalar [op] Volume -----------------------------------------------------
521 
522 template <typename T, typename U>
523 inline
525 operator+ ( const U & value, const carto::Volume<T> & vol )
526 {
527  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::plus<U,T>(), value ) );
528 }
529 
530 template <typename T, typename U>
531 inline
533 operator- ( const U & value, const carto::Volume<T> & vol )
534 {
535  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::minus<U,T>(), value ) );
536 }
537 
538 template <typename T, typename U>
539 inline
541 operator* ( const U & value, const carto::Volume<T> & vol )
542 {
543  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::multiplies<U,T>(), value ) );
544 }
545 
546 template <typename T, typename U>
547 inline
549 operator/ ( const U & value, const carto::Volume<T> & vol )
550 {
551  return carto::volumeutil::apply( vol, std::bind1st( carto::volumeutil::divides<U,T>(), value ) );
552 }
553 
554 //--- Volume [op] Volume -----------------------------------------------------
555 
556 template <typename T, typename U>
557 inline
559 operator+ ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
560 {
562 }
563 
564 template <typename T, typename U>
565 inline
567 operator- ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
568 {
570 }
571 
572 template <typename T, typename U>
573 inline
575 operator* ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
576 {
578 }
579 
580 template <typename T, typename U>
581 inline
583 operator/ ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
584 {
586 }
587 
588 template <typename T, typename U>
589 inline
591 operator% ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
592 {
594 }
595 
596 template <typename T, typename U>
597 inline
599 operator& ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
600 {
602 }
603 
604 template <typename T, typename U>
605 inline
607 operator| ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
608 {
610 }
611 
612 template <typename T, typename U>
613 inline
615 operator^ ( const carto::Volume<T> & vol, const carto::Volume<U> & other )
616 {
618 }
619 
620 template <typename T, typename U>
621 inline
623 {
624  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
626 }
627 
628 template <typename T, typename U>
629 inline
631 {
632  carto::Volume<bool> output = carto::copyStructure<bool,T>( vol );
634 }
635 
636 //============================================================================
637 // OPERATORS: ARITHMETIC MODIFIERS
638 //============================================================================
639 
640 //--- Volume [op]= Scalar ----------------------------------------------------
641 
642 template <typename T, typename U>
643 inline
644 carto::Volume<T> & operator+= ( carto::Volume<T> & vol, const U & value )
645 {
646  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::plus<T,U>(), value ) );
647 }
648 
649 template <typename T, typename U>
650 inline
651 carto::Volume<T> & operator-= ( carto::Volume<T> & vol, const U & value )
652 {
653  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::minus<T,U>(), value ) );
654 }
655 
656 template <typename T, typename U>
657 inline
658 carto::Volume<T> & operator*= ( carto::Volume<T> & vol, const U & value )
659 {
660  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::multiplies<T,U>(), value ) );
661 }
662 
663 template <typename T, typename U>
664 inline
665 carto::Volume<T> & operator/= ( carto::Volume<T> & vol, const U & value )
666 {
667  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::divides<T,U>(), value ) );
668 }
669 
670 template <typename T, typename U>
671 inline
672 carto::Volume<T> & operator%= ( carto::Volume<T> & vol, const U & value )
673 {
674  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::modulus<T,U>(), value ) );
675 }
676 
677 template <typename T, typename U>
678 inline
679 carto::Volume<T> & operator&= ( carto::Volume<T> & vol, const U & value )
680 {
681  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_and<T,U>(), value ) );
682 }
683 
684 template <typename T, typename U>
685 inline
686 carto::Volume<T> & operator|= ( carto::Volume<T> & vol, const U & value )
687 {
688  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_or<T,U>(), value ) );
689 }
690 
691 template <typename T, typename U>
692 inline
693 carto::Volume<T> & operator^= ( carto::Volume<T> & vol, const U & value )
694 {
695  return carto::volumeutil::selfApply( vol, std::bind2nd( carto::volumeutil::bitwise_xor<T,U>(), value ) );
696 }
697 
698 //--- Volume [op]= Volume ----------------------------------------------------
699 
700 template <typename T, typename U>
701 inline
703 {
705 }
706 
707 template <typename T, typename U>
708 inline
710 {
712 }
713 
714 template <typename T, typename U>
715 inline
717 {
719 }
720 
721 template <typename T, typename U>
722 inline
724 {
726 }
727 
728 template <typename T, typename U>
729 inline
731 {
733 }
734 
735 template <typename T, typename U>
736 inline
738 {
740 }
741 
742 template <typename T, typename U>
743 inline
745 {
747 }
748 
749 template <typename T, typename U>
750 inline
752 {
754 }
755 
756 //============================================================================
757 // INCREMENTS
758 //============================================================================
759 
760 template <typename T>
761 inline
763 {
764  carto::Volume<T> output = vol.deepcopy();
765  ++vol;
766  return output;
767 }
768 
769 template <typename T>
770 inline
772 {
774 }
775 
776 template <typename T>
777 inline
779 {
780  carto::Volume<T> output = vol.deepcopy();
781  --vol;
782  return output;
783 }
784 
785 template <typename T>
786 inline
788 {
790 }
791 
792 #endif // CARTODATA_VOLUME_VOLUMEBASE_D_OPERATORS_H
4D Volume main class
carto::Volume< bool > operator!(const carto::Volume< T > &vol)
carto::Volume< T > operator++(carto::Volume< T > &vol, int)
Volume< T > & selfApply(Volume< T > &vol, UnaryFunction func)
Apply a function to all the elements of a volume (in place version)
Definition: volumeutil.h:395
carto::Volume< typename carto::volumeutil::plus< T, U >::result_type > operator+(const carto::Volume< T > &vol, const U &value)
carto::Volume< T > operator--(carto::Volume< T > &vol, int)
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< typename carto::volumeutil::modulus< 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< T > & operator^=(carto::Volume< T > &vol, const U &value)
bool all() const
True if all values compare to true.
carto::Volume< T > operator-(const carto::Volume< T > &vol)
static bool all(const Volume< T > &vol)
carto::Volume< bool > operator>=(const carto::Volume< T > &vol, const U &value)
carto::Volume< typename carto::volumeutil::divides< 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.
static T min(const Volume< T > &vol)
carto::Volume< typename carto::volumeutil::bitwise_or< T, U >::result_type > operator|(const carto::Volume< T > &vol, const U &value)
Volume< T > copy() const
Create a volume of same dimension and copy the data.
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)
static T max(const Volume< T > &vol)
carto::Volume< T > & operator-=(carto::Volume< T > &vol, const U &value)
carto::Volume< typename carto::volumeutil::multiplies< 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< T > operator~(const carto::Volume< T > &vol)
static T sum(const Volume< T > &vol)
carto::Volume< bool > 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)
carto::Volume< bool > operator!=(const carto::Volume< T > &vol, const U &value)
Volume< T > copyStructure() const
Copy the full data structure without copying the actual data.
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:427
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:352
Volume< T > & operator=(const Volume< T > &other)
Definition: volumebase_d.h:581
static bool all(const Volume< T > &vol)
Volume< T > deepcopy() const
Copy the full data structure.
carto::Volume< typename carto::volumeutil::bitwise_and< T, U >::result_type > operator&(const carto::Volume< T > &vol, const U &value)
static bool any(const Volume< T > &vol)
carto::Volume< T > & operator/=(carto::Volume< T > &vol, const U &value)
bool any() const
True if at least one value compares to true.