#include <PG_Utils.h>
Static Public Member Functions | |
CORBA::Boolean | set_tagged_component (PortableGroup::ObjectGroup *&ior, PortableGroup::TagGroupTaggedComponent &t) |
Set tagged component for the object group. | |
CORBA::Boolean | get_tagged_component (PortableGroup::ObjectGroup *&ior, PortableGroup::TagGroupTaggedComponent &t) |
Get tagged component for the object group. | |
Static Private Member Functions | |
CORBA::Boolean | encode_properties (TAO_OutputCDR &cdr, PortableGroup::TagGroupTaggedComponent &tg) |
Definition at line 35 of file PG_Utils.h.
|
Definition at line 139 of file PG_Utils.cpp. References ACE_OutputCDR::good_bit(), and TAO_ENCAP_BYTE_ORDER.
00142 { 00143 cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); 00144 00145 if (!cdr.good_bit ()) 00146 return 0; 00147 00148 // the version info 00149 cdr << tg.component_version; 00150 00151 if (!cdr.good_bit ()) 00152 return 0; 00153 00154 // the domain id 00155 cdr << tg.group_domain_id.in (); 00156 00157 if (!cdr.good_bit ()) 00158 return 0; 00159 00160 // Object group id 00161 cdr << tg.object_group_id; 00162 00163 if (!cdr.good_bit ()) 00164 return 0; 00165 00166 // Object group reference version 00167 cdr << tg.object_group_ref_version; 00168 00169 if (!cdr.good_bit ()) 00170 return 0; 00171 00172 return cdr.good_bit (); 00173 } |
|
Get tagged component for the object group.
Definition at line 87 of file PG_Utils.cpp. References IOP::TaggedComponent::component_data, TAO_Tagged_Components::get_component(), TAO_MProfile::get_profile(), ACE_InputCDR::good_bit(), PortableGroup::ObjectGroup, TAO_MProfile::profile_count(), ACE_InputCDR::reset_byte_order(), IOP::TaggedComponent::tag, and TAO_Profile::tagged_components(). Referenced by TAO::PG_Group_Factory::create_group(), TAO::PG_Group_Factory::destroy_group(), dump_membership(), and TAO::PG_Group_Factory::find_group().
00090 { 00091 if (ior->_stubobj () == 0) 00092 return 0; 00093 00094 TAO_MProfile &mprofile = 00095 ior->_stubobj ()->base_profiles (); 00096 00097 // Looking for a tagged component with a TAG_FT_GROUP flag. 00098 IOP::TaggedComponent tc; 00099 tc.tag = IOP::TAG_FT_GROUP; 00100 00101 CORBA::ULong count = 00102 mprofile.profile_count (); 00103 00104 for (CORBA::ULong i = 0; 00105 i < count; 00106 i++) 00107 { 00108 00109 // Get the Tagged Components 00110 const TAO_Tagged_Components &pfile_tagged = 00111 mprofile.get_profile (i)->tagged_components (); 00112 00113 // Look for the primary 00114 if (pfile_tagged.get_component (tc) == 1) 00115 { 00116 TAO_InputCDR cdr (reinterpret_cast<const char*> (tc.component_data.get_buffer ()), 00117 tc.component_data.length ()); 00118 00119 CORBA::Boolean byte_order; 00120 00121 cdr >> ACE_InputCDR::to_boolean (byte_order); 00122 00123 if (!cdr.good_bit ()) 00124 return 0; 00125 00126 cdr.reset_byte_order (static_cast<int> (byte_order)); 00127 00128 cdr >> tg; 00129 00130 if (cdr.good_bit ()) 00131 return 1; 00132 } 00133 } 00134 00135 return 0; 00136 } |
|
Set tagged component for the object group.
Definition at line 21 of file PG_Utils.cpp. References ACE_OutputCDR::begin(), IOP::TaggedComponent::component_data, ACE_Message_Block::cont(), TAO_MProfile::get_profile(), ACE_Message_Block::length(), ACE_OS::memcpy(), PortableGroup::ObjectGroup, ACE_Message_Block::rd_ptr(), TAO_Tagged_Components::set_component(), IOP::TaggedComponent::tag, TAO_Profile::tagged_components(), and ACE_OutputCDR::total_length(). Referenced by TAO::PG_Object_Group::increment_version().
00024 { 00025 if (ior->_stubobj () == 0) 00026 return 0; 00027 00028 // We need to apply the property for every profile in the IOR 00029 TAO_MProfile &tmp_pfiles = 00030 ior->_stubobj ()->base_profiles (); 00031 00032 // Create the output CDR stream 00033 TAO_OutputCDR cdr; 00034 00035 IOP::TaggedComponent tagged_components; 00036 tagged_components.tag = IOP::TAG_FT_GROUP; 00037 00038 // Encode the property in to the tagged_components 00039 CORBA::Boolean retval = 00040 PG_Utils::encode_properties (cdr, 00041 tg); 00042 00043 if (retval == 0) 00044 return retval; 00045 00046 // Get the length of the CDR stream 00047 CORBA::ULong length = static_cast<CORBA::ULong> (cdr.total_length ()); 00048 00049 // Set the length 00050 tagged_components.component_data.length (length); 00051 00052 // Get the pointer to the underlying buffer 00053 CORBA::Octet *buf = 00054 tagged_components.component_data.get_buffer (); 00055 00056 for (const ACE_Message_Block *i = cdr.begin (); 00057 i != 0; 00058 i = i->cont ()) 00059 { 00060 00061 ACE_OS::memcpy (buf, i->rd_ptr (), i->length ()); 00062 buf += i->length (); 00063 } 00064 const IOP::TaggedComponent &tmp_tc = tagged_components; 00065 00066 // Get the profile count. 00067 CORBA::ULong count = 00068 ior->_stubobj ()->base_profiles ().profile_count (); 00069 00070 // Go through every profile and set the TaggedComponent field 00071 for (CORBA::ULong p_idx = 0; p_idx < count ; ++p_idx) 00072 { 00073 // Get the tagged components in the profile 00074 TAO_Tagged_Components &tag_comp = 00075 tmp_pfiles.get_profile (p_idx)->tagged_components (); 00076 00077 // Finally set the <tagged_component> in the 00078 // <TAO_Tagged_Component> 00079 tag_comp.set_component (tmp_tc); 00080 } 00081 00082 // Success 00083 return 1; 00084 } |