00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Asynch_Queued_Message.h 00006 * 00007 * Asynch_Queued_Message.h,v 1.13 2006/05/05 11:22:47 jwillemsen Exp 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 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00025 00026 /** 00027 * @class TAO_Asynch_Queued_Message 00028 * 00029 * @brief Specialize TAO_Queued_Message for asynch requests, 00030 * i.e. oneways sent with SYNC_NONE policy. 00031 * 00032 */ 00033 class TAO_Export TAO_Asynch_Queued_Message : public TAO_Queued_Message 00034 { 00035 public: 00036 /// Constructor 00037 /** 00038 * @param contents The message block chain that must be sent. 00039 * 00040 * @param alloc Allocator used for creating @c this object. 00041 * 00042 * @todo I'm almost sure this class will require a callback 00043 * interface for AMIs sent with SYNC_NONE policy. Those guys 00044 * need to hear when the connection timeouts or closes, but 00045 * cannot block waiting for the message to be delivered. 00046 */ 00047 TAO_Asynch_Queued_Message (const ACE_Message_Block *contents, 00048 TAO_ORB_Core *oc, 00049 ACE_Allocator *alloc = 0, 00050 bool is_heap_allocated = false); 00051 00052 00053 /// Destructor 00054 virtual ~TAO_Asynch_Queued_Message (void); 00055 00056 /** 00057 * @name Implement the Template Methods from TAO_Queued_Message 00058 */ 00059 //@{ 00060 virtual size_t message_length (void) const; 00061 virtual int all_data_sent (void) const; 00062 virtual void fill_iov (int iovcnt_max, int &iovcnt, iovec iov[]) const; 00063 virtual void bytes_transferred (size_t &byte_count); 00064 /// @note No reason to believe why this would be called. But have 00065 /// it here for the sake of uniformity. 00066 virtual TAO_Queued_Message *clone (ACE_Allocator *alloc); 00067 virtual void destroy (void); 00068 //@} 00069 00070 protected: 00071 /// Constructor 00072 /** 00073 * @param buf The buffer that needs to be sent on the wire. The 00074 * buffer will be owned by this class. The buffer will be 00075 * deleted when the destructor is called and hence the 00076 * buffer should always come off the heap! 00077 * 00078 * @param size The size of the buffer <buf> that is being handed 00079 * over. 00080 * 00081 * @param alloc Allocator used for creating <this> object. 00082 */ 00083 TAO_Asynch_Queued_Message (char *buf, 00084 TAO_ORB_Core *oc, 00085 size_t size, 00086 ACE_Allocator *alloc = 0); 00087 private: 00088 /// The number of bytes in the buffer 00089 const size_t size_; 00090 00091 /// The offset in the buffer 00092 /** 00093 * Data up to @c offset has been sent already, only the 00094 * [offset_,size_) range remains to be sent. 00095 */ 00096 size_t offset_; 00097 00098 /// The buffer containing the complete message. 00099 char *buffer_; 00100 }; 00101 00102 TAO_END_VERSIONED_NAMESPACE_DECL 00103 00104 #include /**/ "ace/post.h" 00105 #endif /* TAO_ASYNCH_QUEUED_MESSAGE_H */