Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PINDEX PAbstractList::GetObjectsIndex ( const PObject obj ) const [virtual]

Search the collection for the specific instance of the object. The object pointers are compared, not the values. A simple linear search from "head" of the list is performed.

Returns:
ordinal index position of the object, or P_MAX_INDEX.
Parameters:
objObject to find.

Implements PCollection.

Definition at line 692 of file collect.cxx.

Referenced by Insert(), PAbstractSortedList::Remove(), and Remove().

{
  PINDEX index = 0;
  Element * element = info->head;
  while (element != NULL) {
    if (element->data == obj) {
      info->lastElement = element;
      info->lastIndex = index;
      return index;
    }
    element = element->next;
    index++;
  }

  return P_MAX_INDEX;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index