No longer include llerrorlegacy.h. Updated llstl to include deletion utilites.

This commit is contained in:
Shyotl
2015-06-19 03:54:20 -05:00
parent 283f5298d5
commit 1c627317ec
634 changed files with 8200 additions and 12214 deletions

View File

@@ -33,18 +33,19 @@
#ifndef LL_LLDEPTHSTACK_H
#define LL_LLDEPTHSTACK_H
#include "linked_lists.h"
#include "llstl.h"
template <class DATA_TYPE> class LLDepthStack
{
private:
LLLinkedList<DATA_TYPE> mStack;
std::deque<DATA_TYPE*> mStack;
U32 mCurrentDepth;
U32 mMaxDepth;
public:
LLDepthStack() : mCurrentDepth(0), mMaxDepth(0) {}
~LLDepthStack() {}
LLDepthStack()
: mCurrentDepth(0), mMaxDepth(0)
{}
void setDepth(U32 depth)
{
@@ -60,24 +61,27 @@ public:
{
if (mCurrentDepth < mMaxDepth)
{
mStack.addData(data);
mStack.push_back(data);
mCurrentDepth++;
}
else
{
// the last item falls off stack and is deleted
mStack.getLastData();
mStack.deleteCurrentData();
mStack.addData(data);
if (!mStack.empty())
{
mStack.pop_front();
}
mStack.push_back(data);
}
}
DATA_TYPE *pop()
{
DATA_TYPE *tempp = mStack.getFirstData();
if (tempp)
DATA_TYPE *tempp = NULL;
if (!mStack.empty())
{
mStack.removeCurrentData();
tempp = mStack.back();
mStack.pop_back();
mCurrentDepth--;
}
return tempp;
@@ -85,20 +89,13 @@ public:
DATA_TYPE *check()
{
DATA_TYPE *tempp = mStack.getFirstData();
return tempp;
return mStack.empty() ? NULL : mStack.back();
}
void deleteAllData()
{
mCurrentDepth = 0;
mStack.deleteAllData();
}
void removeAllNodes()
{
mCurrentDepth = 0;
mStack.removeAllNodes();
mStack.clear();
}
};