3 //=============================================================================
5 * @file Synch_Queued_Message.h
7 * @author Carlos O'Ryan <coryan@uci.edu>
9 //=============================================================================
11 #ifndef TAO_SYNCH_QUEUED_MESSAGE_H
12 #define TAO_SYNCH_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 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
25 * @class TAO_Synch_Queued_Message
27 * @brief Specialize TAO_Queued_Message for synchronous requests,
28 * i.e. twoways and oneways sent with reliability better than
31 * Reliable requests block the sending thread until the message is
32 * sent, likewise, the sending thread must be informed if the
33 * connection is closed or the message times out.
35 * In contrast oneway (and AMI) requests sent with the SYNC_NONE
36 * policy are simple discarded if the connection fails or they
39 * Another important difference is the management of the data buffer:
40 * one SYNC_NONE messages the buffer is immediately copied into a
41 * newly allocated buffer, and must be deallocated. Other types of
42 * requests use the memory allocated by the sending thread.
44 class TAO_Export TAO_Synch_Queued_Message
: public TAO_Queued_Message
49 * @param contents The message block chain that must be sent.
51 * @param alloc The allocator that is used to allocate objects of
54 TAO_Synch_Queued_Message (const ACE_Message_Block
*contents
,
56 ACE_Allocator
*alloc
= 0,
57 bool is_heap_allocated
= false);
60 virtual ~TAO_Synch_Queued_Message ();
62 const ACE_Message_Block
*current_block () const;
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 virtual TAO_Queued_Message
*clone (ACE_Allocator
*alloc
);
72 virtual void destroy ();
73 virtual void copy_if_necessary (const ACE_Message_Block
* chain
);
77 /// The contents of the message.
79 * The message is normally generated by a TAO_OutputCDR stream. The
80 * application marshals the payload, possibly generating a chain of
81 * message block connected via the 'cont()' field.
83 ACE_Message_Block
*contents_
;
85 /// The current message block
87 * The message may be set in multiple writev() operations. This
88 * point keeps track of the next message to send out.
90 ACE_Message_Block
*current_block_
;
92 /// Do we own the contents_ message block?
94 * This flag differs from the is_heap_allocated_ flag in that it only
95 * applies to the contents_ message block and not the
96 * TAO_Synch_Queued_Message object itself.
101 TAO_END_VERSIONED_NAMESPACE_DECL
103 #include /**/ "ace/post.h"
105 #endif /* TAO_QUEUED_MESSAGE_H */