00001 // -*- C++ -*- 00002 00008 #if !defined(__ads_PriorityQueue_h__) 00009 #define __ads_PriorityQueue_h__ 00010 00011 #include "../functor/Dereference.h" 00012 00013 #include <vector> 00014 00015 BEGIN_NAMESPACE_ADS 00016 00018 00026 template < typename T, 00027 typename Key = typename std::iterator_traits<T>::value_type, 00028 class GetKey = Dereference<T>, 00029 class CompareKeys = std::greater<Key>, 00030 class Sequence = std::vector<T> > 00031 class PriorityQueue 00032 { 00033 public: 00034 00036 typedef T element_type; 00038 typedef const element_type& const_reference; 00039 00041 typedef Key key_type; 00042 00044 typedef GetKey get_key_functor; 00045 00047 typedef CompareKeys compare_keys_functor; 00048 00050 typedef Sequence sequence_type; 00051 00053 typedef typename sequence_type::value_type value_type; 00055 typedef typename sequence_type::iterator iterator; 00057 typedef typename sequence_type::difference_type difference_type; 00059 typedef int size_type; 00060 00061 // I don't currently use the virtual function capability. 00062 // It does not affect the performance much either way. 00063 // The FM method is a little better without virtual functions. 00064 00065 /* 00066 public: 00067 00068 // 00069 // Accessors 00070 // 00071 00073 virtual 00074 size_type 00075 size() const = 0; 00076 00078 virtual 00079 bool 00080 empty() const = 0; 00081 00082 // 00083 // Manipulators 00084 // 00085 00087 virtual 00088 void 00089 push( element_type x ) = 0; 00090 00092 virtual 00093 void 00094 pop() = 0; 00095 */ 00096 }; 00097 00098 END_NAMESPACE_ADS 00099 00100 #endif