#include <Marshal.h>
Inheritance diagram for TAO_Marshal_Value:
Public Member Functions | |
TAO_Marshal_Value (void) | |
virtual TAO::traverse_status | skip (CORBA::TypeCode_ptr tc, TAO_InputCDR *context) |
skip operation | |
virtual TAO::traverse_status | append (CORBA::TypeCode_ptr tc, TAO_InputCDR *src, TAO_OutputCDR *dest) |
append operation | |
Private Attributes | |
CORBA::Boolean | nested_processing_ |
marshal a valuetype
Definition at line 400 of file Marshal.h.
|
Definition at line 78 of file Marshal.inl.
00079 : nested_processing_ (false) 00080 { 00081 } |
|
append operation
Implements TAO_Marshal_Object. Definition at line 1129 of file append.cpp. References ACE_DEBUG, ACE_TEXT, ACE_OutputCDR::append_string(), LM_DEBUG, LM_WARNING, nested_processing_, TAO_InputCDR::orb_core(), TAO_Marshal_Object::perform_append(), ACE_InputCDR::read_ulong(), TAO_debug_level, TAO_ORB_Core_instance(), TAO_Valuetype_Adapter::type_info_single(), TAO_ORB_Core::valuetype_adapter(), and ACE_OutputCDR::write_ulong().
01133 { 01134 TAO::traverse_status retval = 01135 TAO::TRAVERSE_CONTINUE; 01136 01137 // Use the same method to append our base valuetype. 01138 // To achive this we'll need to distinguish between 01139 // first-time/nested appends so that we won't attempt to 01140 // append rep_id several times. 01141 // 01142 if (this->nested_processing_ == 0) 01143 { 01144 this->nested_processing_ = 1; 01145 01146 CORBA::ULong value_tag; 01147 01148 if (!src->read_ulong (value_tag) || 01149 !dest->write_ulong (value_tag)) 01150 { 01151 return TAO::TRAVERSE_STOP; 01152 } 01153 01154 TAO_ORB_Core *orb_core = src->orb_core (); 01155 if (orb_core == 0) 01156 { 01157 orb_core = TAO_ORB_Core_instance (); 01158 01159 if (TAO_debug_level > 0) 01160 { 01161 ACE_DEBUG ((LM_WARNING, 01162 "TAO (%P|%t) WARNING: extracting " 01163 "valuetype using default ORB_Core\n")); 01164 } 01165 } 01166 01167 TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter(); 01168 01169 if (value_tag == 0) // Null value type pointer. 01170 { 01171 //We are done. 01172 return retval; 01173 } 01174 else if (value_tag & adapter->type_info_single ()) 01175 { 01176 // Append repository id which is of type string. 01177 dest->append_string (*src); 01178 } 01179 else 01180 { 01181 //@@ boris: VT CDR 01182 return TAO::TRAVERSE_STOP; 01183 } 01184 } 01185 01186 // Handle our base valuetype if any. 01187 CORBA::TypeCode_var param = 01188 tc->concrete_base_type (); 01189 01190 CORBA::TCKind const param_kind = param->kind (); 01191 01192 if (param_kind != CORBA::tk_null) 01193 { 01194 retval = this->append (param.in (), 01195 src, 01196 dest 01197 ); 01198 01199 if (retval != TAO::TRAVERSE_CONTINUE) 01200 { 01201 return retval; 01202 } 01203 } 01204 01205 // Number of fields in the struct. 01206 const CORBA::ULong member_count = 01207 tc->member_count (); 01208 01209 for (CORBA::ULong i = 0; 01210 i < member_count && retval == TAO::TRAVERSE_CONTINUE; 01211 ++i) 01212 { 01213 // get member type 01214 param = tc->member_type (i); 01215 01216 retval = 01217 TAO_Marshal_Object::perform_append (param.in (), 01218 src, 01219 dest 01220 ); 01221 } 01222 01223 if (retval == TAO::TRAVERSE_CONTINUE) 01224 return TAO::TRAVERSE_CONTINUE; 01225 01226 if (TAO_debug_level > 0) 01227 ACE_DEBUG ((LM_DEBUG, 01228 ACE_TEXT ("TAO_Marshal_Value::append detected error\n"))); 01229 01230 throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE); 01231 } |
|
skip operation
Implements TAO_Marshal_Object. Definition at line 855 of file skip.cpp. References ACE_DEBUG, ACE_TEXT, TAO_Valuetype_Adapter::is_type_info_implied(), TAO_Valuetype_Adapter::is_type_info_list(), TAO_Valuetype_Adapter::is_type_info_single(), TAO_Valuetype_Adapter::is_value_chunked(), LM_DEBUG, LM_WARNING, nested_processing_, TAO_InputCDR::orb_core(), TAO_Marshal_Object::perform_skip(), ACE_InputCDR::read_long(), ACE_InputCDR::skip_bytes(), ACE_InputCDR::skip_string(), TAO_debug_level, TAO_ORB_Core_instance(), and TAO_ORB_Core::valuetype_adapter().
00856 { 00857 TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE; 00858 CORBA::TypeCode_var param; 00859 00860 // Use the same method to skip over our base valuetype. 00861 // To achive this we'll need to distinguish between 00862 // first-time/nested skips so that we won't attempt to 00863 // skip rep_id several times. 00864 // 00865 if (this->nested_processing_ == false) 00866 { 00867 this->nested_processing_ = true; 00868 00869 CORBA::Long value_tag; 00870 00871 if (!stream->read_long (value_tag)) 00872 { 00873 return TAO::TRAVERSE_STOP; 00874 } 00875 00876 TAO_ORB_Core *orb_core = stream->orb_core (); 00877 if (orb_core == 0) 00878 { 00879 orb_core = TAO_ORB_Core_instance (); 00880 00881 if (TAO_debug_level > 0) 00882 { 00883 ACE_DEBUG ((LM_WARNING, 00884 "TAO (%P|%t) WARNING: extracting " 00885 "valuetype using default ORB_Core\n")); 00886 } 00887 } 00888 00889 TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter(); 00890 00891 if (value_tag == 0) // Null value type pointer. 00892 { 00893 // We are done. 00894 return retval; 00895 } 00896 else if (adapter->is_type_info_single(value_tag)) 00897 { 00898 // Skip a single repository id which is of type string. 00899 stream->skip_string (); 00900 } 00901 else if (adapter->is_type_info_list(value_tag)) 00902 { 00903 CORBA::Long num_types; 00904 if (!stream->read_long (num_types)) 00905 { 00906 return TAO::TRAVERSE_STOP; 00907 } 00908 while (num_types > 0) 00909 { 00910 stream->skip_string(); 00911 num_types--; 00912 } 00913 } 00914 else if (!adapter->is_type_info_implied (value_tag)) 00915 { 00916 //@@ boris: VT CDR 00917 return TAO::TRAVERSE_STOP; 00918 } 00919 00920 if (adapter->is_value_chunked (value_tag)) 00921 { 00922 CORBA::Long chunk_tag = 0; 00923 while (chunk_tag != -1) 00924 { 00925 if (!stream->read_long (chunk_tag)) 00926 return TAO::TRAVERSE_STOP; 00927 00928 if (chunk_tag > 0) 00929 { 00930 if (!stream->skip_bytes(chunk_tag)) 00931 return TAO::TRAVERSE_STOP; 00932 } 00933 } 00934 return TAO::TRAVERSE_CONTINUE; 00935 } 00936 00937 } 00938 00939 // Handle our base valuetype if any. 00940 param = tc->concrete_base_type (); 00941 00942 CORBA::TCKind const k = param->kind (); 00943 00944 if (k != CORBA::tk_null) 00945 { 00946 retval = this->skip (param.in (), stream); 00947 00948 if (retval != TAO::TRAVERSE_CONTINUE) 00949 { 00950 return retval; 00951 } 00952 } 00953 00954 // Number of fields in the valuetype. 00955 CORBA::ULong const member_count = 00956 tc->member_count (); 00957 00958 for (CORBA::ULong i = 0; 00959 i < member_count && retval == TAO::TRAVERSE_CONTINUE; 00960 ++i) 00961 { 00962 param = tc->member_type (i); 00963 00964 retval = TAO_Marshal_Object::perform_skip (param.in (), stream); 00965 } 00966 00967 if (retval == TAO::TRAVERSE_CONTINUE) 00968 return TAO::TRAVERSE_CONTINUE; 00969 00970 if (TAO_debug_level > 0) 00971 ACE_DEBUG ((LM_DEBUG, 00972 ACE_TEXT ("TAO_Marshal_Value::skip detected error\n"))); 00973 00974 throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE); 00975 } |
|
|