diff options
Diffstat (limited to 'ACE/protocols/ace/RMCast/Retransmit.h')
-rw-r--r-- | ACE/protocols/ace/RMCast/Retransmit.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/ACE/protocols/ace/RMCast/Retransmit.h b/ACE/protocols/ace/RMCast/Retransmit.h new file mode 100644 index 00000000000..977f61b4c42 --- /dev/null +++ b/ACE/protocols/ace/RMCast/Retransmit.h @@ -0,0 +1,97 @@ +// author : Boris Kolpackov <boris@kolpackov.net> +// $Id$ + +#ifndef ACE_RMCAST_RETRANSMIT_H +#define ACE_RMCAST_RETRANSMIT_H + +#include "ace/Hash_Map_Manager.h" +#include "ace/Thread_Manager.h" + +#include "Stack.h" +#include "Protocol.h" +#include "Bits.h" +#include "Parameters.h" + +namespace ACE_RMCast +{ + class Retransmit : public Element + { + public: + Retransmit (Parameters const& params); + + virtual void + out_start (Out_Element* out); + + virtual void + out_stop (); + + public: + virtual void + send (Message_ptr m); + + virtual void + recv (Message_ptr m); + + private: + struct Descr + { + // Shouldn't be available but ACE_Hash_Map needs it. + // + Descr () + : msg_ (), count_ (0) + { + } + + Descr (Message_ptr msg) + : msg_ (msg), count_ (0) + { + } + + unsigned long + inc () + { + return ++count_; + } + + void + reset () + { + count_ = 0; + } + + Message_ptr + message () const + { + return msg_->clone (); + } + + private: + Message_ptr msg_; + unsigned long count_; + }; + + typedef + ACE_Hash_Map_Manager<u64, Descr, ACE_Null_Mutex> + Queue; + + private: + void + track (); + + static ACE_THR_FUNC_RETURN + track_thunk (void* obj); + + private: + Parameters const& params_; + + Queue queue_; + Mutex mutex_; + Condition cond_; + + bool stop_; + ACE_Thread_Manager tracker_mgr_; + }; +} + + +#endif // ACE_RMCAST_RETRANSMIT_H |