This commit is contained in:
parent
7551b4f12e
commit
8788076d39
37 changed files with 11186 additions and 0 deletions
61
Utils/Libs/DaveLib/List.h
Normal file
61
Utils/Libs/DaveLib/List.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/**********************/
|
||||
/*** Vtx List Class ***/
|
||||
/**********************/
|
||||
|
||||
#if !defined __VTXLIST_CLASS_HEADER__
|
||||
#define __VTXLIST_CLASS_HEADER__
|
||||
|
||||
#include <Vector>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
template <class T> class CList
|
||||
{
|
||||
public:
|
||||
|
||||
int Find(T &Item)
|
||||
{
|
||||
int ListSize=List.size();
|
||||
|
||||
for (int i=0; i<ListSize; i++)
|
||||
{
|
||||
if (List[i]==Item) return(i);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int Add(T &Item)
|
||||
{
|
||||
int ListSize=List.size();
|
||||
int Idx=Find(Item); // Check if exists
|
||||
|
||||
if (Idx!=-1) return(Idx);
|
||||
List.push_back(Item);
|
||||
return(ListSize);
|
||||
}
|
||||
|
||||
int push_back(T &Item)
|
||||
{
|
||||
int ListSize=List.size();
|
||||
List.push_back(Item);
|
||||
return(ListSize);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
List.clear();
|
||||
}
|
||||
|
||||
int size() {return(List.size());}
|
||||
|
||||
std::vector<T> &GetList() {return(List);}
|
||||
|
||||
T& operator []( int nIndex ) {return(List[nIndex]);}
|
||||
|
||||
private:
|
||||
std::vector<T> List;
|
||||
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue