52 #ifndef __PCL_PixelAllocator_h
53 #define __PCL_PixelAllocator_h
58 #include <pcl/Diagnostics.h>
67 template <
class P>
class PCL_CLASS GenericImage;
124 using sample =
typename pixel_traits::sample;
150 PCL_PRECONDITION( n != 0 )
151 return reinterpret_cast<sample*
>( SharedPixelData::Allocate( n*
sizeof(
sample ) ) );
183 PCL_PRECONDITION( n != 0 )
184 sample** cslots =
reinterpret_cast<sample**
>( SharedPixelData::Allocate( n*
sizeof(
sample* ) ) );
185 ::memset( cslots, 0, n*
sizeof(
sample* ) );
199 template <
typename T>
202 PCL_PRECONDITION( p !=
nullptr )
203 SharedPixelData::Deallocate(
reinterpret_cast<void*
>( p ) );
211 :
SharedPixelData( handle, P::BitsPerSample(), P::IsFloatSample(), P::IsComplexSample() )
215 PixelAllocator(
const PixelAllocator<P>& x )
216 : SharedPixelData( x )
220 PixelAllocator(
int width,
int height,
int numberOfChannels,
int colorSpace )
221 : SharedPixelData( width, height, numberOfChannels, P::BitsPerSample(), P::IsFloatSample(), colorSpace )
225 PixelAllocator& operator =(
const PixelAllocator<P>& x )
227 (void)SharedPixelData::operator =( x );
231 sample** GetSharedData()
const
233 return reinterpret_cast<sample**
>( SharedPixelData::GetSharedData() );
236 void SetSharedData( sample** ptrToShared )
238 SharedPixelData::SetSharedData(
reinterpret_cast<void**
>( ptrToShared ) );
Implements a generic, two-dimensional, shared or local image.
Manages transparent allocation and deallocation of shared and local pixel data.
sample ** AllocateChannelSlots(size_type n) const
sample * AllocatePixels(int width, int height) const
void Deallocate(T *p) const
typename pixel_traits::sample sample
sample * AllocatePixels(size_type n) const
Handles transparent, type-independent allocation of local and shared pixel data blocks.
bool operator==(const SharedPixelData &x) const noexcept
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept