00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_INTERNAL_UTIL_TIMERTASKHEAP_H_
00019 #define _DECAF_INTERNAL_UTIL_TIMERTASKHEAP_H_
00020
00021 #include <decaf/util/Config.h>
00022
00023 #include <decaf/util/TimerTask.h>
00024 #include <decaf/lang/Pointer.h>
00025
00026 namespace decaf {
00027 namespace internal {
00028 namespace util {
00029
00030 using decaf::lang::Pointer;
00031 using decaf::util::TimerTask;
00032
00038 class DECAF_API TimerTaskHeap {
00039 private:
00040
00041
00042 static const int DEFAULT_HEAP_SIZE = 256;
00043
00044
00045 std::vector<Pointer<TimerTask> > heap;
00046
00047 public:
00048
00049 TimerTaskHeap();
00050 virtual ~TimerTaskHeap();
00051
00058 Pointer<TimerTask> peek();
00059
00063 bool isEmpty() const;
00064
00068 std::size_t size() const;
00069
00077 void insert(const Pointer<TimerTask>& task);
00078
00086 void remove(std::size_t pos);
00087
00091 void reset();
00092
00096 void adjustMinimum();
00097
00105 std::size_t deleteIfCancelled();
00106
00113 std::size_t find(const Pointer<TimerTask>& task) const;
00114
00115 private:
00116
00117 void upHeap();
00118 void downHeap(std::size_t pos);
00119
00120 };
00121
00122 }}}
00123
00124 #endif