#include <IORManipulation.h>
Inheritance diagram for TAO_IOR_Manipulation_impl:
|
constructor
Definition at line 18 of file IORManipulation.cpp.
00019 { 00020 } |
|
destructor
Definition at line 22 of file IORManipulation.cpp.
00023 { 00024 } |
|
Definition at line 118 of file IORManipulation.cpp. References TAO_IOP::TAO_IOR_Manipulation::IORList, and merge_iors().
00121 { 00122 00123 // Get an estimate of the number of profiles 00124 CORBA::Object_ptr buffer [2]; 00125 buffer [0] = ior1; 00126 buffer [1] = ior2; 00127 TAO_IOP::TAO_IOR_Manipulation::IORList iors (2, 2, buffer, 0); 00128 return this->merge_iors (iors); 00129 } |
|
Definition at line 251 of file IORManipulation.cpp.
00256 { 00257 // make sure we have some profiles in IOR 00258 if (group->_stubobj ()->base_profiles ().profile_count () == 0) 00259 throw TAO_IOP::NotFound (); 00260 // @@ Bala: this was throwing TAO_IOP::Invalid_IOR, but it was not 00261 // in the throw spec, that will result in a CORBA::UNKNOWN at 00262 // run-time (if it does not crash). Any idea about what is going on 00263 // here? 00264 00265 return prop->get_primary (group 00266 ); 00267 } |
|
Definition at line 314 of file IORManipulation.cpp.
00315 { 00316 CORBA::ULong const count = group->_stubobj ()->base_profiles ().profile_count (); 00317 00318 if (count == 0) 00319 throw TAO_IOP::EmptyProfileList (); 00320 00321 return count; 00322 } |
|
Definition at line 286 of file IORManipulation.cpp. References TAO_Profile::is_equivalent().
00290 { 00291 CORBA::ULong count = 0; 00292 TAO_Profile *pfile1, *pfile2; 00293 auto_ptr<TAO_MProfile> tmp_pfiles1 (ior1->_stubobj ()->make_profiles ()); 00294 auto_ptr<TAO_MProfile> tmp_pfiles2 (ior2->_stubobj ()->make_profiles ()); 00295 00296 tmp_pfiles1->rewind (); 00297 while ((pfile1 = tmp_pfiles1->get_next ()) > 0) 00298 { 00299 tmp_pfiles2->rewind (); 00300 while ((pfile2 = tmp_pfiles2->get_next ()) > 0) 00301 { 00302 if (pfile1->is_equivalent (pfile2)) 00303 count++; 00304 } 00305 } 00306 00307 if (count == 0) 00308 throw TAO_IOP::NotFound (); 00309 00310 return count; 00311 } |
|
Definition at line 270 of file IORManipulation.cpp.
00273 {
00274 return prop->is_primary_set (group);
00275 }
|
|
Definition at line 27 of file IORManipulation.cpp. References CORBA::Object::_nil(), ACE_AUTO_PTR_RESET, ACE_NEW_THROW_EX, TAO_MProfile::add_profiles(), TAO_ORB_Core::create_stub(), TAO_Stub_Auto_Ptr::get(), ACE_Auto_Basic_Ptr< X >::get(), TAO_IOP::TAO_IOR_Manipulation::IORList, TAO_MProfile::is_equivalent(), CORBA::is_nil(), TAO_Stub_Auto_Ptr::release(), ACE_OS::strcmp(), CORBA::string_dup(), and TAO_ORB_Core_instance(). Referenced by add_profiles().
00029 { 00030 // we need to create a new CORBA::Object which has the union of the 00031 // two profile lists. However, if any profiles are duplicates (i.e. in 00032 // bott lisis) then an exception is raised. 00033 00034 // Deterinine how many profiles we have 00035 // Get an estimate of the size - pfile count could change since we 00036 // neither lock nor get a copy in this loop. 00037 CORBA::ULong i, count=0; 00038 for (i = 0; i < iors.length (); i++) 00039 { 00040 count += iors[i]->_stubobj ()->base_profiles ().profile_count (); 00041 } 00042 00043 // make sure we have some profiles 00044 if (count == 0) 00045 throw TAO_IOP::EmptyProfileList (); 00046 00047 // initialize with estimated pfile count. 00048 TAO_MProfile Merged_Profiles (count); 00049 00050 // get the profile lists, start by initialize the composite reference 00051 // by using the first Object. Then for each subsequent Object verify 00052 // they are the same type and they do not have duplicate profiles. 00053 auto_ptr<TAO_MProfile> tmp_pfiles (iors[0]->_stubobj ()->make_profiles ()); 00054 if (Merged_Profiles.add_profiles (tmp_pfiles.get ())< 0) 00055 throw TAO_IOP::Invalid_IOR (); 00056 CORBA::String_var id = 00057 CORBA::string_dup (iors[0]->_stubobj ()->type_id.in ()); 00058 00059 for (i = 1; i < iors.length () ; i++) 00060 { 00061 // this gets a copy of the MProfile, hense the auto_ptr; 00062 00063 ACE_AUTO_PTR_RESET (tmp_pfiles, 00064 iors[i]->_stubobj ()->make_profiles (), 00065 TAO_MProfile); 00066 00067 // check to see if any of the profile in tmp_pfiles are already 00068 // in Merged_Profiles. If so raise exception. 00069 if (Merged_Profiles.is_equivalent (tmp_pfiles.get ())) 00070 throw TAO_IOP::Duplicate (); 00071 00072 // If the object type_id's differ then raise an exception. 00073 if (id.in () && iors[i]->_stubobj ()->type_id.in () && 00074 ACE_OS::strcmp (id.in (), iors[i]->_stubobj ()->type_id.in ())) 00075 throw TAO_IOP::Invalid_IOR (); 00076 00077 // append profiles 00078 if (Merged_Profiles.add_profiles (tmp_pfiles.get ()) < 0) 00079 throw TAO_IOP::Invalid_IOR (); 00080 00081 } 00082 00083 // MS C++ knows nothing about reset! 00084 // tmp_pfiles.reset (0); // get rid of last MProfile 00085 00086 TAO_ORB_Core *orb_core = TAO_ORB_Core_instance (); 00087 00088 TAO_Stub *stub = orb_core->create_stub (id.in (), // give the id string 00089 Merged_Profiles); 00090 00091 // Make the stub memory allocation exception safe for the duration 00092 // of this method. 00093 TAO_Stub_Auto_Ptr safe_stub (stub); 00094 00095 // Create the CORBA level proxy 00096 CORBA::Object_ptr temp_obj = CORBA::Object::_nil (); 00097 ACE_NEW_THROW_EX (temp_obj, 00098 CORBA::Object (safe_stub.get ()), 00099 CORBA::NO_MEMORY ()); 00100 00101 CORBA::Object_var new_obj = temp_obj; 00102 00103 00104 // Clean up in case of errors. 00105 if (CORBA::is_nil (new_obj.in ())) 00106 { 00107 throw TAO_IOP::Invalid_IOR (); 00108 } 00109 00110 // Release ownership of the pointers protected by the auto_ptrs since they 00111 // no longer need to be protected by this point. 00112 stub = safe_stub.release (); 00113 00114 return new_obj._retn (); 00115 } |
|
Definition at line 278 of file IORManipulation.cpp.
00281 {
00282 return prop->remove_primary_tag (group);
00283 }
|
|
Definition at line 132 of file IORManipulation.cpp. References CORBA::Object::_nil(), ACE_AUTO_PTR_RESET, ACE_NEW_THROW_EX, TAO_MProfile::add_profiles(), TAO_ORB_Core::create_stub(), TAO_Stub_Auto_Ptr::get(), ACE_Auto_Basic_Ptr< X >::get(), CORBA::is_nil(), TAO_Stub_Auto_Ptr::release(), TAO_MProfile::remove_profiles(), ACE_OS::strcmp(), CORBA::string_dup(), and TAO_ORB_Core_instance().
00136 { 00137 // First verify they are the same type! 00138 CORBA::String_var id = 00139 CORBA::string_dup (group->_stubobj ()->type_id.in ()); 00140 if (id.in () && ior2->_stubobj ()->type_id.in () && 00141 ACE_OS::strcmp (id.in (), ior2->_stubobj ()->type_id.in ())) 00142 throw TAO_IOP::Invalid_IOR (); 00143 00144 // Since we are removing from group ... 00145 CORBA::ULong count = group->_stubobj ()->base_profiles ().profile_count (); 00146 00147 // make sure we have some profiles 00148 if (count == 0 || 00149 ior2->_stubobj ()->base_profiles ().profile_count () == 0) 00150 throw TAO_IOP::EmptyProfileList (); 00151 00152 // initialize with estimated pfile count. 00153 TAO_MProfile Diff_Profiles (count); 00154 00155 auto_ptr<TAO_MProfile> tmp_pfiles (group->_stubobj ()->make_profiles ()); 00156 if (Diff_Profiles.add_profiles (tmp_pfiles.get ()) < 0) 00157 throw TAO_IOP::Invalid_IOR (); 00158 00159 // We are done with add_profiles. 00160 // At this point, we don't do remove_profiles() 00161 // immediately like before, 00162 // because it could result in an 00163 // Object Reference with 0 profile. And it would not pass 00164 // the ::CORBA::is_nil() evaluation. 00165 // Instead, we create the Object Reference right here, which is 00166 // earlier than before.(Actually, I just moved some code 00167 // from below up to here). 00168 TAO_ORB_Core *orb_core = TAO_ORB_Core_instance (); 00169 00170 TAO_Stub *stub = orb_core->create_stub (id.in (), // give the id string 00171 Diff_Profiles 00172 ); 00173 00174 // Make the stub memory allocation exception safe for the duration 00175 // of this method. 00176 TAO_Stub_Auto_Ptr safe_stub (stub); 00177 00178 // Create the CORBA level proxy 00179 CORBA::Object_ptr temp_obj = CORBA::Object::_nil (); 00180 ACE_NEW_THROW_EX (temp_obj, 00181 CORBA::Object (safe_stub.get ()), 00182 CORBA::NO_MEMORY ()); 00183 00184 CORBA::Object_var new_obj = temp_obj; 00185 00186 // Exception safety is no longer an issue by this point so release 00187 // the TAO_Stub from the TAO_Stub_Auto_Ptr. 00188 stub = safe_stub.release (); 00189 00190 // Clean up in case of errors. 00191 if (CORBA::is_nil (new_obj.in ())) 00192 { 00193 throw TAO_IOP::Invalid_IOR (); 00194 } 00195 00196 // Now we can remove the profiles which we want to elimitate from 00197 // the Object. 00198 ACE_AUTO_PTR_RESET (tmp_pfiles, 00199 ior2->_stubobj ()->make_profiles (), 00200 TAO_MProfile); 00201 00202 TAO_MProfile& mp = stub -> base_profiles(); 00203 if (mp.remove_profiles (tmp_pfiles.get ()) < 0) 00204 throw TAO_IOP::NotFound (); 00205 00206 // MS C++ knows nothing about reset! 00207 // tmp_pfiles.reset (0); // get rid of last MProfile 00208 00209 return new_obj._retn (); 00210 } |
|
Definition at line 229 of file IORManipulation.cpp.
00234 { 00235 // make sure we have some profiles in GROUP 00236 if (group->_stubobj ()->base_profiles ().profile_count () == 0) 00237 throw TAO_IOP::Invalid_IOR (); 00238 00239 // Make sure we have only one profile in new_primary 00240 // @@ Will fail if the object has been 00241 /*if (new_primary->_stubobj ()->base_profiles ().profile_count () > 1) 00242 throw TAO_IOP::MultiProfileList ();*/ 00243 00244 // Call the callback object to do the rest of the processing. 00245 return prop->set_primary (new_primary, 00246 group 00247 ); 00248 } |
|
Definition at line 213 of file IORManipulation.cpp.
00217 { 00218 // make sure we have some profiles 00219 if (group->_stubobj ()->base_profiles ().profile_count () == 0) 00220 throw TAO_IOP::Invalid_IOR (); 00221 00222 // Call the implementation object to 00223 return prop->set_property (group 00224 ); 00225 } |