Retransmit.h

Go to the documentation of this file.
00001 // file      : ace/RMCast/Retransmit.h
00002 // author    : Boris Kolpackov <boris@kolpackov.net>
00003 // cvs-id    : Retransmit.h,v 1.6 2005/07/11 18:50:23 boris Exp
00004 
00005 #ifndef ACE_RMCAST_RETRANSMIT_H
00006 #define ACE_RMCAST_RETRANSMIT_H
00007 
00008 #include "ace/Hash_Map_Manager.h"
00009 #include "ace/Thread_Manager.h"
00010 
00011 #include "Stack.h"
00012 #include "Protocol.h"
00013 #include "Bits.h"
00014 #include "Parameters.h"
00015 
00016 namespace ACE_RMCast
00017 {
00018   class Retransmit : public Element
00019   {
00020   public:
00021     Retransmit (Parameters const& params);
00022 
00023     virtual void
00024     out_start (Out_Element* out);
00025 
00026     virtual void
00027     out_stop ();
00028 
00029   public:
00030     virtual void
00031     send (Message_ptr m);
00032 
00033     virtual void
00034     recv (Message_ptr m);
00035 
00036   private:
00037     struct Descr
00038     {
00039       // Shouldn't be available but ACE_Hash_Map needs it.
00040       //
00041       Descr ()
00042           : msg_ (), count_ (0)
00043       {
00044       }
00045 
00046       Descr (Message_ptr msg)
00047           : msg_ (msg), count_ (0)
00048       {
00049       }
00050 
00051       unsigned long
00052       inc ()
00053       {
00054         return ++count_;
00055       }
00056 
00057       void
00058       reset ()
00059       {
00060         count_ = 0;
00061       }
00062 
00063       Message_ptr
00064       message () const
00065       {
00066         return msg_->clone ();
00067       }
00068 
00069     private:
00070       Message_ptr msg_;
00071       unsigned long count_;
00072     };
00073 
00074     typedef
00075     ACE_Hash_Map_Manager<u64, Descr, ACE_Null_Mutex>
00076     Queue;
00077 
00078   private:
00079     void
00080     track ();
00081 
00082     static ACE_THR_FUNC_RETURN
00083     track_thunk (void* obj);
00084 
00085   private:
00086     Parameters const& params_;
00087 
00088     Queue queue_;
00089     Mutex mutex_;
00090     Condition cond_;
00091 
00092     bool stop_;
00093     ACE_Thread_Manager tracker_mgr_;
00094   };
00095 }
00096 
00097 
00098 #endif  // ACE_RMCAST_RETRANSMIT_H

Generated on Thu Nov 9 11:40:41 2006 for ACE_RMCast by doxygen 1.3.6