Packing class.
This class pack objects primitives vectors and grids, the general usage is to create a vector of packing request (std::vector<size_t>) that contain the size of the required space needed to pack the information. Calculate the total size, allocating it on HeapMemory (for example), Create an ExtPreAlloc memory object giving the preallocated memory to it and finally Pack all the objects subsequently
unsigned char uc = 1;
char c = 2;
short s = 3;
unsigned short us = 4;
int i = 5;
unsigned int ui = 6;
long int li = 7;
unsigned long int uli = 8;
float f = 9;
double d = 10;
size_t sz[] = {16,16,16};
g.setMemory();
fill_grid<3>(g);
size_t size_total = 0;
size_t size_total_old = 0;
BOOST_REQUIRE_EQUAL(size_total,sizeof(unsigned char));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(char));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(short));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(unsigned short));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(int));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(unsigned int));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(long int));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(long unsigned int));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(float));
size_total_old = size_total;
BOOST_REQUIRE_EQUAL(size_total - size_total_old,sizeof(double));
size_total_old = size_total;
#ifndef SE_CLASS3
BOOST_REQUIRE_EQUAL(size_total - size_total_old,(sizeof(float)*4 + sizeof(float[3]) + sizeof(float[3][3])));
#endif
size_total_old = size_total;
#ifndef SE_CLASS3
BOOST_REQUIRE_EQUAL(size_total - size_total_old,(sizeof(float) + sizeof(float[3])) * v.size() + sizeof(v.size()));
#endif
size_total_old = size_total;
#ifndef SE_CLASS3
BOOST_REQUIRE_EQUAL(size_total - size_total_old,(sizeof(float) + sizeof(float[3])) * sub.getVolume());
#endif
virtual void incRef()
Increment the reference counter.
This class allocate, and destroy CPU memory.
virtual bool allocate(size_t sz)
allocate memory
static void pack(ExtPreAlloc< Mem >, const T &obj)
Error, no implementation.
static size_t packRequest(const T &obj, size_t &req)
Error, no implementation.
Test structure used for several test.
Declaration grid_key_dx_iterator_sub.
Implementation of 1-D std::vector like structure.