diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-01-18 21:59:11 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-01-18 21:59:11 +0000 |
commit | 367187492835b4f709d17962af0dff632b1ce65f (patch) | |
tree | 5ae951cd59471c77378c51c13787592714426693 /ace | |
parent | 90ba20ad4c88453745b74e03bf466e8357be7b80 (diff) | |
download | ATCD-367187492835b4f709d17962af0dff632b1ce65f.tar.gz |
Added pure virtual get_first() method to Timer_Queue_T. Added
implementations to Timer_Wheel and Timer_Hash. Timer_Heap and Timer_List
already had implementations.
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Timer_Hash_T.cpp | 14 | ||||
-rw-r--r-- | ace/Timer_Hash_T.h | 3 | ||||
-rw-r--r-- | ace/Timer_Queue_T.h | 3 | ||||
-rw-r--r-- | ace/Timer_Wheel_T.cpp | 11 | ||||
-rw-r--r-- | ace/Timer_Wheel_T.h | 3 |
5 files changed, 34 insertions, 0 deletions
diff --git a/ace/Timer_Hash_T.cpp b/ace/Timer_Hash_T.cpp index 01bfca7b90a..2db6451c8e5 100644 --- a/ace/Timer_Hash_T.cpp +++ b/ace/Timer_Hash_T.cpp @@ -434,6 +434,20 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::remove_first (void) } +// Returns the earliest node without removing it + +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::get_first (void) +{ + ACE_TRACE ("ACE_Timer_Hash_T::get_first"); + + if (this->is_empty ()) + return 0; + + return this->table_[this->earliest_position_]->get_first (); +} + + // Dummy version of expire to get rid of warnings in Sun CC 4.2 template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int diff --git a/ace/Timer_Hash_T.h b/ace/Timer_Hash_T.h index e4fa98a62b3..ab93fe99ddd 100644 --- a/ace/Timer_Hash_T.h +++ b/ace/Timer_Hash_T.h @@ -205,6 +205,9 @@ public: virtual void dump (void) const; // Dump the state of an object. + virtual ACE_Timer_Node_T<TYPE> *get_first (void); + // Reads the earliest node from the queue and returns it. + private: virtual void reschedule (ACE_Timer_Node_T<TYPE> *); // Reschedule an "interval" <ACE_Timer_Node>. diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h index d29a4ffb04e..e6f31c88f50 100644 --- a/ace/Timer_Queue_T.h +++ b/ace/Timer_Queue_T.h @@ -269,6 +269,9 @@ public: virtual void dump (void) const; // Dump the state of a object. + virtual ACE_Timer_Node_T<TYPE> *get_first (void) = 0; + // Reads the earliest node from the queue and returns it. + protected: virtual void upcall (TYPE &type, const void *act, diff --git a/ace/Timer_Wheel_T.cpp b/ace/Timer_Wheel_T.cpp index 10d2d9c061b..099660e3e09 100644 --- a/ace/Timer_Wheel_T.cpp +++ b/ace/Timer_Wheel_T.cpp @@ -450,6 +450,17 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first (void) } +// Returns the earliest node without removing it + +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first (void) +{ + ACE_TRACE ("ACE_Timer_Wheel_T::get_first"); + + return this->wheel_[this->earliest_pos_]->get_next (); +} + + // Takes an ACE_Timer_Node and inserts it into the correct position in the correct // list diff --git a/ace/Timer_Wheel_T.h b/ace/Timer_Wheel_T.h index 7d8bb1855bf..db2f1c20339 100644 --- a/ace/Timer_Wheel_T.h +++ b/ace/Timer_Wheel_T.h @@ -168,6 +168,9 @@ public: virtual void dump (void) const; // Dump the state of an object. + virtual ACE_Timer_Node_T<TYPE> *get_first (void); + // Reads the earliest node from the queue and returns it. + private: virtual void reschedule (ACE_Timer_Node_T<TYPE> *); // Reschedule an "interval" node |