78 #ifndef __INCLUDE_MIST_H__
79 #define __INCLUDE_MIST_H__
82 #ifndef __INCLUDE_MIST_CONF_H__
87 #ifndef __INCLUDE_MIST_ALLOC_H__
91 #ifndef __INCLUDE_MIST_ITERATOR_H__
110 template <
class T,
class Allocator = std::allocator< T > >
136 template <
class TT,
class AAllocator = std::allocator< TT > >
173 allocator_.deallocate_objects( data_, size_ );
174 data_ = allocator_.allocate_objects( num );
175 size_ = data_ == NULL ? 0 : num;
177 else if( size_ > num )
179 data_ = allocator_.trim_objects( data_, size_, num );
180 size_ = data_ == NULL ? 0 : num;
183 return( data_ != NULL );
200 if( num_ <= static_cast< difference_type >( index ) || num_ < static_cast< difference_type >( index + num ) )
204 else if( num_ == num )
212 num = size( ) - index;
217 allocator_.copy_objects( paccess( index ), num, out.
paccess( 0 ) );
238 if( is_memory_shared( ) )
242 return( o.
trim( *
this, index, num ) );
247 if( num_ <= static_cast< difference_type >( index ) || num_ < static_cast< difference_type >( index + num ) )
251 else if( num_ == num )
259 if( this->trim( o, index, num ) )
312 allocator_.deallocate_objects( data_, size_ );
325 allocator_.fill_objects( data_, size_ );
337 allocator_.fill_objects( data_, size_, val );
346 bool empty( )
const {
return( size_ == 0 ); }
357 double reso1(
double ){
return( 1.0 ); }
358 double reso1( )
const {
return( 1.0 ); }
359 double reso2(
double ){
return( 1.0 ); }
360 double reso2( )
const {
return( 1.0 ); }
361 double reso3(
double ){
return( 1.0 ); }
362 double reso3( )
const {
return( 1.0 ); }
429 iterator erase( iterator i );
430 iterator erase( iterator s, iterator e );
431 iterator insert( iterator i,
const value_type &val );
432 void insert( iterator i, size_type num,
const value_type &val );
446 template <
class TT,
class AAlocator >
449 if( size_ > o.
size( ) )
451 data_ = allocator_.trim_objects( data_, size_, o.
size( ) );
452 size_ = data_ == NULL ? 0 : o.
size( );
454 else if( size_ < o.
size( ) )
456 allocator_.deallocate_objects( data_, size_ );
457 data_ = allocator_.allocate_objects( o.
size( ) );
458 size_ = data_ == NULL ? 0 : o.
size( );
465 data_[ i ] =
static_cast< value_type >( o[ i ] );
484 if(
this == &o )
return( *
this );
489 if( size_ > o.size_ )
491 data_ = allocator_.trim_objects( data_, size_, o.size_ );
492 size_ = data_ == NULL ? 0 : o.
size( );
494 else if( size_ < o.size_ )
496 allocator_.deallocate_objects( data_, size_ );
497 data_ = allocator_.allocate_objects( o.
size( ) );
498 size_ = data_ == NULL ? 0 : o.
size( );
503 allocator_.copy_objects( o.
data_, size_, data_ );
519 return( data_ + index );
530 return( data_ + index );
546 _CHECK_ACCESS_VIOLATION1U_( index )
547 return( data_[ index ] );
563 _CHECK_ACCESS_VIOLATION1U_( index )
564 return( data_[ index ] );
580 _CHECK_ACCESS_VIOLATION1U_( index )
581 return( data_[ index ] );
597 _CHECK_ACCESS_VIOLATION1U_( index )
598 return( data_[ index ] );
612 _CHECK_ACCESS_VIOLATION1U_( index )
613 return( data_[ index ] );
627 _CHECK_ACCESS_VIOLATION1U_( index )
628 return( data_[ index ] );
633 array( ) : allocator_( ), size_( 0 ), data_( NULL ){}
636 explicit array(
const Allocator &a ) : allocator_( a ), size_( 0 ), data_( NULL ){}
642 data_ = allocator_.allocate_objects( size_ );
643 if( data_ == NULL ) size_ = 0;
646 array(
size_type num,
const Allocator &a ) : allocator_( a ), size_( num ), data_( NULL )
648 data_ = allocator_.allocate_objects( size_ );
649 if( data_ == NULL ) size_ = 0;
656 data_ = allocator_.allocate_objects( size_, val );
657 if( data_ == NULL ) size_ = 0;
662 data_ = allocator_.allocate_objects( size_, val );
663 if( data_ == NULL ) size_ = 0;
670 data_ = allocator_.allocate_objects( s, e );
671 if( data_ == NULL ) size_ = 0;
676 data_ = allocator_.allocate_objects( s, e );
677 if( data_ == NULL ) size_ = 0;
684 data_ = allocator_.allocate_objects( size_ );
685 if( data_ == NULL ) size_ = 0;
690 data_ = allocator_.allocate_objects( size_, val );
691 if( data_ == NULL ) size_ = 0;
699 template <
class TT,
class AAlocator >
702 data_ = allocator_.allocate_objects( size_ );
709 for(
size_type i = 0 ; i < size_ ; i++ ) data_[i] = static_cast< value_type >( o[i] );
716 data_ = allocator_.allocate_objects( size_ );
723 allocator_.copy_objects( o.
data_, size_, data_ );
744 template <
class T,
class Allocator = std::allocator< T > >
770 template <
class TT,
class AAllocator = std::allocator< TT > >
783 double reso1(
double r1 ){
return( reso1_ = r1 ); }
784 double reso1( )
const {
return( reso1_ ); }
785 void reso(
double r1,
double = 1.0,
double = 1.0 ){ reso1_ = r1; }
858 if( base::trim( out, index, num ) )
860 out.reso( reso1( ) );
880 if( base::trim( index, num ) )
905 if( base::swap( a ) )
907 double dmy_reso1_ = reso1_;
929 template <
class TT,
class AAlocator >
932 base::operator =( o );
950 if(
this == &o )
return( *
this );
952 base::operator =( o );
963 explicit array1(
const Allocator &a ) :
base( a ), reso1_( 1.0 ) {}
1002 template <
class TT,
class AAlocator >
1019 template <
class T,
class Allocator = std::allocator< T > >
1045 template <
class TT,
class AAllocator = std::allocator< TT > >
1076 if( base::resize( num1 * num2 ) )
1084 size1_ = size2_ = 0;
1104 if( w_ <= static_cast< difference_type >( x ) || w_ < static_cast< difference_type >( x + w ) )
1108 else if( h_ <= static_cast< difference_type >( y ) || h_ < static_cast< difference_type >( y + h ) )
1112 else if( w_ == w && h_ == h )
1129 out.
reso( base::reso1( ), base::reso2( ) );
1135 po = base::allocator_.copy_objects( pi, w, po );
1136 pi += this->width( );
1159 if( base::is_memory_shared( ) )
1163 return( o.
trim( *
this, x, y, w, h ) );
1170 if( w_ <= static_cast< difference_type >( x ) || w_ < static_cast< difference_type >( x + w ) )
1174 else if( h_ <= static_cast< difference_type >( y ) || h_ < static_cast< difference_type >( y + h ) )
1178 else if( w_ == w && h_ == h )
1186 if( this->trim( o, x, y, w, h ) )
1213 if( base::swap( a ) )
1215 double dmy_reso2_ = reso2_;
1223 a.size1_ = _dmy_size1;
1224 a.size2_ = _dmy_size2;
1241 size1_ = size2_ = 0;
1250 double reso2(
double r2 ){
return( reso2_ = r2 ); }
1251 double reso2( )
const {
return( reso2_ ); }
1259 void reso(
double r1,
double r2,
double = 1.0 ){ base::reso1_ = r1; reso2_ = r2; }
1382 template <
class TT,
class AAlocator >
1385 base::operator =( o );
1387 if( base::empty( ) )
1389 size1_ = size2_ = 0;
1393 size1_ = o.
size1( );
1394 size2_ = o.
size2( );
1397 reso2_ = o.
reso2( );
1414 if(
this == &o )
return( *
this );
1416 base::operator =( o );
1418 if( base::empty( ) )
1420 size1_ = size2_ = 0;
1424 size1_ = o.
size1( );
1425 size2_ = o.
size2( );
1428 reso2_ = o.
reso2( );
1444 return( base::data_ + i + j * size1_ );
1456 return( base::data_ + i + j * size1_ );
1472 _CHECK_ACCESS_VIOLATION2U_( i, j )
1473 return( base::data_[ i + j * size1_ ] );
1489 _CHECK_ACCESS_VIOLATION2U_( i, j )
1490 return( base::data_[ i + j * size1_ ] );
1506 _CHECK_ACCESS_VIOLATION2U_( i, j )
1507 return( base::data_[ i + j * size1_ ] );
1523 _CHECK_ACCESS_VIOLATION2U_( i, j )
1524 return( base::data_[ i + j * size1_ ] );
1533 explicit array2(
const Allocator &a ) :
base( a ), size2_( 0 ), size1_( 0 ), reso2_( 1.0 ) {}
1538 if( base::empty( ) ) size1_ = size2_ = 0;
1545 if( base::empty( ) ) size1_ = size2_ = 0;
1551 if( base::empty( ) ) size1_ = size2_ = 0;
1555 array2(
size_type num1,
size_type num2,
double r1,
double r2,
const Allocator &a ) :
base( num1 * num2, r1, a ), size2_( num2 ), size1_( num1 ), reso2_( r2 )
1557 if( base::empty( ) ) size1_ = size2_ = 0;
1564 if( base::empty( ) ) size1_ = size2_ = 0;
1570 if( base::empty( ) ) size1_ = size2_ = 0;
1576 if( base::empty( ) ) size1_ = size2_ = 0;
1580 array2(
size_type num1,
size_type num2,
double r1,
double r2,
const value_type &val,
const Allocator &a ) :
base( num1 * num2, r1, val, a ), size2_( num2 ), size1_( num1 ), reso2_( r2 )
1582 if( base::empty( ) ) size1_ = size2_ = 0;
1589 if( base::empty( ) ) size1_ = size2_ = 0;
1593 array2(
size_type num1,
size_type num2,
double r1,
double r2,
pointer ptr,
size_type mem_available ) :
base( num1 * num2, r1, ptr, mem_available ), size2_( num2 ), size1_( num1 ), reso2_( r2 )
1595 if( base::empty( ) ) size1_ = size2_ = 0;
1599 array2(
size_type num1,
size_type num2,
double r1,
double r2,
const value_type &val,
pointer ptr,
size_type mem_available ) :
base( num1 * num2, r1, val, ptr, mem_available ), size2_( num2 ), size1_( num1 ), reso2_( r2 )
1601 if( base::empty( ) ) size1_ = size2_ = 0;
1610 template <
class TT,
class AAlocator >
1613 if( base::empty( ) ) size1_ = size2_ = 0;
1619 if( base::empty( ) ) size1_ = size2_ = 0;
1635 template <
class T,
class Allocator = std::allocator< T > >
1661 template <
class TT,
class AAllocator = std::allocator< TT > >
1694 if( base::resize( num1 * num2, num3 ) )
1703 size1_ = size2_ = size3_ = 0;
1726 if( w_ <= static_cast< difference_type >( x ) || w_ < static_cast< difference_type >( x + w ) )
1730 else if( h_ <= static_cast< difference_type >( y ) || h_ < static_cast< difference_type >( y + h ) )
1734 else if( d_ <= static_cast< difference_type >( z ) || d_ < static_cast< difference_type >( z + d ) )
1738 else if( w_ == w && h_ == h && d_ == d )
1757 if( out.
resize( w, h, d ) )
1759 out.
reso( base::reso1( ), base::reso2( ), reso3( ) );
1763 size_type s1 = paccess( x, y + 1, z ) - pi;
1764 size_type s2 = paccess( x, y, z + 1 ) - paccess( x, y + h, z );
1770 po = base::allocator_.copy_objects( pi, w, po );
1799 if( base::is_memory_shared( ) )
1803 return( o.
trim( *
this, x, y, z, w, h, d ) );
1810 if( w_ <= static_cast< difference_type >( x ) || w_ < static_cast< difference_type >( x + w ) )
1814 else if( h_ <= static_cast< difference_type >( y ) || h_ < static_cast< difference_type >( y + h ) )
1818 else if( d_ <= static_cast< difference_type >( z ) || d_ < static_cast< difference_type >( z + d ) )
1822 else if( w_ == w && h_ == h && d_ == d )
1830 if( this->trim( o, x, y, z, w, h, d ) )
1857 if( base::swap( a ) )
1859 double dmy_reso3_ = reso3_;
1869 a.size1_ = _dmy_size1;
1870 a.size2_ = _dmy_size2;
1871 a.size3_ = _dmy_size3;
1889 size1_ = size2_ = size3_ = 0;
1900 double reso3(
double r3 ){
return( reso3_ = r3 ); }
1901 double reso3( )
const {
return( reso3_ ); }
1909 void reso(
double r1,
double r2,
double r3 ){ base::reso1_ = r1; base::reso2_ = r2; reso3_ = r3; }
2134 template <
class TT,
class AAlocator >
2137 base::operator =( o );
2139 if( base::empty( ) )
2141 size1_ = size2_ = size3_ = 0;
2145 size1_ = o.
size1( );
2146 size2_ = o.
size2( );
2147 size3_ = o.
size3( );
2150 reso3_ = o.
reso3( );
2167 if(
this == &o )
return( *
this );
2169 base::operator =( o );
2171 if( base::empty( ) )
2173 size1_ = size2_ = size3_ = 0;
2177 size1_ = o.
size1( );
2178 size2_ = o.
size2( );
2179 size3_ = o.
size3( );
2182 reso3_ = o.
reso3( );
2200 return( base::data_ + i + ( j + k * size2_ ) * size1_ );
2213 return( base::data_ + i + ( j + k * size2_ ) * size1_ );
2229 _CHECK_ACCESS_VIOLATION3U_( i, j, k )
2230 return( base::data_[ i + ( j + k * size2_ ) * size1_ ] );
2246 _CHECK_ACCESS_VIOLATION3U_( i, j, k )
2247 return( base::data_[ i + ( j + k * size2_ ) * size1_ ] );
2263 _CHECK_ACCESS_VIOLATION3U_( i, j, k )
2264 return( base::data_[ i + ( j + k * size2_ ) * size1_ ] );
2280 _CHECK_ACCESS_VIOLATION3U_( i, j, k )
2281 return( base::data_[ i + ( j + k * size2_ ) * size1_ ] );
2287 array3( ) :
base( ), size3_( 0 ), size2_( 0 ), size1_( 0 ), reso3_( 1.0 ) {}
2290 explicit array3(
const Allocator &a ) :
base( a ), size3_( 0 ), size2_( 0 ), size1_( 0 ), reso3_( 1.0 ) {}
2295 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2299 array3(
size_type num1,
size_type num2,
size_type num3,
double r1,
double r2,
double r3 ) :
base( num1 * num2, num3, r1, r2 ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( r3 )
2301 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2307 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2311 array3(
size_type num1,
size_type num2,
size_type num3,
double r1,
double r2,
double r3,
const Allocator &a ) :
base( num1 * num2, num3, r1, r2, a ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( r3 )
2313 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2320 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2324 array3(
size_type num1,
size_type num2,
size_type num3,
double r1,
double r2,
double r3,
const value_type &val ) :
base( num1 * num2, num3, r1, r2, val ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( r3 )
2326 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2330 array3(
size_type num1,
size_type num2,
size_type num3,
const value_type &val,
const Allocator &a ) :
base( num1 * num2, num3, val, a ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( 1.0 )
2332 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2336 array3(
size_type num1,
size_type num2,
size_type num3,
double r1,
double r2,
double r3,
const value_type &val,
const Allocator &a ) :
base( num1 * num2, num3, r1, r2, val, a ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( r3 )
2338 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2344 array3(
size_type num1,
size_type num2,
size_type num3,
pointer ptr,
size_type mem_available ) :
base( num1 * num2, num3, ptr, mem_available ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( 1.0 )
2346 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2350 array3(
size_type num1,
size_type num2,
size_type num3,
double r1,
double r2,
double r3,
pointer ptr,
size_type mem_available ) :
base( num1 * num2, num3, r1, r2, ptr, mem_available ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( r3 )
2352 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2356 array3(
size_type num1,
size_type num2,
size_type num3,
double r1,
double r2,
double r3,
const value_type &val,
pointer ptr,
size_type mem_available ) :
base( num1 * num2, num3, r1, r2, val, ptr, mem_available ), size3_( num3 ), size2_( num2 ), size1_( num1 ), reso3_( r3 )
2358 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2367 template <
class TT,
class AAlocator >
2370 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2376 if( base::empty( ) ) size1_ = size2_ = size3_ = 0;
2390 template <
class Array >
2427 return( base::resize( num1 + margin1_ * 2 ) );
2446 return( base::resize( num1 + margin1_ * 2, num2 + margin2_ * 2 ) );
2466 return( base::resize( num1 + margin1_ * 2, num2 + margin2_ * 2, num3 + margin3_ * 2 ) );
2484 if( base::swap( a ) )
2514 margin1_ = margin2_ = margin3_ = 0;
2526 if( !base::empty( ) )
2531 for( k = 0 ; k < margin3( ) ; k++ )
2533 for( j = 0 ; j < o.
size2( ) ; j++ )
2535 for( i = 0 ; i < o.
size1( ) ; i++ )
2541 for( k = o.
size3( ) - margin3( ) ; k < o.
size3( ) ; k++ )
2543 for( j = 0 ; j < o.
size2( ) ; j++ )
2545 for( i = 0 ; i < o.
size1( ) ; i++ )
2552 for( j = 0 ; j < margin2( ) ; j++ )
2554 for( k = 0 ; k < o.
size3( ) ; k++ )
2556 for( i = 0 ; i < o.
size1( ) ; i++ )
2562 for( j = o.
size2( ) - margin2( ) ; j < o.
size2( ) ; j++ )
2564 for( k = 0 ; k < o.
size3( ) ; k++ )
2566 for( i = 0 ; i < o.
size1( ) ; i++ )
2573 for( i = 0 ; i < margin1( ) ; i++ )
2575 for( k = 0 ; k < o.
size3( ) ; k++ )
2577 for( j = 0 ; j < o.
size2( ) ; j++ )
2583 for( i = o.
size1( ) - margin1( ) ; i < o.
size1( ) ; i++ )
2585 for( k = 0 ; k < o.
size3( ) ; k++ )
2587 for( j = 0 ; j < o.
size2( ) ; j++ )
2597 size_type size1( )
const {
return( base::empty( ) ? 0 : base::size1( ) - 2 * margin1_ ); }
2598 size_type size2( )
const {
return( base::empty( ) ? 0 : base::size2( ) - 2 * margin2_ ); }
2599 size_type size3( )
const {
return( base::empty( ) ? 0 : base::size3( ) - 2 * margin3_ ); }
2618 template <
class T,
class Allocator >
2621 size_type length = base::size( ) < o.
size( ) ? base::size( ) : o.size( );
2622 for( size_type i = 0 ; i < length ; i++ )
2624 ( *this )[ i ] =
static_cast< value_type
>( o[ i ] );
2638 template <
class T,
class Allocator >
2639 const marray& copy(
const array1< T, Allocator > &o )
2641 size_type length = base::size( ) < o.size( ) ? base::size( ) : o.size( );
2642 for( size_type i = 0 ; i < length ; i++ )
2644 ( *this )[ i ] =
static_cast< value_type
>( o[ i ] );
2658 template <
class T,
class Allocator >
2659 const marray& copy(
const array2< T, Allocator > &o )
2661 size_type w = width( ) < o.width( ) ? width( ) : o.width( );
2662 size_type h = height( ) < o.height( ) ? height( ) : o.height( );
2663 for( size_type j = 0 ; j < h ; j++ )
2665 for( size_type i = 0 ; i < w ; i++ )
2667 ( *this )( i, j ) = static_cast< value_type >( o( i, j ) );
2682 template <
class T,
class Allocator >
2683 const marray& copy(
const array3< T, Allocator > &o )
2685 size_type w = width( ) < o.width( ) ? width( ) : o.width( );
2686 size_type h = height( ) < o.height( ) ? height( ) : o.height( );
2687 size_type d = depth( ) < o.depth( ) ? depth( ) : o.depth( );
2688 for( size_type k = 0 ; k < d ; k++ )
2690 for( size_type j = 0 ; j < h ; j++ )
2692 for( size_type i = 0 ; i < w ; i++ )
2694 ( *this )( i, j, k ) = static_cast< value_type >( o( i, j, k ) );
2713 if(
this == &o )
return( *
this );
2715 base::operator =( o );
2733 template <
class T,
class Allocator >
2736 if( base::resize( o.
size( ) + margin1_ * 2 ) )
2738 return( copy( o ) );
2756 template <
class T,
class Allocator >
2759 if( base::resize( o.
size( ) + margin1_ * 2 ) )
2761 reso1( o.
reso1( ) );
2762 return( copy( o ) );
2780 template <
class T,
class Allocator >
2783 if( base::resize( o.
size1( ) + margin1_ * 2, o.
size2( ) + margin2_ * 2 ) )
2785 reso1( o.
reso1( ) );
2786 reso2( o.
reso2( ) );
2787 return( copy( o ) );
2805 template <
class T,
class Allocator >
2808 if( base::resize( o.
size1( ) + margin1_ * 2, o.
size2( ) + margin2_ * 2, o.
size3( ) + margin3_ * 2 ) )
2810 reso1( o.
reso1( ) );
2811 reso2( o.
reso2( ) );
2812 reso3( o.
reso3( ) );
2813 return( copy( o ) );
2831 return( base::at( index + margin1_ ) );
2843 return( base::at( i + margin1_, j + margin2_ ) );
2856 return( base::at( i + margin1_, j + margin2_, k + margin3_ ) );
2868 return( base::at( index + margin1_ ) );
2880 return( base::at( i + margin1_, j + margin2_ ) );
2893 return( base::at( i + margin1_, j + margin2_, k + margin3_ ) );
2905 return( base::operator []( index ) );
2917 return( base::operator ()( index + margin1_ ) );
2929 return( base::operator ()( i + margin1_, j + margin2_ ) );
2942 return( base::operator ()( i + margin1_, j + margin2_, k + margin3_ ) );
2954 return( base::operator []( index ) );
2965 return( base::operator ()( index + margin1_ ) );
2977 return( base::operator ()( i + margin1_, j + margin2_ ) );
2990 return( base::operator ()( i + margin1_, j + margin2_, k + margin3_ ) );
2996 marray( ) :
base( ), margin1_( 0 ), margin2_( 0 ), margin3_( 0 ) {}
3002 marray(
const marray &o ) :
base( o ), margin1_( o.margin1( ) ), margin2_( o.margin2( ) ), margin3_( o.margin3( ) ) {}
3019 template <
class T,
class Allocator >
3021 :
base( o.size( ) + margin1 * 2 ), margin1_( margin1 ), margin2_( 0 ), margin3_( 0 )
3029 template <
class T,
class Allocator >
3031 :
base( o.size( ) + margin1 * 2, o.reso1( ) ), margin1_( margin1 ), margin2_( 0 ), margin3_( 0 )
3039 template <
class T,
class Allocator >
3041 :
base( o.size1( ) + margin1 * 2, o.size2( ) + margin2 * 2, o.reso1( ), o.reso2( ) ), margin1_( margin1 ), margin2_( margin2 ), margin3_( 0 )
3048 template <
class T,
class Allocator >
3050 :
base( o.size1( ) + margin1 * 2, o.size2( ) + margin2 * 2, o.reso1( ), o.reso2( ) ), margin1_( margin1 ), margin2_( margin2 ), margin3_( 0 )
3059 template <
class T,
class Allocator >
3061 :
base( o.size1( ) + margin1 * 2, o.size2( ) + margin2 * 2, o.size3( ) + margin3 * 2, o.reso1( ), o.reso2( ), o.reso3( ) ), margin1_( margin1 ), margin2_( margin2 ), margin3_( margin3 )
3069 template <
class T,
class Allocator >
3071 :
base( o.size1( ) + margin1 * 2, o.size2( ) + margin1 * 2, o.reso1( ), o.reso2( ) ), margin1_( margin1 ), margin2_( margin1 ), margin3_( 0 )
3078 template <
class T,
class Allocator >
3080 :
base( o.size1( ) + margin1 * 2, o.size2( ) + margin1 * 2, o.size3( ) + margin1 * 2, o.reso1( ), o.reso2( ), o.reso3( ) ), margin1_( margin1 ), margin2_( margin1 ), margin3_( margin1 )
3097 template <
class Array >
3127 inline size_t floor_square_index(
size_t v )
3134 for(
size_t i = 1, _2 = 2 ; i < 64 ; i++ )
3152 inline size_t floor_square(
size_t v )
3159 for(
size_t i = 1, _2 = 2 ; i < 64 ; i++ )
3183 if( base::resize( floor_square( num1 ) ) )
3212 s1 = s1 > s2 ? s1 : s2;
3213 if( !base::resize( s1, s1 ) )
3215 size1_ = size2_ = 0;
3242 s1 = s1 > s2 ? s1 : s2;
3243 s1 = s1 > s3 ? s1 : s3;
3245 if( !base::resize( s1, s1, s1 ) )
3247 size1_ = size2_ = size3_ = 0;
3268 if( base::swap( a ) )
3298 size1_ = size2_ = size3_ = 0;
3318 template <
class T,
class Allocator >
3321 size_type length = base::size( ) < o.
size( ) ? base::size( ) : o.size( );
3322 for( size_type i = 0 ; i < length ; i++ )
3324 ( *this )[ i ] =
static_cast< value_type
>( o[ i ] );
3338 template <
class T,
class Allocator >
3339 const buffered_array& copy(
const array1< T, Allocator > &o )
3341 size_type length = base::size( ) < o.size( ) ? base::size( ) : o.size( );
3342 for( size_type i = 0 ; i < length ; i++ )
3344 ( *this )[ i ] =
static_cast< value_type
>( o[ i ] );
3358 template <
class T,
class Allocator >
3359 const buffered_array& copy(
const array2< T, Allocator > &o )
3361 size_type w = width( ) < o.width( ) ? width( ) : o.width( );
3362 size_type h = height( ) < o.height( ) ? height( ) : o.height( );
3363 for( size_type j = 0 ; j < h ; j++ )
3365 for( size_type i = 0 ; i < w ; i++ )
3367 ( *this )( i, j ) = static_cast< value_type >( o( i, j ) );
3382 template <
class T,
class Allocator >
3383 const buffered_array& copy(
const array3< T, Allocator > &o )
3385 size_type w = width( ) < o.width( ) ? width( ) : o.width( );
3386 size_type h = height( ) < o.height( ) ? height( ) : o.height( );
3387 size_type d = depth( ) < o.depth( ) ? depth( ) : o.depth( );
3388 for( size_type k = 0 ; k < d ; k++ )
3390 for( size_type j = 0 ; j < h ; j++ )
3392 for( size_type i = 0 ; i < w ; i++ )
3394 ( *this )( i, j, k ) = static_cast< value_type >( o( i, j, k ) );
3414 if(
this == &o )
return( *
this );
3416 base::operator =( o );
3418 if( base::empty( ) )
3420 size1_ = size2_ = size3_ = 0;
3442 template <
class T,
class Allocator >
3445 resize( o.
size( ) );
3446 return( copy( o ) );
3459 template <
class T,
class Allocator >
3462 resize( o.
size( ) );
3463 reso1( o.
reso1( ) );
3464 return( copy( o ) );
3477 template <
class T,
class Allocator >
3481 reso1( o.
reso1( ) );
3482 reso2( o.
reso2( ) );
3483 return( copy( o ) );
3496 template <
class T,
class Allocator >
3500 reso1( o.
reso1( ) );
3501 reso2( o.
reso2( ) );
3502 reso3( o.
reso3( ) );
3503 return( copy( o ) );
3514 template <
class T,
class Allocator >
3516 :
base( floor_square( o.size( ) ) ), size1_( o.size( ) ), size2_( 0 ), size3_( 0 )
3522 template <
class T,
class Allocator >
3524 :
base( floor_square( o.size( ) ), o.reso1( ) ), size1_( o.size( ) ), size2_( 0 ), size3_( 0 )
3530 template <
class T,
class Allocator >
3532 :
base( floor_square( o.size1( ) ), floor_square( o.size2( ) ), o.reso1( ), o.reso2( ) ), size1_( o.size1( ) ), size2_( o.size2( ) ), size3_( 0 )
3538 template <
class T,
class Allocator >
3540 :
base( floor_square( o.size1( ) ), floor_square( o.size2( ) ), floor_square( o.size3( ) ), o.reso1( ), o.reso2( ), o.reso3( ) ),
3541 size1_( o.size1( ) ), size2_( o.size2( ) ), size3_( o.size3( ) )
3559 template <
class T,
class Allocator >
3560 inline std::ostream &operator <<( std::ostream &out, const array< T, Allocator > &a )
3563 for( i = 0 ; i < a.
size( ) ; i++ )
3566 if( i != a.
size1( ) - 1 ) out <<
", ";
3584 template <
class T,
class Allocator >
3585 inline std::ostream &operator <<( std::ostream &out, const array1< T, Allocator > &a )
3588 for( i = 0 ; i < a.
size( ) ; i++ )
3591 if( i != a.
size1( ) - 1 ) out <<
", ";
3611 template <
class T,
class Allocator >
3612 inline std::ostream &operator <<( std::ostream &out, const array2< T, Allocator > &a )
3615 for( j = 0 ; j < a.
size2( ) ; j++ )
3621 for( i = 0 ; i < a.
size1( ) ; i++ )
3624 if( i != a.
size1( ) - 1 ) out <<
", ";
3649 template <
class T,
class Allocator >
3650 inline std::ostream &operator <<( std::ostream &out, const array3< T, Allocator > &a )
3653 for( k = 0 ; k < a.
size3( ) ; k++ )
3655 for( j = 0 ; j < a.
size2( ) ; j++ )
3657 for( i = 0 ; i < a.
size1( ) ; i++ )
3659 out << a( i, j, k );
3660 if( i != a.
size1( ) - 1 ) out <<
", ";
3664 if( k != a.
size3( ) - 1 )
3666 out <<
"----- separator -----";
3678 #if defined(_ARRAY_BIND_OPERATION_SUPPORT_) && _ARRAY_BIND_OPERATION_SUPPORT_ != 0
3682 #if defined(_ARRAY1_BIND_OPERATION_SUPPORT_) && _ARRAY1_BIND_OPERATION_SUPPORT_ != 0
3686 #if defined(_ARRAY2_BIND_OPERATION_SUPPORT_) && _ARRAY2_BIND_OPERATION_SUPPORT_ != 0
3690 #if defined(_ARRAY3_BIND_OPERATION_SUPPORT_) && _ARRAY3_BIND_OPERATION_SUPPORT_ != 0
3699 #endif // __INCLUDE_MIST_H__