#include <Service_Context.h>
Collaboration diagram for TAO_Service_Context:
This class is used to manipulate and access the service context list that is passed around with every GIOP request/reply. The definition of the service context list is simply a sequence of the following structures: typedef unsigned long ServiceId; struct ServiceContext { ServiceId context_id; sequence context_data; }; typedef sequence ServiceContextList;
the real motivation behind this class is to consolidate all the marshalling and unmarshalling information pertaining to service context list
Definition at line 60 of file Service_Context.h.
|
Constructor.
Definition at line 8 of file Service_Context.inl.
00009 : service_context_ () 00010 { 00011 } |
|
|
|
Definition at line 132 of file Service_Context.cpp. References IOP::ServiceContext::context_data, IOP::ServiceContext::context_id, TAO::unbounded_value_sequence< T >::get_buffer(), TAO::unbounded_value_sequence< T >::length(), TAO::unbounded_value_sequence< ServiceContext >::length(), TAO::unbounded_value_sequence< T >::maximum(), and TAO::unbounded_value_sequence< ServiceContext >::replace().
00133 { 00134 // @@ TODO Some contexts can show up multiple times, others 00135 // can't find out and take appropiate action. 00136 CORBA::ULong const l = this->service_context_.length (); 00137 this->service_context_.length (l + 1); 00138 this->service_context_[l].context_id = context.context_id; 00139 CORBA::ULong const max = context.context_data.maximum (); 00140 CORBA::ULong const len = context.context_data.length (); 00141 CORBA::Octet* const buf = context.context_data.get_buffer (1); 00142 this->service_context_[l].context_data.replace (max, len, buf, 1); 00143 } |
|
Definition at line 146 of file Service_Context.cpp. References TAO::unbounded_value_sequence< ServiceContext >::length(). Referenced by set_context(), and set_context_i().
00147 { 00148 // @@ TODO Some contexts can show up multiple times, others 00149 // can't find out and take appropiate action. 00150 CORBA::ULong const l = this->service_context_.length (); 00151 this->service_context_.length (l + 1); 00152 this->service_context_[l] = context; 00153 } |
|
Definition at line 214 of file Service_Context.cpp.
00215 { 00216 if ((cdr >> this->service_context_) == 0) 00217 { 00218 return 0; 00219 } 00220 00221 return 1; 00222 } |
|
= Marshaling and demarshaling the list
Definition at line 208 of file Service_Context.cpp.
00209 { 00210 return (cdr << this->service_context_); 00211 } |
|
Definition at line 187 of file Service_Context.cpp. References ACE_NEW_RETURN, TAO::unbounded_value_sequence< ServiceContext >::length(), TAO_Out_T< T >::ptr(), IOP::ServiceContext_out, and IOP::ServiceId.
00189 { 00190 CORBA::ULong const len = this->service_context_.length (); 00191 00192 for (CORBA::ULong i = 0; i < len; ++i) 00193 { 00194 if (id == this->service_context_[i].context_id) 00195 { 00196 ACE_NEW_RETURN (context, IOP::ServiceContext, 0); 00197 00198 *(context.ptr ()) = this->service_context_[i]; 00199 00200 return 1; 00201 } 00202 } 00203 00204 return 0; 00205 } |
|
Get a reference to a context identified by id, return 0 if the component is not present. Definition at line 171 of file Service_Context.cpp. References TAO::unbounded_value_sequence< ServiceContext >::length(), and IOP::ServiceId.
00173 { 00174 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i) 00175 { 00176 if (id == this->service_context_[i].context_id) 00177 { 00178 *context = &this->service_context_[i]; 00179 return 1; 00180 } 00181 } 00182 00183 return 0; 00184 } |
|
Get a copy of the context identified by <context.context_id>, return 0 if the component is not present. Definition at line 156 of file Service_Context.cpp. References IOP::ServiceContext::context_id, and TAO::unbounded_value_sequence< ServiceContext >::length(). Referenced by TAO_GIOP_Message_Generator_Parser_12::process_bidir_context().
00157 { 00158 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i) 00159 { 00160 if (context.context_id == this->service_context_[i].context_id) 00161 { 00162 context = this->service_context_[i]; 00163 return 1; 00164 } 00165 } 00166 00167 return 0; 00168 } |
|
Helper methods to implement get_context().
|
|
Is the available in the underlying service context list? If so return 1, else return 0 Definition at line 43 of file Service_Context.inl. References TAO::unbounded_value_sequence< ServiceContext >::length(), and IOP::ServiceId. Referenced by TAO_GIOP_Message_Generator_Parser_12::check_bidirectional_context().
00044 { 00045 for (CORBA::ULong i = 0; 00046 i != this->service_context_.length (); 00047 ++i) 00048 { 00049 if (id == this->service_context_[i].context_id) 00050 { 00051 return 1; 00052 } 00053 } 00054 return 0; 00055 } |
|
|
|
Definition at line 20 of file Service_Context.inl.
00021 { 00022 return this->service_context_; 00023 } |
|
Return the underlying service context list.
Definition at line 14 of file Service_Context.inl. Referenced by TAO_ServerRequest::reply_service_info(), TAO_Operation_Details::reply_service_info(), TAO_ServerRequest::request_service_info(), TAO_Operation_Details::request_service_info(), TAO_Operation_Details::reset_reply_service_info(), TAO_Operation_Details::reset_request_service_info(), and TAO_ServerRequest::TAO_ServerRequest().
00015 { 00016 return this->service_context_; 00017 } |
|
Set the context from the CDR stream and return the context back to the caller. *Does not* modify the underlying service context list. Definition at line 35 of file Service_Context.inl. References set_context_i().
00037 { 00038 this->set_context_i (context, 00039 cdr); 00040 } |
|
Set the context from the CDR stream and add that to the service Context list Definition at line 27 of file Service_Context.inl. References IOP::ServiceId, and set_context_i().
00029 { 00030 this->set_context_i (id, 00031 cdr); 00032 } |
|
Insert the component into the list, but efficiently stealing the contents of the octet sequence. Definition at line 91 of file Service_Context.cpp. References add_context_i().
00092 { 00093 this->add_context_i (context); 00094 } |
|
Insert the component into the list, making a copy of the octet sequence. Search the list before insertion so that the insertion does not cause a duplicate context to be in the list. If the replace flag is true, update the specified context. Return 0 if the component was present and the replace flag was not set to true. Definition at line 67 of file Service_Context.cpp. References add_context_i(), IOP::ServiceContext::context_id, and TAO::unbounded_value_sequence< ServiceContext >::length().
00069 { 00070 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i) 00071 { 00072 if (context.context_id == this->service_context_[i].context_id) 00073 { 00074 if (replace) 00075 { 00076 this->service_context_[i] = context; 00077 return 1; 00078 } 00079 else 00080 { 00081 return 0; 00082 } 00083 } 00084 } 00085 00086 this->add_context_i (context); 00087 return 1; 00088 } |
|
= Generic components Insert the component into the list, making a copy of the octet sequence. Definition at line 61 of file Service_Context.cpp. References add_context_i(). Referenced by TAO_IIOP_Transport::set_bidir_context_info().
00062 { 00063 this->add_context_i (context); 00064 } |
|
Definition at line 43 of file Service_Context.cpp. References ACE_OutputCDR::begin(), ACE_Message_Block::cont(), IOP::ServiceContext::context_data, TAO::unbounded_value_sequence< T >::get_buffer(), ACE_Message_Block::length(), TAO::unbounded_value_sequence< T >::length(), ACE_OS::memcpy(), ACE_Message_Block::rd_ptr(), and ACE_OutputCDR::total_length().
00045 { 00046 // Make a *copy* of the CDR stream... 00047 size_t const length = cdr.total_length (); 00048 context.context_data.length (static_cast<CORBA::ULong> (length)); 00049 CORBA::Octet *buf = context.context_data.get_buffer (); 00050 00051 for (const ACE_Message_Block *i = cdr.begin (); 00052 i != 0; 00053 i = i->cont ()) 00054 { 00055 ACE_OS::memcpy (buf, i->rd_ptr (), i->length ()); 00056 buf += i->length (); 00057 } 00058 } |
|
Definition at line 20 of file Service_Context.cpp. References ACE_OutputCDR::begin(), ACE_Message_Block::cont(), IOP::ServiceContext::context_data, IOP::ServiceContext::context_id, TAO::unbounded_value_sequence< T >::get_buffer(), ACE_Message_Block::length(), TAO::unbounded_value_sequence< T >::length(), ACE_OS::memcpy(), ACE_Message_Block::rd_ptr(), IOP::ServiceId, set_context_i(), and ACE_OutputCDR::total_length().
00022 { 00023 IOP::ServiceContext context; 00024 context.context_id = id; 00025 00026 // Make a *copy* of the CDR stream... 00027 size_t const length = cdr.total_length (); 00028 context.context_data.length (static_cast<CORBA::ULong> (length)); 00029 CORBA::Octet *buf = context.context_data.get_buffer (); 00030 00031 for (const ACE_Message_Block *i = cdr.begin (); 00032 i != 0; 00033 i = i->cont ()) 00034 { 00035 ACE_OS::memcpy (buf, i->rd_ptr (), i->length ()); 00036 buf += i->length (); 00037 } 00038 00039 this->set_context_i (context); 00040 } |
|
Definition at line 114 of file Service_Context.cpp. References add_context_i(), IOP::ServiceContext::context_data, IOP::ServiceContext::context_id, TAO::unbounded_value_sequence< T >::get_buffer(), TAO::unbounded_value_sequence< T >::length(), TAO::unbounded_value_sequence< ServiceContext >::length(), TAO::unbounded_value_sequence< T >::maximum(), and TAO::unbounded_value_sequence< ServiceContext >::replace().
00115 { 00116 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i) 00117 { 00118 if (context.context_id == this->service_context_[i].context_id) 00119 { 00120 CORBA::ULong const max = context.context_data.maximum (); 00121 CORBA::ULong const len = context.context_data.length (); 00122 CORBA::Octet * const buf = context.context_data.get_buffer (1); 00123 this->service_context_[i].context_data.replace (max, len, buf, 1); 00124 return; 00125 } 00126 } 00127 00128 this->add_context_i (context); 00129 } |
|
Helper methods to implement set_context().
Definition at line 97 of file Service_Context.cpp. References add_context_i(), IOP::ServiceContext::context_id, and TAO::unbounded_value_sequence< ServiceContext >::length(). Referenced by set_context(), and set_context_i().
00098 { 00099 // @@ TODO Some contexts can show up multiple times, others 00100 // can't find out and take appropiate action. 00101 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i) 00102 { 00103 if (context.context_id == this->service_context_[i].context_id) 00104 { 00105 this->service_context_[i] = context; 00106 return; 00107 } 00108 } 00109 00110 this->add_context_i (context); 00111 } |
|
Declare FW_Server_Request_Wrapper a friend This friendship makes the FW_Server_Request_Wrapper be able to clone the TAO_Service_Context data member in TAO_ServerRequest. Definition at line 66 of file Service_Context.h. |
|
The ServiceContextList info.
Definition at line 150 of file Service_Context.h. |