89 delete[] this->elements;
103 #if NEBULA_BOUNDSCHECKS
106 if ((w > 0) && (h > 0))
108 this->elements =
new TYPE[w * h];
126 for (y = 0; y < this->height; y++)
129 for (x = 0; x < this->width; x++)
131 int flatIndex = y * this->width + x;
132 this->elements[flatIndex] = rhs.
elements[flatIndex];
146 for (y = 0; y < this->height; y++)
149 for (x = 0; x < this->width; x++)
151 int flatIndex = y * this->width + x;
152 this->elements[flatIndex] = val;
201 , elements(rhs.height)
203 rhs.elements =
nullptr;
238 this->elements = rhs.elements;
239 this->height = rhs.height;
240 this->width = rhs.width;
241 rhs.elements =
nullptr;
254 if ((this->width == rhs.
width) && (this->height == rhs.
height))
258 for (y = 0; y < this->height; y++)
261 for (x = 0; x < this->width; x++)
263 int flatIndex = y * this->width + x;
264 if (this->elements[flatIndex] != rhs.
elements[flatIndex])
286 return !(*
this == rhs);
297 this->Allocate(w, h);
327 #if NEBULA_BOUNDSCHECKS
328 n_assert((x >= 0) && (x < this->width));
332 int flatIndex = y * this->width + x;
333 this->elements[flatIndex] = val;
343 #if NEBULA_BOUNDSCHECKS
344 n_assert((x >= 0) && (x < this->width));
348 int flatIndex = y * this->width + x;
349 return this->elements[flatIndex];
A fixed-size 2-dimensional array.
Definition fixedtable.h:18
bool operator==(const FixedTable< TYPE > &rhs) const
equality operator
Definition fixedtable.h:252
FixedTable(SizeT w, SizeT h)
constructor with size
Definition fixedtable.h:161
void Set(IndexT x, IndexT y, const TYPE &val)
set value at [x,y] position
Definition fixedtable.h:325
SizeT width
Definition fixedtable.h:63
bool operator!=(const FixedTable< TYPE > &rhs) const
inequality operator
Definition fixedtable.h:284
FixedTable(SizeT w, SizeT h, const TYPE &val)
constructor with size and initialized contents
Definition fixedtable.h:173
FixedTable()
default constructor
Definition fixedtable.h:72
FixedTable(const FixedTable< TYPE > &rhs)
copy constructor
Definition fixedtable.h:186
void Copy(const FixedTable< TYPE > &src)
copy content
Definition fixedtable.h:120
SizeT Height() const
get height
Definition fixedtable.h:315
TYPE & At(IndexT x, IndexT y) const
access value at [x,y] position
Definition fixedtable.h:341
void SetSize(SizeT w, SizeT h)
set width and height (clears existing content)
Definition fixedtable.h:294
SizeT Width() const
get width
Definition fixedtable.h:305
TYPE * elements
Definition fixedtable.h:65
void Delete()
delete content
Definition fixedtable.h:85
FixedTable(FixedTable< TYPE > &&rhs) noexcept
move constructor
Definition fixedtable.h:198
void operator=(FixedTable< TYPE > &&rhs) noexcept
move assignment operator
Definition fixedtable.h:233
void Allocate(SizeT w, SizeT h)
allocate for given size
Definition fixedtable.h:101
~FixedTable()
destructor
Definition fixedtable.h:212
void operator=(const FixedTable< TYPE > &rhs)
assignment operator
Definition fixedtable.h:222
void Clear(const TYPE &val)
clear the table with value
Definition fixedtable.h:143
SizeT height
Definition fixedtable.h:64
#define n_assert(exp)
Definition debug.h:50
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48