CudappMemoryPitch.h
Go to the documentation of this file.00001 #ifndef CUDAPPMEMORYPITCH_H_
00002 #define CUDAPPMEMORYPITCH_H_
00003
00004 #include "CudappMemoryBase.h"
00005 namespace Cudapp
00006 {
00007 class CUDA_SUPPORT_EXPORT MemoryPitch : public MemoryBase
00008 {
00009 public:
00010 MemoryPitch();
00011 virtual ~MemoryPitch();
00012 MemoryPitch(const MemoryPitch&);
00013 MemoryPitch& operator=(const MemoryPitch&);
00014
00015 void* AllocatePitchBytes(size_t width, size_t height, size_t typeSize);
00016 virtual void Free();
00017
00018 virtual void MemSet(int value);
00019
00020 template<typename T> T* AllocatePitch(size_t width, size_t height)
00021 { return (T*)this->AllocatePitchBytes(width, height, sizeof(T)); }
00022
00023 void* GetMemPointer() { return this->MemPointer; }
00024 const void* GetMemPointer() const { return this->MemPointer; }
00025
00026 size_t GetPitch() const { return this->Pitch; }
00027 size_t GetWidth() const { return this->Width; }
00028 size_t GetHeight() const { return this->Height; }
00029
00030
00031 virtual bool CopyTo(void* dst, size_t byte_count, size_t offset = 0, MemoryLocation dst_loc = MemoryOnHost) { return false; }
00032 virtual bool CopyFrom(void* src, size_t byte_count, size_t offset = 0, MemoryLocation src_loc = MemoryOnHost) { return false; }
00033
00034
00035 virtual void PrintSelf (std::ostream &os) const;
00036 protected:
00037
00038 size_t Pitch;
00039 size_t Width;
00040 size_t Height;
00041
00042 void* MemPointer;
00043 };
00044 }
00045 #endif