3 //=============================================================================
5 * @file Asynch_Queued_Message.h
7 * @author Carlos O'Ryan <coryan@uci.edu>
9 //=============================================================================
11 #ifndef TAO_ASYNCH_QUEUED_MESSAGE_H
12 #define TAO_ASYNCH_QUEUED_MESSAGE_H
14 #include /**/ "ace/pre.h"
16 #include "tao/Queued_Message.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/Time_Value.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 class ACE_Message_Block
;
26 ACE_END_VERSIONED_NAMESPACE_DECL
28 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
31 * @class TAO_Asynch_Queued_Message
33 * @brief Specialize TAO_Queued_Message for asynch requests,
34 * i.e. oneways sent with SYNC_NONE policy.
36 class TAO_Export TAO_Asynch_Queued_Message
: public TAO_Queued_Message
41 * @param contents The message block chain that must be sent.
43 * @param alloc Allocator used for creating @c this object.
45 * @param timeout The relative timeout after which this
46 * message should be expired.
48 * @todo I'm almost sure this class will require a callback
49 * interface for AMIs sent with SYNC_NONE policy. Those guys
50 * need to hear when the connection timeouts or closes, but
51 * cannot block waiting for the message to be delivered.
53 TAO_Asynch_Queued_Message (const ACE_Message_Block
*contents
,
55 ACE_Time_Value
*timeout
,
57 bool is_heap_allocated
);
61 virtual ~TAO_Asynch_Queued_Message (void);
64 * @name Implement the Template Methods from TAO_Queued_Message
67 virtual size_t message_length () const;
68 virtual int all_data_sent () const;
69 virtual void fill_iov (int iovcnt_max
, int &iovcnt
, iovec iov
[]) const;
70 virtual void bytes_transferred (size_t &byte_count
);
71 /// @note No reason to believe why this would be called. But have
72 /// it here for the sake of uniformity.
73 virtual TAO_Queued_Message
*clone (ACE_Allocator
*alloc
);
74 virtual void destroy (void);
75 virtual bool is_expired (const ACE_Time_Value
&now
) const;
76 virtual void copy_if_necessary (const ACE_Message_Block
* chain
);
82 * @param buf The buffer that needs to be sent on the wire. The
83 * buffer will be owned by this class. The buffer will be
84 * deleted when the destructor is called and hence the
85 * buffer should always come off the heap!
87 * @param oc The ORB Core
89 * @param size The size of the buffer <buf> that is being handed
92 * @param abs_timeout The time after which this message should be expired.
94 * @param alloc Allocator used for creating <this> object.
96 TAO_Asynch_Queued_Message (char *buf
,
99 const ACE_Time_Value
&abs_timeout
,
100 ACE_Allocator
*alloc
,
101 bool is_heap_allocated
);
104 void operator= (const TAO_Asynch_Queued_Message
&);
105 TAO_Asynch_Queued_Message (const TAO_Asynch_Queued_Message
&);
108 /// The number of bytes in the buffer
111 /// The offset in the buffer
113 * Data up to @c offset has been sent already, only the
114 * [offset_,size_) range remains to be sent.
118 /// The buffer containing the complete message.
122 ACE_Time_Value abs_timeout_
;
126 TAO_END_VERSIONED_NAMESPACE_DECL
128 #include /**/ "ace/post.h"
129 #endif /* TAO_ASYNCH_QUEUED_MESSAGE_H */