cgma
PriorityQueue.hpp
Go to the documentation of this file.
00001 #ifndef PRIORITYQUEUE_HPP
00002 #define PRIORITYQUEUE_HPP
00003 #include <vector>
00004 
00005 template <class Object>
00006 class PriorityQueue
00007 {
00008 public:
00009   typedef bool (*CompareFunc)(Object &a, Object &b);
00010   PriorityQueue(CompareFunc compare);
00011   int size() const;
00012   bool empty() const;
00013 
00014   const Object top() const;
00015   void push(Object x);
00016   void pop();
00017 
00018   int where_is_item(Object &a, int start_index=1, bool queue_is_valid=false);
00019   bool update_item(Object &a, bool queue_is_valid=false);
00020   bool update_item(int object_index);
00021 
00022   bool validate(int index=1);
00023   
00024 private:
00025   std::vector<Object> theItems;
00026   CompareFunc lessThanFunc;
00027 };
00028 
00029 #include "PriorityQueue.cpp"
00030 
00031 #endif
00032 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines