FreeMat

- Main Page
- Related Pages

vtkPriorityQueue

Section: Visualization Toolkit Common Classes

# Usage

vtkPriorityQueue is a general object for creating and manipulating lists of object ids (e.g., point or cell ids). Object ids are sorted according to a user-specified priority, where entries at the top of the queue have the smallest values.

This implementation provides a feature beyond the usual ability to insert and retrieve (or pop) values from the queue. It is also possible to pop any item in the queue given its id number. This allows you to delete entries in the queue which can useful for reinserting an item into the queue.

To create an instance of class vtkPriorityQueue, simply invoke its constructor as follows

      obj = vtkPriorityQueue

# Methods

The class vtkPriorityQueue has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkPriorityQueue class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkPriorityQueue = obj.NewInstance ()`
- `vtkPriorityQueue = obj.SafeDownCast (vtkObject o)`
- `obj.Allocate (vtkIdType sz, vtkIdType ext)` - Allocate initial space for priority queue.
- `obj.Insert (double priority, vtkIdType id)` - Insert id with priority specified. The id is generally an index like a point id or cell id.
- `vtkIdType = obj.Pop (vtkIdType location)` - Same as above but simplified for easier wrapping into interpreted languages.
- `vtkIdType = obj.Peek (vtkIdType location)` - Peek into the queue without actually removing anything. Returns the id.
- `double = obj.DeleteId (vtkIdType id)` - Delete entry in queue with specified id. Returns priority value associated with that id; or VTK_DOUBLE_MAX if not in queue.
- `double = obj.GetPriority (vtkIdType id)` - Get the priority of an entry in the queue with specified id. Returns priority value of that id or VTK_DOUBLE_MAX if not in queue.
- `vtkIdType = obj.GetNumberOfItems ()` - Return the number of items in this queue.
- `obj.Reset ()` - Empty the queue but without releasing memory. This avoids the overhead of memory allocation/deletion.