In file /home/blah/darwin2k/src/ddcore/misc/ptrList.h:generic extensible list class.
Public Fields
-
int n
- number of elements currently in the list
-
int max
- maximum number of entries in the list
-
void** list
- array of items
Public Methods
-
ptrList(int Max = 0)
- constructor
-
ptrList(const ptrList &other)
- copy contructor
-
~ptrList(void)
- destructor.
-
ptrList& operator =(const ptrList &other)
- assignment operator
-
inline void* operator()(int i) const
- returns the i'th list entry.
-
inline void*& operator()(int i)
- returns a reference to the i'th list entry.
-
inline void* el(int i) const
- returns the i'th list entry.
-
inline void*& el(int i)
- returns a reference to the i'th list entry.
-
inline void clear(void)
- clears the list by setting the number of elements to zero.
-
int addPtr(void* p)
- adds a pointer to the end of the list, resizing if necessary
-
inline int addInt(int i)
- adds an int to the end of the list, resizing if necessary
-
int isPresent(const void* p) const
- returns 1 if the indicated pointer is present in the list
-
inline int isPresent(int i) const
- returns 1 if the indicated int is in the list
-
inline int getIndex(int i) const
- returns the index of the first occurrence of 'i' in the list, or -1 if not found
-
int getIndex(const void* p) const
- returns the index of the first occurrence of 'p' in the list, or -1 if not found
-
inline int getInt(int i) const
- typecasts the i'th list item to an int and returns it.
-
inline void* last(void)
- returns the last element in the list.
-
int removePtr(const void* p)
- If p is present in the list, the last entry in the list is moved into the first spot in the list where p occurs.
-
int removePtr(int index)
- Removes the specified entry from the list.
-
void merge(const ptrList* other)
- adds any entries in 'other' to this list if they were not already present.
-
void sort(int (*cmp)(const void* p1, const void* p2))
- sorts the entire list using qsort with the given comparison function
-
void sort(int startIdx, int n, int (*cmp)(const void* p1, const void* p2))
- sorts 'n' list entries beginning at 'startIdx' using qsort with the given comparison function
-
int removeNullPointers(void)
- removes any NULL entries from the list.
Documentation
generic extensible list class. This list is resized automatically by
the addPtr() method, but *not* by accessing elements beyond the current
end of the list. Users are responsible for freeing any dynamically
allocated items that they add to the list.
int n
- number of elements currently in the list
int max
- maximum number of entries in the list
void** list
- array of items
ptrList(int Max = 0)
- constructor
ptrList(const ptrList &other)
- copy contructor
~ptrList(void)
- destructor. Does not call delete for items in the list
ptrList& operator =(const ptrList &other)
- assignment operator
inline void* operator()(int i) const
- returns the i'th list entry. WARNING: does not check to make
sure that 'i' is in range
inline void*& operator()(int i)
- returns a reference to the i'th list entry. WARNING: does not
check to make sure that 'i' is in range.
inline void* el(int i) const
- returns the i'th list entry. WARNING: does not check to make
sure that 'i' is in range
inline void*& el(int i)
- returns a reference to the i'th list entry. WARNING: does not
check to make sure that 'i' is in range.
inline void clear(void)
- clears the list by setting the number of elements to zero. Does
not deallocate the actual array, though.
int addPtr(void* p)
- adds a pointer to the end of the list, resizing if necessary
inline int addInt(int i)
- adds an int to the end of the list, resizing if necessary
int isPresent(const void* p) const
- returns 1 if the indicated pointer is present in the list
inline int isPresent(int i) const
- returns 1 if the indicated int is in the list
inline int getIndex(int i) const
- returns the index of the first occurrence of 'i' in the list,
or -1 if not found
int getIndex(const void* p) const
- returns the index of the first occurrence of 'p' in the list,
or -1 if not found
inline int getInt(int i) const
- typecasts the i'th list item to an int and returns it. WARNING:
does not check to make sure 'i' is in range.
inline void* last(void)
- returns the last element in the list. WARNING: this doesn't check to
make sure the list isn't empty.
int removePtr(const void* p)
- If p is present in the list, the last entry in the list is moved into
the first spot in the list where p occurs. Returns the index of p,
or -1 if p was not found in the list.
int removePtr(int index)
- Removes the specified entry from the list. Returns the index,
or -1 if the index was out of range.
void merge(const ptrList* other)
- adds any entries in 'other' to this list if they were not already
present. This uses the simplest possible algorith, so it can be
slow for very large lists.
void sort(int (*cmp)(const void* p1, const void* p2))
- sorts the entire list using qsort with the given comparison function
void sort(int startIdx, int n, int (*cmp)(const void* p1, const void* p2))
- sorts 'n' list entries beginning at 'startIdx' using qsort with the
given comparison function
int removeNullPointers(void)
- removes any NULL entries from the list. Items from the end of the
list are moved to the locations of existing NULL pointers.
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.