1 #include "tao/Tagged_Profile.h"
2 #include "tao/ORB_Core.h"
3 #include "tao/Acceptor_Registry.h"
4 #include "tao/Transport_Acceptor.h"
5 #include "tao/Thread_Lane_Resources.h"
7 #include "tao/target_specification.h"
10 #if !defined (__ACE_INLINE__)
11 # include "tao/Tagged_Profile.inl"
12 #endif /* ! __ACE_INLINE__ */
14 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
17 TAO_Tagged_Profile::extract_object_key (IOP::TaggedProfile
&profile
)
19 // Get our Acceptor registry
20 TAO_Acceptor_Registry
&acceptor_registry
=
21 this->orb_core_
->lane_resources ().acceptor_registry ();
23 // Get the right acceptor for the tag in the TaggedProfile
24 TAO_Acceptor
*acceptor
= acceptor_registry
.get_acceptor (profile
.tag
);
29 if (acceptor
->object_key (profile
, this->object_key_
) == -1)
38 TAOLIB_ERROR ((LM_ERROR
,
39 ACE_TEXT ("(%P|%t)TAO_Tagged_Profile\n")));
49 TAO_Tagged_Profile::unmarshall_target_address (TAO_InputCDR
&cdr
)
51 CORBA::Boolean hdr_status
= cdr
.read_short (this->discriminator_
);
55 switch (this->discriminator_
)
57 case TAO_Target_Specification::Key_Addr
:
58 hdr_status
= this->unmarshall_object_key_i (cdr
);
61 case TAO_Target_Specification::Profile_Addr
:
62 hdr_status
= this->unmarshall_iop_profile_i (cdr
);
65 case TAO_Target_Specification::Reference_Addr
:
66 hdr_status
= this->unmarshall_ref_addr_i (cdr
);
79 TAO_Tagged_Profile::unmarshall_object_key (TAO_InputCDR
&input
)
81 this->discriminator_
= TAO_Target_Specification::Key_Addr
;
83 return this->unmarshall_object_key_i (input
);
88 TAO_Tagged_Profile::unmarshall_object_key_i (TAO_InputCDR
&input
)
90 CORBA::Boolean hdr_status
= input
.good_bit ();
92 CORBA::Long key_length
= 0;
93 hdr_status
= hdr_status
&& input
.read_long (key_length
);
97 this->object_key_
.replace (key_length
,
99 (CORBA::Octet
*)input
.rd_ptr (),
101 input
.skip_bytes (key_length
);
103 this->object_key_extracted_
= true;
111 TAO_Tagged_Profile::unmarshall_iop_profile_i (TAO_InputCDR
&input
)
113 CORBA::Boolean hdr_status
= input
.good_bit ();
115 // Extract into the IOP::Tagged profile.
116 hdr_status
&= input
>> this->profile_
;
122 TAO_Tagged_Profile::unmarshall_ref_addr_i (TAO_InputCDR
&input
)
124 CORBA::Boolean hdr_status
= input
.good_bit ();
127 * The GIOP::IORAddressingInfo is defined as follows
128 * struct IORAddressingInfo
130 * unsigned long selected_profile_index;
134 * and the IOP::IOR is defined to be
138 * sequence<TaggedProfile> profiles;
142 // First read the profile index
143 CORBA::ULong prof_index
= 0;
145 hdr_status
= hdr_status
&& input
.read_ulong (prof_index
);
147 // Set the value in TAO_Tagged_Profile
150 this->profile_index_
= prof_index
;
153 // Get the length of the type_id
154 CORBA::Long id_length
= 0;
155 hdr_status
= hdr_status
&& input
.read_long (id_length
);
159 // Set the type_id (it is not owned by this object)
160 this->type_id_
= input
.rd_ptr ();
162 input
.skip_bytes (id_length
);
165 // Unmarshall the sequence of TaggedProfiles
166 IOP::TaggedProfileSeq ior_profiles
;
168 hdr_status
&= input
>> ior_profiles
;
170 // Get the right TaggedProfile from the <ior_profiles>
173 this->profile_
= ior_profiles
[prof_index
];
179 TAO_END_VERSIONED_NAMESPACE_DECL