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
72 int consolidate (void);
75 size_t missing_data (void) const;
78 void missing_data (size_t data
);
80 /// Get the GIOP version
81 TAO_GIOP_Message_Version
const &giop_version (void) const;
84 CORBA::Octet
byte_order (void) const;
86 /// Get more fragments
87 CORBA::Boolean
more_fragments (void) const;
90 GIOP::MsgType
msg_type (void) const;
93 TAO_Queued_Data
*next (void) const;
96 void next (TAO_Queued_Data
* qd
);
99 ACE_Message_Block
*msg_block (void) 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 (void) const;
112 /// The message block that contains the message.
113 ACE_Message_Block
*msg_block_
;
116 @name Missing Data details
118 The \a missing_data_ member contains the number of bytes of
119 data missing from \a msg_block_.
122 /*! Data missing in the above message that hasn't been read or processed yet,
123 the value TAO_MISSING_DATA_UNDEFINED indicates it hasn't been processed yet,
124 otherwise greater or equal zero. */
125 size_t missing_data_
;
128 /// State of this queued data
129 TAO_GIOP_Message_State state_
;
131 /// Pounter to the next element in the queue.
132 TAO_Queued_Data
*next_
;
134 /// Replace the datablock with a one allocated on the heap or
136 static void replace_data_block (ACE_Message_Block
&mb
);
138 /// The allocator used to allocate this class.
139 ACE_Allocator
*allocator_
;
142 TAO_END_VERSIONED_NAMESPACE_DECL
144 #if defined (__ACE_INLINE__)
145 # include "tao/Queued_Data.inl"
146 #endif /* __ACE_INLINE__ */
148 #include /**/ "ace/post.h"
149 #endif /*TAO_QUEUED_DATA_H*/