3 //=============================================================================
7 * @author Balachandran Natarajan <bala@cs.wustl.edu>
9 //=============================================================================
11 #ifndef TAO_QUEUED_DATA_H
12 #define TAO_QUEUED_DATA_H
14 #include /**/ "ace/pre.h"
16 #include "tao/Pluggable_Messaging_Utils.h"
17 #include "tao/GIOP_Message_State.h"
18 #include "ace/Message_Block.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 ACE_END_VERSIONED_NAMESPACE_DECL
28 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
31 * @class TAO_Queued_Data
33 * @brief Represents a node in the queue of incoming messages.
35 * This class contains necessary information about a message that is
36 * stored in the queue. Such a node can be used by the incoming thread
37 * from the reactor to dequeue and process the message by sending it
38 * to the higher layers of the ORB.
40 * The ACE_Message_Block contained within this class may contain a chain
41 * of message blocks (usually when GIOP fragments are involved). In that
42 * case consolidate () needs to be called prior to being sent to higher
43 * layers of the ORB when the GIOP fragment chain is complete.
45 class TAO_Export TAO_Queued_Data
48 /// Default Constructor
49 TAO_Queued_Data (ACE_Allocator
*alloc
= 0);
52 TAO_Queued_Data (ACE_Message_Block
*mb
, ACE_Allocator
*alloc
= 0);
55 TAO_Queued_Data (const TAO_Queued_Data
&qd
);
57 /// Creation of a node in the queue.
58 static TAO_Queued_Data
* make_queued_data (
59 ACE_Allocator
*message_buffer_alloc
= 0,
60 ACE_Allocator
*input_cdr_alloc
= 0,
61 ACE_Data_Block
*db
= 0);
63 /// Deletion of a node from the queue.
64 static void release (TAO_Queued_Data
*qd
);
66 /// Duplicate ourselves. This creates a copy of ourselves on the
67 /// heap and returns a pointer to the duplicated node.
68 static TAO_Queued_Data
* duplicate (TAO_Queued_Data
&qd
);
70 /// Consolidate this fragments chained message blocks into one.
71 /// @return -1 if consolidation failed, eg out or memory, otherwise 0
75 size_t missing_data () const;
78 void missing_data (size_t data
);
80 /// Get the GIOP version
81 TAO_GIOP_Message_Version
const &giop_version () const;
84 CORBA::Octet
byte_order () const;
86 /// Get more fragments
87 CORBA::Boolean
more_fragments () const;
90 GIOP::MsgType
msg_type () const;
93 TAO_Queued_Data
*next () const;
96 void next (TAO_Queued_Data
* qd
);
99 ACE_Message_Block
*msg_block () const;
101 /// Set message block
102 void msg_block (ACE_Message_Block
*mb
);
105 void state (const TAO_GIOP_Message_State
& state
);
108 const TAO_GIOP_Message_State
& state () const;
111 /// The message block that contains the message.
112 ACE_Message_Block
*msg_block_
{};
115 @name Missing Data details
117 The \a missing_data_ member contains the number of bytes of
118 data missing from \a msg_block_.
121 /*! Data missing in the above message that hasn't been read or processed yet,
122 the value TAO_MISSING_DATA_UNDEFINED indicates it hasn't been processed yet,
123 otherwise greater or equal zero. */
124 size_t missing_data_
{};
127 /// State of this queued data
128 TAO_GIOP_Message_State state_
;
130 /// Pounter to the next element in the queue.
131 TAO_Queued_Data
*next_
{};
133 /// Replace the datablock with a one allocated on the heap or
135 static void replace_data_block (ACE_Message_Block
&mb
);
137 /// The allocator used to allocate this class.
138 ACE_Allocator
*allocator_
{};
141 TAO_END_VERSIONED_NAMESPACE_DECL
143 #if defined (__ACE_INLINE__)
144 # include "tao/Queued_Data.inl"
145 #endif /* __ACE_INLINE__ */
147 #include /**/ "ace/post.h"
148 #endif /*TAO_QUEUED_DATA_H*/