OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
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 31 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...
 
memorygetMemory ()
 This function get the object that allocate memory. More...
 
const memorygetMemory () const
 This function get the object that allocate memory. More...
 
bool allocate (const size_t sz, bool skip_initialization=false)
 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

Dmem
 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,
bool  skip_initialization = false 
)
inline

This function allocate memory.

We create a chunk of memory

we create the representation for this buffer

Definition at line 94 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 75 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 86 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 112 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 55 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 156 of file memory_c.hpp.


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