#include <Service_Context.h>
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 131 of file Service_Context.cpp. References IOP::ServiceContext::context_data, and IOP::ServiceContext::context_id.
00132 {
00133 // @@ TODO Some contexts can show up multiple times, others
00134 // can't find out and take appropiate action.
00135 CORBA::ULong const l = this->service_context_.length ();
00136 this->service_context_.length (l + 1);
00137 this->service_context_[l].context_id = context.context_id;
00138 CORBA::ULong const max = context.context_data.maximum ();
00139 CORBA::ULong const len = context.context_data.length ();
00140 CORBA::Octet* const buf = context.context_data.get_buffer (1);
00141 this->service_context_[l].context_data.replace (max, len, buf, 1);
00142 }
|
|
|
Definition at line 145 of file Service_Context.cpp. Referenced by set_context(), and set_context_i().
00146 {
00147 // @@ TODO Some contexts can show up multiple times, others
00148 // can't find out and take appropiate action.
00149 CORBA::ULong const l = this->service_context_.length ();
00150 this->service_context_.length (l + 1);
00151 this->service_context_[l] = context;
00152 }
|
|
|
Definition at line 213 of file Service_Context.cpp.
00214 {
00215 if ((cdr >> this->service_context_) == 0)
00216 {
00217 return 0;
00218 }
00219
00220 return 1;
00221 }
|
|
|
= Marshaling and demarshaling the list
Definition at line 207 of file Service_Context.cpp.
00208 {
00209 return (cdr << this->service_context_);
00210 }
|
|
||||||||||||
|
Definition at line 186 of file Service_Context.cpp. References ACE_NEW_RETURN, and IOP::ServiceId.
00188 {
00189 CORBA::ULong const len = this->service_context_.length ();
00190
00191 for (CORBA::ULong i = 0; i < len; ++i)
00192 {
00193 if (id == this->service_context_[i].context_id)
00194 {
00195 ACE_NEW_RETURN (context, IOP::ServiceContext, 0);
00196
00197 *(context.ptr ()) = this->service_context_[i];
00198
00199 return 1;
00200 }
00201 }
00202
00203 return 0;
00204 }
|
|
||||||||||||
|
Get a reference to a context identified by id, return 0 if the component is not present. Definition at line 170 of file Service_Context.cpp. References IOP::ServiceId.
00172 {
00173 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
00174 {
00175 if (id == this->service_context_[i].context_id)
00176 {
00177 *context = &this->service_context_[i];
00178 return 1;
00179 }
00180 }
00181
00182 return 0;
00183 }
|
|
|
Get a copy of the context identified by <context.context_id>, return 0 if the component is not present. Definition at line 155 of file Service_Context.cpp. References IOP::ServiceContext::context_id. Referenced by TAO_GIOP_Message_Generator_Parser_12::process_bidir_context().
00156 {
00157 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
00158 {
00159 if (context.context_id == this->service_context_[i].context_id)
00160 {
00161 context = this->service_context_[i];
00162 return 1;
00163 }
00164 }
00165
00166 return 0;
00167 }
|
|
|
Helper methods to implement get_context().
|
|
|
Is the id available in the underlying service context list? If so return true, else return false Definition at line 42 of file Service_Context.inl. References IOP::ServiceId. Referenced by TAO_GIOP_Message_Generator_Parser_12::check_bidirectional_context().
00043 {
00044 for (CORBA::ULong i = 0;
00045 i != this->service_context_.length ();
00046 ++i)
00047 {
00048 if (id == this->service_context_[i].context_id)
00049 {
00050 return true;
00051 }
00052 }
00053 return false;
00054 }
|
|
|
|
|
|
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 34 of file Service_Context.inl. References set_context_i().
00036 {
00037 this->set_context_i (context,
00038 cdr);
00039 }
|
|
||||||||||||
|
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().
00028 {
00029 this->set_context_i (id,
00030 cdr);
00031 }
|
|
|
Insert the component into the list, but efficiently stealing the contents of the octet sequence. Definition at line 90 of file Service_Context.cpp. References add_context_i().
00091 {
00092 this->add_context_i (context);
00093 }
|
|
||||||||||||
|
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 66 of file Service_Context.cpp. References add_context_i(), and IOP::ServiceContext::context_id.
00068 {
00069 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
00070 {
00071 if (context.context_id == this->service_context_[i].context_id)
00072 {
00073 if (replace)
00074 {
00075 this->service_context_[i] = context;
00076 return 1;
00077 }
00078 else
00079 {
00080 return 0;
00081 }
00082 }
00083 }
00084
00085 this->add_context_i (context);
00086 return 1;
00087 }
|
|
|
= Generic components Insert the component into the list, making a copy of the octet sequence. Definition at line 60 of file Service_Context.cpp. References add_context_i(). Referenced by TAO_IIOP_Transport::set_bidir_context_info().
00061 {
00062 this->add_context_i (context);
00063 }
|
|
||||||||||||
|
Definition at line 42 of file Service_Context.cpp. References ACE_OutputCDR::begin(), ACE_Message_Block::cont(), IOP::ServiceContext::context_data, ACE_Message_Block::length(), ACE_OS::memcpy(), ACE_Message_Block::rd_ptr(), and ACE_OutputCDR::total_length().
00044 {
00045 // Make a *copy* of the CDR stream...
00046 size_t const length = cdr.total_length ();
00047 context.context_data.length (static_cast<CORBA::ULong> (length));
00048 CORBA::Octet *buf = context.context_data.get_buffer ();
00049
00050 for (const ACE_Message_Block *i = cdr.begin ();
00051 i != 0;
00052 i = i->cont ())
00053 {
00054 ACE_OS::memcpy (buf, i->rd_ptr (), i->length ());
00055 buf += i->length ();
00056 }
00057 }
|
|
||||||||||||
|
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, ACE_Message_Block::length(), ACE_OS::memcpy(), ACE_Message_Block::rd_ptr(), IOP::ServiceId, set_context_i(), and ACE_OutputCDR::total_length().
00021 {
00022 IOP::ServiceContext context;
00023 context.context_id = id;
00024
00025 // Make a *copy* of the CDR stream...
00026 size_t const length = cdr.total_length ();
00027 context.context_data.length (static_cast<CORBA::ULong> (length));
00028 CORBA::Octet *buf = context.context_data.get_buffer ();
00029
00030 for (const ACE_Message_Block *i = cdr.begin ();
00031 i != 0;
00032 i = i->cont ())
00033 {
00034 ACE_OS::memcpy (buf, i->rd_ptr (), i->length ());
00035 buf += i->length ();
00036 }
00037
00038 this->set_context_i (context);
00039 }
|
|
|
Definition at line 113 of file Service_Context.cpp. References add_context_i(), IOP::ServiceContext::context_data, and IOP::ServiceContext::context_id.
00114 {
00115 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
00116 {
00117 if (context.context_id == this->service_context_[i].context_id)
00118 {
00119 CORBA::ULong const max = context.context_data.maximum ();
00120 CORBA::ULong const len = context.context_data.length ();
00121 CORBA::Octet * const buf = context.context_data.get_buffer (1);
00122 this->service_context_[i].context_data.replace (max, len, buf, 1);
00123 return;
00124 }
00125 }
00126
00127 this->add_context_i (context);
00128 }
|
|
|
Helper methods to implement set_context().
Definition at line 96 of file Service_Context.cpp. References add_context_i(), and IOP::ServiceContext::context_id. Referenced by set_context(), and set_context_i().
00097 {
00098 // @@ TODO Some contexts can show up multiple times, others
00099 // can't find out and take appropiate action.
00100 for (CORBA::ULong i = 0; i != this->service_context_.length (); ++i)
00101 {
00102 if (context.context_id == this->service_context_[i].context_id)
00103 {
00104 this->service_context_[i] = context;
00105 return;
00106 }
00107 }
00108
00109 this->add_context_i (context);
00110 }
|
|
|
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 148 of file Service_Context.h. |
1.3.6