CudappMemoryArray.h

Go to the documentation of this file.
00001 #ifndef CUDAPPMEMORYARRAY_H_
00002 #define CUDAPPMEMORYARRAY_H_
00003 
00004 #include "CudappMemoryBase.h"
00005 #include "channel_descriptor.h"
00006 
00007 namespace Cudapp
00008 {
00009     class CUDA_SUPPORT_EXPORT MemoryArray : public MemoryBase
00010     {
00011     public:
00012         MemoryArray();
00013         virtual ~MemoryArray();
00014         MemoryArray(const MemoryArray&);
00015         MemoryArray& operator=(const MemoryArray&);
00016 
00017         template<typename T>
00018         void SetFormat() { this->Descriptor = cudaCreateChannelDesc<T>(); }
00019         void SetChannelDescriptor(const cudaChannelFormatDesc& desc) { this->Descriptor = desc; }
00020 
00021         void Allocate(size_t width, size_t height);
00022         virtual void Free();
00023         virtual void MemSet(int value) {}
00024 
00025         void DeepCopy(MemoryArray* source); 
00026 
00027         const cudaChannelFormatDesc& GetDescriptor() const { return this->Descriptor; } 
00028         cudaArray* GetArray() const { return this->Array; }
00029 
00030         size_t GetWidth() const { return this->Width; }
00031         size_t GetHeight() const { return this->Height; }
00032 
00033         //HACK    
00034         virtual bool CopyTo(void* dst, size_t byte_count, size_t offset = 0, MemoryLocation dst_loc = MemoryOnHost) const { return false; }
00035         virtual bool CopyFrom(const void* src, size_t byte_count, size_t offset = 0, MemoryLocation src_loc = MemoryOnHost) { return false; }
00036 
00037         virtual void PrintSelf(std::ostream &os) const;
00038 
00039     protected:
00040 
00041         cudaChannelFormatDesc Descriptor; 
00042         cudaArray* Array; 
00043         size_t Width;  
00044         size_t Height; 
00045     };
00046 }
00047 #endif /*CUDAPPMEMORYARRAY_H_*/

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1