parent
59aed37d3e
commit
151a1f0d1b
|
@ -142,6 +142,7 @@ RB_METHOD(tableSetAt)
|
||||||
}
|
}
|
||||||
|
|
||||||
MARSH_LOAD_FUN(Table)
|
MARSH_LOAD_FUN(Table)
|
||||||
|
INITCOPY_FUN(Table)
|
||||||
|
|
||||||
void
|
void
|
||||||
tableBindingInit()
|
tableBindingInit()
|
||||||
|
@ -156,6 +157,7 @@ tableBindingInit()
|
||||||
rb_define_class_method(klass, "_load", TableLoad);
|
rb_define_class_method(klass, "_load", TableLoad);
|
||||||
|
|
||||||
_rb_define_method(klass, "initialize", tableInitialize);
|
_rb_define_method(klass, "initialize", tableInitialize);
|
||||||
|
_rb_define_method(klass, "initialize_copy", TableInitializeCopy);
|
||||||
_rb_define_method(klass, "resize", tableResize);
|
_rb_define_method(klass, "resize", tableResize);
|
||||||
_rb_define_method(klass, "xsize", tableXSize);
|
_rb_define_method(klass, "xsize", tableXSize);
|
||||||
_rb_define_method(klass, "ysize", tableYSize);
|
_rb_define_method(klass, "ysize", tableYSize);
|
||||||
|
|
|
@ -36,6 +36,14 @@ Table::Table(int x, int y /*= 1*/, int z /*= 1*/)
|
||||||
data = static_cast<int16_t*>(calloc(x * y * z, sizeof(int16_t)));
|
data = static_cast<int16_t*>(calloc(x * y * z, sizeof(int16_t)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Table::Table(const Table &other)
|
||||||
|
:m_x(other.m_x), m_y(other.m_y), m_z(other.m_z)
|
||||||
|
{
|
||||||
|
const size_t size = m_x * m_y * m_z * sizeof(int16_t);;
|
||||||
|
data = static_cast<int16_t*>(malloc(size));
|
||||||
|
memcpy(data, other.data, size);
|
||||||
|
}
|
||||||
|
|
||||||
Table::~Table()
|
Table::~Table()
|
||||||
{
|
{
|
||||||
free(data);
|
free(data);
|
||||||
|
|
|
@ -31,6 +31,8 @@ class Table : public Serializable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Table(int x, int y = 1, int z = 1);
|
Table(int x, int y = 1, int z = 1);
|
||||||
|
/* Clone constructor */
|
||||||
|
Table(const Table &other);
|
||||||
virtual ~Table();
|
virtual ~Table();
|
||||||
|
|
||||||
int xSize() const { return m_x; }
|
int xSize() const { return m_x; }
|
||||||
|
|
Loading…
Reference in New Issue