Added deleteAll() member to VoxelNodeBag class

This commit is contained in:
ZappoMan 2013-04-27 12:04:33 -07:00
parent 70818bd3fe
commit 5758e42870
2 changed files with 12 additions and 2 deletions

View file

@ -15,11 +15,19 @@
#include <OctalCode.h>
VoxelNodeBag::~VoxelNodeBag() {
deleteAll();
}
void VoxelNodeBag::deleteAll() {
if (_bagElements) {
delete[] _bagElements;
}
_bagElements = NULL;
_elementsInUse = 0;
_sizeOfElementsArray = 0;
}
const int GROW_BAG_BY = 100;
// put a node into the bag

View file

@ -29,8 +29,10 @@ public:
void insert(VoxelNode* node); // put a node into the bag
VoxelNode* extract(); // pull a node out of the bag (could come in any order)
bool isEmpty() const { return (_elementsInUse == 0); }
int count() const { return _elementsInUse; }
bool isEmpty() const { return (_elementsInUse == 0); };
int count() const { return _elementsInUse; };
void deleteAll();
private: