OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
memory.hpp
1 /*
2  * memory.hpp
3  *
4  * Created on: Aug 8, 2014
5  * Author: Pietro Incardona
6  */
7 
14 #ifndef MEMORY_HPP_
15 #define MEMORY_HPP_
16 
17 typedef long int mem_id;
18 
19 #include "config.h"
20 #include <stddef.h>
21 
22 class memory
23 {
24  public:
25 
30  virtual bool flush() = 0;
31 
40  virtual bool allocate(size_t sz) = 0;
41 
49  virtual bool resize(size_t sz) = 0;
50 
56  virtual void destroy() = 0;
57 
58 
64  virtual bool copy(const memory & m) = 0;
65 
70  virtual size_t size() const = 0;
71 
78  virtual void * getPointer() = 0;
79 
86  virtual const void * getPointer() const = 0;
87 
93  virtual ~memory() {};
94 
99  virtual void incRef() = 0;
100 
105  virtual void decRef() = 0;
106 
112  virtual long int ref() = 0;
113 
119  virtual bool isInitialized() = 0;
120 
126  virtual void * getDevicePointer() = 0;
127 
132  virtual void deviceToHost() = 0;
133 
134 };
135 
136 #endif
virtual size_t size() const =0
get the size of the buffer
virtual bool resize(size_t sz)=0
resize on device a buffer
virtual bool flush()=0
Flush the memory into the device.
virtual long int ref()=0
Return the actual reference counter.
virtual bool copy(const memory &m)=0
Copy the memory from one device to another device.
virtual void destroy()=0
Destroy the buffer on the device.
virtual bool allocate(size_t sz)=0
allocate on device a buffer of
virtual void * getDevicePointer()=0
Return the device pointer of the memory.
virtual void deviceToHost()=0
Copy the memory from device to host.
virtual void decRef()=0
Decrement the internal reference counter.
virtual ~memory()
destructor
Definition: memory.hpp:93
virtual bool isInitialized()=0
Return if the actual memory that is going to be allocated is already initialized. ...
virtual void * getPointer()=0
return a data pointer
virtual void incRef()=0
Increment the internal reference counter.