00001 // -*- C++ -*- 00002 // 00003 //$Id: target_specification.inl 73791 2006-07-27 20:54:56Z wotte $ 00004 00005 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00006 00007 ACE_INLINE 00008 TAO_Target_Specification::TAO_Target_Specification (void) 00009 :specifier_ (TAO_Target_Specification::Key_Addr), 00010 profile_index_ (0) 00011 { 00012 //no-op 00013 } 00014 00015 ACE_INLINE void 00016 TAO_Target_Specification::target_specifier (const TAO::ObjectKey &key) 00017 { 00018 this->specifier_ = TAO_Target_Specification::Key_Addr; 00019 // @@ Bala: this is a good recipe for a crash, if the <key> was on 00020 // the stack or is otherwise destroyed then you are in big 00021 // trouble. 00022 // @@ Carlos: As suggested by you I have documented that in the 00023 // headerfile. 00024 // @@ Bala: beware, documentation is good, code that works in 00025 // general is better.... but you are probably right in this case, i 00026 // suspect this stuff goes right in the critical path, right? So 00027 // making a copy of the object key would be too expensive.. 00028 this->u_.object_key_ = const_cast<TAO::ObjectKey *> (&key); 00029 } 00030 00031 ACE_INLINE void 00032 TAO_Target_Specification::target_specifier (IOP::TaggedProfile &profile) 00033 00034 { 00035 this->specifier_ = TAO_Target_Specification::Profile_Addr; 00036 this->u_.profile_ = const_cast<IOP::TaggedProfile *> (&profile); 00037 00038 } 00039 00040 ACE_INLINE void 00041 TAO_Target_Specification::target_specifier (IOP::IOR &ior, 00042 CORBA::ULong prof_index) 00043 { 00044 this->specifier_ = TAO_Target_Specification::Reference_Addr; 00045 this->u_.ior_ = const_cast<IOP::IOR *> (&ior); 00046 this->profile_index_ = prof_index; 00047 00048 } 00049 00050 ACE_INLINE const TAO::ObjectKey* 00051 TAO_Target_Specification::object_key (void) 00052 { 00053 if (this->specifier_ == TAO_Target_Specification::Key_Addr) 00054 return this->u_.object_key_; 00055 00056 return 0; 00057 } 00058 00059 ACE_INLINE const IOP::TaggedProfile * 00060 TAO_Target_Specification::profile (void) 00061 { 00062 if (this->specifier_ == TAO_Target_Specification::Profile_Addr) 00063 return this->u_.profile_; 00064 00065 return 0; 00066 } 00067 00068 ACE_INLINE CORBA::ULong 00069 TAO_Target_Specification::iop_ior (IOP::IOR *& ior) 00070 { 00071 if (this->specifier_ == TAO_Target_Specification::Reference_Addr) 00072 { 00073 ior = this->u_.ior_; 00074 return this->profile_index_; 00075 } 00076 00077 ior = 0; 00078 return 0; 00079 } 00080 00081 ACE_INLINE TAO_Target_Specification::TAO_Target_Address 00082 TAO_Target_Specification::specifier (void) 00083 { 00084 return this->specifier_; 00085 } 00086 00087 TAO_END_VERSIONED_NAMESPACE_DECL