#include <Queued_Data.h>
Collaboration diagram for TAO_Queued_Data:
Public Member Functions | |
TAO_Queued_Data (ACE_Allocator *alloc=0) | |
Default Constructor. | |
TAO_Queued_Data (ACE_Message_Block *mb, ACE_Allocator *alloc=0) | |
Constructor. | |
TAO_Queued_Data (const TAO_Queued_Data &qd) | |
Copy constructor. | |
int | consolidate (void) |
size_t | missing_data (void) const |
Get missing data. | |
void | missing_data (size_t data) |
Set missing data. | |
TAO_GIOP_Message_Version const & | giop_version (void) const |
Get the GIOP version. | |
CORBA::Octet | byte_order (void) const |
Get byte_order. | |
CORBA::Octet | more_fragments (void) const |
Get more fragments. | |
TAO_Pluggable_Message_Type | msg_type (void) const |
Get message type. | |
TAO_Queued_Data * | next (void) const |
Get next. | |
void | next (TAO_Queued_Data *qd) |
Set next. | |
ACE_Message_Block * | msg_block (void) const |
Get message block. | |
void | msg_block (ACE_Message_Block *mb) |
Set message block. | |
void | set_state (const TAO_GIOP_Message_State &state) |
Set the state. | |
Static Public Member Functions | |
TAO_Queued_Data * | make_queued_data (ACE_Allocator *message_buffer_alloc=0, ACE_Allocator *input_cdr_alloc=0, ACE_Data_Block *db=0) |
Creation of a node in the queue. | |
void | release (TAO_Queued_Data *qd) |
Deletion of a node from the queue. | |
TAO_Queued_Data * | duplicate (TAO_Queued_Data &qd) |
Static Private Member Functions | |
void | replace_data_block (ACE_Message_Block &mb) |
Private Attributes | |
ACE_Message_Block * | msg_block_ |
The message block that contains the message. | |
TAO_GIOP_Message_State | state_ |
State of this queued data. | |
TAO_Queued_Data * | next_ |
Pounter to the next element in the queue. | |
ACE_Allocator * | allocator_ |
The allocator used to allocate this class. | |
Missing Data details | |
The missing_data_ member contains the number of bytes of data missing from msg_block_. | |
size_t | missing_data_ |
This class contains necessary information about a message that is stored in the queue. Such a node can be used by the incoming thread from the reactor to dequeue and process the message by sending it to the higher layers of the ORB.
The ACE_Message_Block contained within this class may contain a chain of message blocks (usually when GIOP fragments are involved). In that case consolidate () needs to be called prior to being sent to higher layers of the ORB when the GIOP fragment chain is complete.
Definition at line 47 of file Queued_Data.h.
|
Default Constructor.
Definition at line 34 of file Queued_Data.inl. Referenced by duplicate(), and make_queued_data().
00035 : msg_block_ (0), 00036 missing_data_ (0), 00037 state_ (), 00038 next_ (0), 00039 allocator_ (alloc) 00040 { 00041 } |
|
Constructor.
Definition at line 44 of file Queued_Data.inl.
00046 : msg_block_ (mb), 00047 missing_data_ (0), 00048 state_ (), 00049 next_ (0), 00050 allocator_ (alloc) 00051 { 00052 } |
|
Copy constructor.
Definition at line 55 of file Queued_Data.inl.
00056 : msg_block_ (qd.msg_block_->duplicate ()), 00057 missing_data_ (qd.missing_data_), 00058 state_ (qd.state_), 00059 next_ (0), 00060 allocator_ (qd.allocator_) 00061 { 00062 } |
|
Get byte_order.
Definition at line 84 of file Queued_Data.inl. References TAO_GIOP_Message_State::byte_order(). Referenced by TAO_GIOP_Message_Base::parse_request_id(), TAO_GIOP_Message_Base::process_reply_message(), and TAO_GIOP_Message_Base::process_request_message().
00085 { 00086 return this->state_.byte_order (); 00087 } |
|
Consolidate this fragments chained message blocks into one.
Definition at line 207 of file Queued_Data.cpp. References clone_mb_nocopy_size(), ACE_CDR::consolidate(), ACE_Message_Block::cont(), TAO_GIOP_Message_State::more_fragments(), msg_block_, and ACE_Message_Block::release(). Referenced by TAO_GIOP_Message_Base::consolidate_fragmented_message().
00208 { 00209 // Is this a chain of fragments? 00210 if (this->state_.more_fragments () && this->msg_block_->cont () != 0) 00211 { 00212 // Create a message block big enough to hold the entire chain 00213 ACE_Message_Block *dest = clone_mb_nocopy_size ( 00214 this->msg_block_, 00215 this->msg_block_->total_length ()); 00216 00217 if (0 == dest) 00218 { 00219 // out of memory 00220 return -1; 00221 } 00222 // Memory allocation succeeded, the new message block can hold the consolidated 00223 // message. The following code just copies all the data into this new message block. 00224 // No further memory allocation will take place. 00225 00226 // Reset the cont() parameter. We have cloned the message 00227 // block but not the chain as we will no longer have chain. 00228 dest->cont (0); 00229 00230 // Use ACE_CDR to consolidate the chain for us 00231 ACE_CDR::consolidate (dest, this->msg_block_); 00232 00233 // free the original message block chain 00234 this->msg_block_->release (); 00235 00236 // Set the message block to the new consolidated message block 00237 this->msg_block_ = dest; 00238 this->state_.more_fragments (0); 00239 } 00240 00241 return 0; 00242 } |
|
Duplicate ourselves. This creates a copy of ourselves on the heap and returns a pointer to the duplicated node. Definition at line 160 of file Queued_Data.cpp. References ACE_BIT_ENABLED, ACE_DEBUG, ACE_NEW_MALLOC_RETURN, ACE_NEW_RETURN, allocator_, LM_DEBUG, ACE_Allocator::malloc(), msg_block_, replace_data_block(), ACE_Message_Block::self_flags(), TAO_debug_level, and TAO_Queued_Data(). Referenced by TAO_Transport::handle_input_parse_data().
00161 { 00162 // Check to see if the underlying block is on the stack. If not it 00163 // is fine. If the datablock is on stack, try to make a copy of that 00164 // before doing a duplicate. 00165 // @@ todo: Theoretically this should be within the Message Block, 00166 // but we dont have much scope to do this in that mess. Probably in 00167 // the next stage of MB rewrite we should be okay 00168 ACE_Message_Block::Message_Flags fl = 00169 sqd.msg_block_->self_flags (); 00170 00171 if (ACE_BIT_ENABLED (fl, 00172 ACE_Message_Block::DONT_DELETE)) 00173 (void) TAO_Queued_Data::replace_data_block (*sqd.msg_block_); 00174 00175 00176 TAO_Queued_Data *qd = 0; 00177 00178 if (sqd.allocator_) 00179 { 00180 ACE_NEW_MALLOC_RETURN (qd, 00181 static_cast<TAO_Queued_Data *> ( 00182 sqd.allocator_->malloc (sizeof (TAO_Queued_Data))), 00183 TAO_Queued_Data (sqd), 00184 0); 00185 00186 return qd; 00187 } 00188 00189 // No allocator, so use the global pool! 00190 // @@ TODO: We should be removing this at some point of time! 00191 if (TAO_debug_level == 4) 00192 { 00193 // This debug is for testing purposes! 00194 ACE_DEBUG ((LM_DEBUG, 00195 "TAO (%P|%t) - Queued_Data[%d]::duplicate\n", 00196 "Using global pool for allocation \n")); 00197 } 00198 00199 ACE_NEW_RETURN (qd, 00200 TAO_Queued_Data (sqd), 00201 0); 00202 00203 return qd; 00204 } |
|
Get the GIOP version.
Definition at line 78 of file Queued_Data.inl. References TAO_GIOP_Message_State::giop_version(). Referenced by TAO_GIOP_Message_Base::consolidate_fragmented_message(), TAO_GIOP_Message_Base::discard_fragmented_message(), TAO_GIOP_Message_Base::parse_request_id(), TAO_GIOP_Message_Base::process_reply_message(), and TAO_GIOP_Message_Base::process_request_message().
00079 { 00080 return this->state_.giop_version (); 00081 } |
|
Creation of a node in the queue.
Definition at line 80 of file Queued_Data.cpp. References ACE_Message_Block, ACE_NEW_MALLOC_RETURN, ACE_NEW_RETURN, ACE_Allocator::malloc(), ACE_CDR::mb_align(), msg_block_, and TAO_Queued_Data(). Referenced by TAO_GIOP_Message_Base::make_queued_data().
00083 { 00084 // Get a node for the queue.. 00085 TAO_Queued_Data *qd = 0; 00086 00087 if (message_buffer_alloc) 00088 { 00089 ACE_NEW_MALLOC_RETURN (qd, 00090 static_cast<TAO_Queued_Data *> ( 00091 message_buffer_alloc->malloc (sizeof (TAO_Queued_Data))), 00092 TAO_Queued_Data (message_buffer_alloc), 00093 0); 00094 00095 } 00096 else 00097 { 00098 // No allocator, so use the global pool! 00099 ACE_NEW_RETURN (qd, 00100 TAO_Queued_Data, 00101 0); 00102 } 00103 00104 // Providing an ACE_Data_Block indicates that the caller wants 00105 // an aligned ACE_Message_Block added to the TAO_Queued_Data. 00106 if (db != 0) 00107 { 00108 // If this allocation fails, the TAO_Queued_Data will be leaked. 00109 if (input_cdr_alloc == 0) 00110 ACE_NEW_RETURN (qd->msg_block_, 00111 ACE_Message_Block (db, 00112 0, 00113 input_cdr_alloc), 00114 0); 00115 else 00116 ACE_NEW_MALLOC_RETURN (qd->msg_block_, 00117 static_cast<ACE_Message_Block*> ( 00118 input_cdr_alloc->malloc (sizeof (ACE_Message_Block))), 00119 ACE_Message_Block (db, 00120 0, 00121 input_cdr_alloc), 00122 0); 00123 00124 ACE_CDR::mb_align (qd->msg_block_); 00125 } 00126 00127 return qd; 00128 } |
|
Set missing data.
Definition at line 72 of file Queued_Data.inl. References missing_data_.
00073 { 00074 this->missing_data_ = data; 00075 } |
|
Get missing data.
Definition at line 66 of file Queued_Data.inl. References missing_data_. Referenced by TAO_Transport::consolidate_enqueue_message(), TAO_GIOP_Message_Base::consolidate_node(), TAO_Transport::consolidate_process_message(), TAO_GIOP_Message_Base::extract_next_message(), TAO_Transport::handle_input(), TAO_Transport::handle_input_missing_data(), TAO_Transport::handle_input_parse_data(), TAO_Transport::handle_input_parse_extra_messages(), TAO_GIOP_Message_Base::parse_next_message(), and TAO_Transport::process_parsed_messages().
00067 { 00068 return this->missing_data_; 00069 } |
|
Get more fragments.
Definition at line 90 of file Queued_Data.inl. References TAO_GIOP_Message_State::more_fragments(). Referenced by TAO_Transport::consolidate_enqueue_message(), TAO_GIOP_Message_Base::consolidate_fragmented_message(), TAO_Transport::consolidate_process_message(), and TAO_Transport::handle_input_parse_data().
00091 { 00092 return this->state_.more_fragments (); 00093 } |
|
Set message block.
Definition at line 120 of file Queued_Data.inl. References msg_block_.
00121 { 00122 this->msg_block_ = mb; 00123 } |
|
Get message block.
Definition at line 114 of file Queued_Data.inl. References msg_block_. Referenced by TAO_GIOP_Message_Base::consolidate_fragmented_message(), TAO_GIOP_Message_Base::consolidate_node(), TAO_GIOP_Message_Base::extract_next_message(), TAO_Transport::handle_input_missing_data(), TAO_Transport::handle_input_parse_data(), TAO_GIOP_Message_Base::parse_next_message(), TAO_GIOP_Message_Base::parse_request_id(), TAO_Transport::process_parsed_messages(), TAO_GIOP_Message_Base::process_reply_message(), and TAO_GIOP_Message_Base::process_request_message().
00115 { 00116 return this->msg_block_; 00117 } |
|
Get message type.
Definition at line 96 of file Queued_Data.inl. References TAO_GIOP_Message_State::message_type(). Referenced by TAO_Transport::consolidate_enqueue_message(), TAO_Transport::consolidate_process_message(), TAO_GIOP_Message_Base::discard_fragmented_message(), TAO_Transport::handle_input_parse_data(), TAO_GIOP_Message_Base::parse_request_id(), TAO_Transport::process_parsed_messages(), TAO_GIOP_Message_Base::process_reply_message(), and TAO_GIOP_Message_Base::process_request_message().
00097 { 00098 return this->state_.message_type (); 00099 } |
|
Set next.
Definition at line 108 of file Queued_Data.inl.
00109 { 00110 this->next_ = qd; 00111 } |
|
Get next.
Definition at line 102 of file Queued_Data.inl. Referenced by TAO_Incoming_Message_Queue::dequeue_head(), TAO_Incoming_Message_Queue::dequeue_tail(), TAO_Incoming_Message_Queue::enqueue_tail(), TAO::Incoming_Message_Stack::pop(), and TAO::Incoming_Message_Stack::push().
00103 { 00104 return this->next_; 00105 } |
|
|
Replace the datablock with a one allocated on the heap or allocator Definition at line 9 of file Queued_Data.inl. References ACE_Data_Block::clone_nocopy(), ACE_Message_Block::clr_self_flags(), ACE_Message_Block::copy(), ACE_Message_Block::data_block(), ACE_Data_Block::duplicate(), ACE_Message_Block::length(), ACE_CDR::mb_align(), ACE_Message_Block::rd_ptr(), ACE_Data_Block::size(), ACE_CDR::total_length(), and ACE_Message_Block::wr_ptr(). Referenced by duplicate().
00010 { 00011 size_t const newsize = 00012 ACE_CDR::total_length (&mb, 0) + ACE_CDR::MAX_ALIGNMENT; 00013 00014 ACE_Data_Block *db = 00015 mb.data_block ()->clone_nocopy (); 00016 00017 if (db->size (newsize) == -1) 00018 return; 00019 00020 ACE_Message_Block tmp (db); 00021 ACE_CDR::mb_align (&tmp); 00022 00023 tmp.copy (mb.rd_ptr (), mb.length()); 00024 mb.data_block (tmp.data_block ()->duplicate ()); 00025 00026 mb.rd_ptr (tmp.rd_ptr ()); 00027 mb.wr_ptr (tmp.wr_ptr ()); 00028 00029 // Remove the DONT_DELETE flags from mb 00030 mb.clr_self_flags (ACE_Message_Block::DONT_DELETE); 00031 } |
|
Set the state.
Definition at line 126 of file Queued_Data.inl. Referenced by TAO_GIOP_Message_Base::consolidate_node(), TAO_GIOP_Message_Base::extract_next_message(), and TAO_GIOP_Message_Base::parse_next_message().
00127 { 00128 this->state_ = state; 00129 } |
|
The allocator used to allocate this class.
Definition at line 138 of file Queued_Data.h. Referenced by duplicate(), and release(). |
|
Data missing in the above message that hasn't been read or processed yet, the value TAO_MISSING_DATA_UNDEFINED indicates it hasn't been processed yet, otherwise greater or equal zero. Definition at line 124 of file Queued_Data.h. Referenced by missing_data(). |
|
The message block that contains the message.
Definition at line 112 of file Queued_Data.h. Referenced by consolidate(), duplicate(), make_queued_data(), msg_block(), and release(). |
|
Pounter to the next element in the queue.
Definition at line 131 of file Queued_Data.h. |
|
State of this queued data.
Definition at line 128 of file Queued_Data.h. |