@@ -65,10 +65,10 @@ struct PlaneBase
6565 void memcpyToDevice ( void * dst, int dst_pitch, void * src, int src_pitch, short cols, short rows, int elemSize, cudaStream_t stream );
6666
6767 __host__
68- void memcpyToHost ( void * dst, int dst_pitch, void * src, int src_pitch, short cols, short rows, int elemSize );
68+ void memcpyToHost ( void * dst, int dst_pitch, void * src, int src_pitch, short cols, short rows, int elemSize ) const ;
6969
7070 __host__
71- void memcpyToHost ( void * dst, int dst_pitch, void * src, int src_pitch, short cols, short rows, int elemSize, cudaStream_t stream );
71+ void memcpyToHost ( void * dst, int dst_pitch, void * src, int src_pitch, short cols, short rows, int elemSize, cudaStream_t stream ) const ;
7272
7373#ifdef PLANE2D_CUDA_OP_DEBUG
7474 __host__
@@ -130,17 +130,18 @@ template <typename T> struct PitchPlane2D : public PlaneT<T>
130130
131131 /* * cuda memcpy from parameter (plane allocated on device) to
132132 * this (plane allocated on host) */
133- __host__ inline void memcpyFromDevice ( PitchPlane2D<T>& devPlane,
133+ __host__ inline void memcpyFromDevice ( const PitchPlane2D<T>& devPlane,
134134 short cols, short rows );
135- __host__ inline void memcpyFromDevice ( PitchPlane2D<T>& devPlane,
136- short cols, short rows, cudaStream_t stream );
135+ __host__ inline void memcpyFromDevice ( const PitchPlane2D<T>& devPlane,
136+ short cols, short rows,
137+ cudaStream_t stream );
137138
138139 /* * cuda memcpy from this (plane allocated on device) to
139140 * parameter (plane allocated on host) */
140141 __host__ inline void memcpyToHost ( PitchPlane2D<T>& hostPlane,
141- short cols, short rows );
142+ short cols, short rows ) const ;
142143 __host__ inline void memcpyToHost ( PitchPlane2D<T>& hostPlane,
143- short cols, short rows, cudaStream_t stream );
144+ short cols, short rows, cudaStream_t stream ) const ;
144145
145146 __host__ __device__ inline const T* ptr ( int y ) const {
146147 return (const T*)( (const char *)this ->data + y * _pitchInBytes );
@@ -219,7 +220,7 @@ inline void PitchPlane2D<T>::memcpyFromHost( PitchPlane2D<T>& hostPlane, short c
219220
220221template <typename T>
221222__host__
222- inline void PitchPlane2D<T>::memcpyFromDevice( PitchPlane2D<T>& devPlane, short cols, short rows )
223+ inline void PitchPlane2D<T>::memcpyFromDevice( const PitchPlane2D<T>& devPlane, short cols, short rows )
223224{
224225 PlaneBase::memcpyToHost ( this ->data , this ->_pitchInBytes ,
225226 devPlane.data , devPlane._pitchInBytes ,
@@ -229,7 +230,7 @@ inline void PitchPlane2D<T>::memcpyFromDevice( PitchPlane2D<T>& devPlane, short
229230
230231template <typename T>
231232__host__
232- inline void PitchPlane2D<T>::memcpyFromDevice( PitchPlane2D<T>& devPlane, short cols, short rows, cudaStream_t stream )
233+ inline void PitchPlane2D<T>::memcpyFromDevice( const PitchPlane2D<T>& devPlane, short cols, short rows, cudaStream_t stream )
233234{
234235 PlaneBase::memcpyToHost ( this ->data , this ->_pitchInBytes ,
235236 devPlane.data , devPlane._pitchInBytes ,
@@ -240,14 +241,14 @@ inline void PitchPlane2D<T>::memcpyFromDevice( PitchPlane2D<T>& devPlane, short
240241
241242template <typename T>
242243__host__
243- inline void PitchPlane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane, short cols, short rows )
244+ inline void PitchPlane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane, short cols, short rows ) const
244245{
245246 hostPlane.memcpyFromDevice ( *this , cols, rows );
246247}
247248
248249template <typename T>
249250__host__
250- inline void PitchPlane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane, short cols, short rows, cudaStream_t stream )
251+ inline void PitchPlane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane, short cols, short rows, cudaStream_t stream ) const
251252{
252253 hostPlane.memcpyFromDevice ( *this , cols, rows, stream );
253254}
@@ -319,17 +320,17 @@ template <typename T> class Plane2D : public PitchPlane2D<T>
319320
320321 /* * cuda memcpy from parameter (plane allocated on device) to
321322 * this (plane allocated on host) */
322- __host__ inline void memcpyFromDevice ( Plane2D<T>& devPlane );
323- __host__ inline void memcpyFromDevice ( PitchPlane2D<T>& devPlane );
324- __host__ inline void memcpyFromDevice ( Plane2D<T>& devPlane, cudaStream_t stream );
325- __host__ inline void memcpyFromDevice ( PitchPlane2D<T>& devPlane, cudaStream_t stream );
323+ __host__ inline void memcpyFromDevice ( const Plane2D<T>& devPlane );
324+ __host__ inline void memcpyFromDevice ( const PitchPlane2D<T>& devPlane );
325+ __host__ inline void memcpyFromDevice ( const Plane2D<T>& devPlane, cudaStream_t stream );
326+ __host__ inline void memcpyFromDevice ( const PitchPlane2D<T>& devPlane, cudaStream_t stream );
326327
327328 /* * cuda memcpy from this (plane allocated on device) to
328329 * parameter (plane allocated on host) */
329- __host__ inline void memcpyToHost ( Plane2D<T>& hostPlane );
330- __host__ inline void memcpyToHost ( Plane2D<T>& hostPlane, cudaStream_t stream );
331- __host__ inline void memcpyToHost ( PitchPlane2D<T>& hostPlane );
332- __host__ inline void memcpyToHost ( PitchPlane2D<T>& hostPlane, cudaStream_t stream );
330+ __host__ inline void memcpyToHost ( Plane2D<T>& hostPlane ) const ;
331+ __host__ inline void memcpyToHost ( Plane2D<T>& hostPlane, cudaStream_t stream ) const ;
332+ __host__ inline void memcpyToHost ( PitchPlane2D<T>& hostPlane ) const ;
333+ __host__ inline void memcpyToHost ( PitchPlane2D<T>& hostPlane, cudaStream_t stream ) const ;
333334
334335 __host__ __device__
335336 inline short getCols ( ) const { return _cols; }
@@ -460,7 +461,7 @@ inline void Plane2D<T>::memcpyFromHost( PitchPlane2D<T>& hostPlane, cudaStream_t
460461
461462template <typename T>
462463__host__
463- inline void Plane2D<T>::memcpyFromDevice( Plane2D<T>& devPlane )
464+ inline void Plane2D<T>::memcpyFromDevice( const Plane2D<T>& devPlane )
464465{
465466 assert ( devPlane._cols == this ->_cols );
466467 assert ( devPlane._rows == this ->_rows );
@@ -469,14 +470,14 @@ inline void Plane2D<T>::memcpyFromDevice( Plane2D<T>& devPlane )
469470
470471template <typename T>
471472__host__
472- inline void Plane2D<T>::memcpyFromDevice( PitchPlane2D<T>& devPlane )
473+ inline void Plane2D<T>::memcpyFromDevice( const PitchPlane2D<T>& devPlane )
473474{
474475 PitchPlane2D<T>::memcpyFromDevice ( devPlane, this ->_cols , this ->_rows );
475476}
476477
477478template <typename T>
478479__host__
479- inline void Plane2D<T>::memcpyFromDevice( Plane2D<T>& devPlane, cudaStream_t stream )
480+ inline void Plane2D<T>::memcpyFromDevice( const Plane2D<T>& devPlane, cudaStream_t stream )
480481{
481482 assert ( devPlane._cols == this ->_cols );
482483 assert ( devPlane._rows == this ->_rows );
@@ -485,35 +486,35 @@ inline void Plane2D<T>::memcpyFromDevice( Plane2D<T>& devPlane, cudaStream_t str
485486
486487template <typename T>
487488__host__
488- inline void Plane2D<T>::memcpyFromDevice( PitchPlane2D<T>& devPlane, cudaStream_t stream )
489+ inline void Plane2D<T>::memcpyFromDevice( const PitchPlane2D<T>& devPlane, cudaStream_t stream )
489490{
490491 PitchPlane2D<T>::memcpyFromDevice ( devPlane, this ->_cols , this ->_rows , stream );
491492}
492493
493494template <typename T>
494495__host__
495- inline void Plane2D<T>::memcpyToHost( Plane2D<T>& hostPlane )
496+ inline void Plane2D<T>::memcpyToHost( Plane2D<T>& hostPlane ) const
496497{
497498 hostPlane.memcpyFromDevice ( *this );
498499}
499500
500501template <typename T>
501502__host__
502- inline void Plane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane )
503+ inline void Plane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane ) const
503504{
504505 hostPlane.memcpyFromDevice ( *this , this ->_cols , this ->_rows );
505506}
506507
507508template <typename T>
508509__host__
509- inline void Plane2D<T>::memcpyToHost( Plane2D<T>& hostPlane, cudaStream_t stream )
510+ inline void Plane2D<T>::memcpyToHost( Plane2D<T>& hostPlane, cudaStream_t stream ) const
510511{
511512 hostPlane.memcpyFromDevice ( *this , stream );
512513}
513514
514515template <typename T>
515516__host__
516- inline void Plane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane, cudaStream_t stream )
517+ inline void Plane2D<T>::memcpyToHost( PitchPlane2D<T>& hostPlane, cudaStream_t stream ) const
517518{
518519 hostPlane.memcpyFromDevice ( *this , this ->_cols , this ->_rows , stream );
519520}
0 commit comments