Asynch_Queued_Message.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file Asynch_Queued_Message.h
00006  *
00007  *  $Id: Asynch_Queued_Message.h 79145 2007-08-01 07:38:40Z johnnyw $
00008  *
00009  *  @author Carlos O'Ryan <coryan@uci.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_ASYNCH_QUEUED_MESSAGE_H
00014 #define TAO_ASYNCH_QUEUED_MESSAGE_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/Queued_Message.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/Time_Value.h"
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 class ACE_Message_Block;
00028 ACE_END_VERSIONED_NAMESPACE_DECL
00029 
00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00031 
00032 /**
00033  * @class TAO_Asynch_Queued_Message
00034  *
00035  * @brief Specialize TAO_Queued_Message for asynch requests,
00036  *        i.e. oneways sent with SYNC_NONE policy.
00037  *
00038  */
00039 class TAO_Export TAO_Asynch_Queued_Message : public TAO_Queued_Message
00040 {
00041 public:
00042   /// Constructor
00043   /**
00044    * @param contents The message block chain that must be sent.
00045    *
00046    * @param alloc Allocator used for creating @c this object.
00047    *
00048    * @param timeout The relative timeout after which this
00049    * message should be expired.
00050    *
00051    * @todo I'm almost sure this class will require a callback
00052    *       interface for AMIs sent with SYNC_NONE policy.  Those guys
00053    *       need to hear when the connection timeouts or closes, but
00054    *       cannot block waiting for the message to be delivered.
00055    */
00056   TAO_Asynch_Queued_Message (const ACE_Message_Block *contents,
00057                              TAO_ORB_Core *oc,
00058                              ACE_Time_Value *timeout,
00059                              ACE_Allocator *alloc,
00060                              bool is_heap_allocated);
00061 
00062 
00063   /// Destructor
00064   virtual ~TAO_Asynch_Queued_Message (void);
00065 
00066   /**
00067    * @name Implement the Template Methods from TAO_Queued_Message
00068    */
00069   //@{
00070   virtual size_t message_length (void) const;
00071   virtual int all_data_sent (void) const;
00072   virtual void fill_iov (int iovcnt_max, int &iovcnt, iovec iov[]) const;
00073   virtual void bytes_transferred (size_t &byte_count);
00074   /// @note No reason to believe why this would be called. But have
00075   /// it here for the sake of uniformity.
00076   virtual TAO_Queued_Message *clone (ACE_Allocator *alloc);
00077   virtual void destroy (void);
00078   virtual bool is_expired (const ACE_Time_Value &now) const;
00079   //@}
00080 
00081 protected:
00082   /// Constructor
00083   /**
00084    * @param buf The buffer that needs to be sent on the wire. The
00085    *            buffer will be owned by this class. The buffer will be
00086    *            deleted when the destructor is called and hence the
00087    *            buffer should always come off the heap!
00088    *
00089    * @param oc The ORB Core
00090    *
00091    * @param size The size of the buffer <buf> that is being handed
00092    *             over.
00093    *
00094    * @param abs_timeout The time after which this  message should be expired.
00095    *
00096    * @param alloc Allocator used for creating <this> object.
00097    */
00098   TAO_Asynch_Queued_Message (char *buf,
00099                              TAO_ORB_Core *oc,
00100                              size_t size,
00101                              const ACE_Time_Value &abs_timeout,
00102                              ACE_Allocator *alloc,
00103                              bool is_heap_allocated);
00104 private:
00105   /// The number of bytes in the buffer
00106   size_t const size_;
00107 
00108   /// The offset in the buffer
00109   /**
00110    * Data up to @c offset has been sent already, only the
00111    * [offset_,size_) range remains to be sent.
00112    */
00113   size_t offset_;
00114 
00115   /// The buffer containing the complete message.
00116   char *buffer_;
00117 
00118   // Expiration time
00119   ACE_Time_Value abs_timeout_;
00120 
00121 };
00122 
00123 TAO_END_VERSIONED_NAMESPACE_DECL
00124 
00125 #include /**/ "ace/post.h"
00126 #endif  /* TAO_ASYNCH_QUEUED_MESSAGE_H */

Generated on Tue Feb 2 17:37:51 2010 for TAO by  doxygen 1.4.7