00001 #ifndef __UT_Integers__
00002 #define __UT_Integers__
00003
00004 #include "UT_API.h"
00005
00006
00007
00008
00009
00010
00011
00012 class UT_API UT_Integers
00013 {
00014 public:
00015 UT_Integers() { list = iterator = (int *)0; nentries = size = 0; }
00016 ~UT_Integers() { if( list ) delete list; }
00017
00018 long index(int contents) const;
00019 long addMember(int value);
00020 int removeMember(long index);
00021 void insertMember(int value, long index);
00022
00023 void iterateInit(long index = 0);
00024 int iterateGet(int *value);
00025
00026 void iterateReverseInit(long index = 0);
00027 int iterateReverseGet(int *value);
00028
00029 long count() const { return nentries; }
00030 void empty();
00031
00032 int &operator[](long index);
00033
00034 void sortIntegers(int (*compare)(const void *, const void *));
00035 long searchIntegers(int (*compare)(const void *, const void *),
00036 const void *key) const;
00037
00038 UT_Integers &operator=(const UT_Integers &from);
00039
00040 private:
00041 void grow(long newsize);
00042
00043 int *list;
00044 int *iterator;
00045 long size;
00046 long nentries;
00047 };
00048
00049 #endif