OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
memory_c< T, D > Class Template Reference

This class is a container for the memory interface like HeapMemory CudaMemory. More...

Detailed Description

template<typename T, typename D = memory>
class memory_c< T, D >

This class is a container for the memory interface like HeapMemory CudaMemory.

It store the object used to allocate memory and a representation of this memory as an array of objects T

It is mainly used by memory_conf to create the correct memory layout

See Also
memory_traits_inte memory_traits_lin

Definition at line 32 of file memory_c.hpp.

#include <memory_c.hpp>

Public Types

typedef memory_c< T > type
 define T
 
typedef T & reference
 define a reference to T
 
typedef T vtype
 define T
 

Public Member Functions

void setMemory (memory &mem)
 This function set the object that allocate memory. More...
 
memory & getMemory ()
 This function get the object that allocate memory. More...
 
const memory & getMemory () const
 This function get the object that allocate memory. More...
 
bool allocate (const size_t sz)
 This function allocate memory. More...
 
void move_copy (memory_c &mem_c)
 It absorb the allocated object from another memory_c. More...
 
 memory_c ()
 constructor
 
 ~memory_c ()
 destructor
 
void swap (memory_c &mem_obj)
 swap the memory More...
 

Data Fields

D * mem
 object that allocate memory like HeapMemory or CudaMemory
 
memory_array< T > * mem_r
 object that represent the memory as an array of objects T
 

Member Function Documentation

template<typename T , typename D = memory>
bool memory_c< T, D >::allocate ( const size_t  sz)
inline

This function allocate memory.

We create a chunk of memory

we create the representation for this buffer

Definition at line 95 of file memory_c.hpp.

template<typename T , typename D = memory>
memory& memory_c< T, D >::getMemory ( )
inline

This function get the object that allocate memory.

Returns
memory object to allocate memory

Definition at line 76 of file memory_c.hpp.

template<typename T , typename D = memory>
const memory& memory_c< T, D >::getMemory ( ) const
inline

This function get the object that allocate memory.

Returns
memory object to allocate memory

Definition at line 87 of file memory_c.hpp.

template<typename T , typename D = memory>
void memory_c< T, D >::move_copy ( memory_c< T, D > &  mem_c)
inline

It absorb the allocated object from another memory_c.

Parameters
mem_cMemory object

Definition at line 113 of file memory_c.hpp.

template<typename T , typename D = memory>
void memory_c< T, D >::setMemory ( memory &  mem)
inline

This function set the object that allocate memory.

Parameters
memthe memory object

Definition at line 56 of file memory_c.hpp.

template<typename T , typename D = memory>
void memory_c< T, D >::swap ( memory_c< T, D > &  mem_obj)
inline

swap the memory

swap the memory between objects

Definition at line 157 of file memory_c.hpp.


The documentation for this class was generated from the following file: