diff options
Diffstat (limited to 'TAO/orbsvcs/IFR_Service/UnionDef_i.cpp')
-rw-r--r-- | TAO/orbsvcs/IFR_Service/UnionDef_i.cpp | 111 |
1 files changed, 94 insertions, 17 deletions
diff --git a/TAO/orbsvcs/IFR_Service/UnionDef_i.cpp b/TAO/orbsvcs/IFR_Service/UnionDef_i.cpp index b23aee092ee..2af92163633 100644 --- a/TAO/orbsvcs/IFR_Service/UnionDef_i.cpp +++ b/TAO/orbsvcs/IFR_Service/UnionDef_i.cpp @@ -33,12 +33,21 @@ void TAO_UnionDef_i::destroy (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_IFR_WRITE_GUARD; + + this->destroy_i (ACE_TRY_ENV); +} + +void +TAO_UnionDef_i::destroy_i (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ // Destroy our members. - TAO_Container_i::destroy (ACE_TRY_ENV); + TAO_Container_i::destroy_i (ACE_TRY_ENV); ACE_CHECK; // Destroy ourself. - TAO_Contained_i::destroy (ACE_TRY_ENV); + TAO_Contained_i::destroy_i (ACE_TRY_ENV); ACE_CHECK; } @@ -46,6 +55,15 @@ CORBA::TypeCode_ptr TAO_UnionDef_i::type (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_IFR_READ_GUARD_RETURN (CORBA::TypeCode::_nil ()); + + return this->type_i (ACE_TRY_ENV); +} + +CORBA::TypeCode_ptr +TAO_UnionDef_i::type_i (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ ACE_TString id; this->repo_->config ()->get_string_value (this->section_key_, "id", @@ -56,10 +74,10 @@ TAO_UnionDef_i::type (CORBA::Environment &ACE_TRY_ENV) "name", name); - CORBA::TypeCode_var tc = this->discriminator_type (ACE_TRY_ENV); + CORBA::TypeCode_var tc = this->discriminator_type_i (ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); - IR::UnionMemberSeq_var members = this->members (ACE_TRY_ENV); + IR::UnionMemberSeq_var members = this->members_i (ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); return this->repo_->tc_factory ()->create_union_tc (id.c_str (), @@ -73,6 +91,15 @@ CORBA::TypeCode_ptr TAO_UnionDef_i::discriminator_type (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_IFR_READ_GUARD_RETURN (CORBA::TypeCode::_nil ()); + + return this->discriminator_type_i (ACE_TRY_ENV); +} + +CORBA::TypeCode_ptr +TAO_UnionDef_i::discriminator_type_i (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ ACE_TString disc_path; this->repo_->config ()->get_string_value (this->section_key_, "disc_path", @@ -90,13 +117,22 @@ TAO_UnionDef_i::discriminator_type (CORBA::Environment &ACE_TRY_ENV) auto_ptr<TAO_IDLType_i> safety (impl); - return impl->type (ACE_TRY_ENV); + return impl->type_i (ACE_TRY_ENV); } IR::IDLType_ptr TAO_UnionDef_i::discriminator_type_def (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_IFR_READ_GUARD_RETURN (IR::IDLType::_nil ()); + + return this->discriminator_type_def_i (ACE_TRY_ENV); +} + +IR::IDLType_ptr +TAO_UnionDef_i::discriminator_type_def_i (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ ACE_TString disc_path; this->repo_->config ()->get_string_value (this->section_key_, "disc_path", @@ -133,6 +169,19 @@ TAO_UnionDef_i::discriminator_type_def ( ) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_IFR_WRITE_GUARD; + + this->discriminator_type_def_i (discriminator_type_def, + ACE_TRY_ENV); +} + +void +TAO_UnionDef_i::discriminator_type_def_i ( + IR::IDLType_ptr discriminator_type_def, + CORBA::Environment &ACE_TRY_ENV + ) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ PortableServer::ObjectId_var oid = this->repo_->ir_poa ()->reference_to_id (discriminator_type_def, ACE_TRY_ENV); @@ -150,6 +199,15 @@ IR::UnionMemberSeq * TAO_UnionDef_i::members (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_IFR_READ_GUARD_RETURN (0); + + return this->members_i (ACE_TRY_ENV); +} + +IR::UnionMemberSeq * +TAO_UnionDef_i::members_i (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ ACE_Unbounded_Queue<ACE_Configuration_Section_Key> key_queue; ACE_Configuration_Section_Key refs_key; @@ -204,12 +262,17 @@ TAO_UnionDef_i::members (CORBA::Environment &ACE_TRY_ENV) IR::UnionMemberSeq_var retval = members; + ACE_TString name, path; + ACE_Configuration_Section_Key next_key, entry_key; + u_int kind = 0; + IR::DefinitionKind def_kind = IR::dk_none; + CORBA::Object_var obj; + TAO_IDLType_i *impl = 0; + for (size_t k = 0; k < size; k++) { - ACE_Configuration_Section_Key next_key; key_queue.dequeue_head (next_key); - ACE_TString name; this->repo_->config ()->get_string_value (next_key, "name", name); @@ -221,26 +284,23 @@ TAO_UnionDef_i::members (CORBA::Environment &ACE_TRY_ENV) ACE_TRY_ENV); ACE_CHECK_RETURN (0); - ACE_TString path; this->repo_->config ()->get_string_value (next_key, "path", path); - ACE_Configuration_Section_Key entry_key; this->repo_->config ()->expand_path (this->repo_->root_key (), path, entry_key, 0); - u_int kind; this->repo_->config ()->get_integer_value (entry_key, "def_kind", kind); - IR::DefinitionKind def_kind = + def_kind = ACE_static_cast (IR::DefinitionKind, kind); - CORBA::Object_var obj = + obj = this->repo_->servant_factory ()->create_objref (def_kind, path.c_str (), ACE_TRY_ENV); @@ -249,8 +309,15 @@ TAO_UnionDef_i::members (CORBA::Environment &ACE_TRY_ENV) retval[k].type_def = IR::IDLType::_narrow (obj.in (), ACE_TRY_ENV); ACE_CHECK_RETURN (0); + + impl = + this->repo_->servant_factory ()->create_idltype (entry_key, + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + auto_ptr<TAO_IDLType_i> safety (impl); - retval[k].type = retval[k].type_def->type (ACE_TRY_ENV); + retval[k].type = impl->type_i (ACE_TRY_ENV); ACE_CHECK_RETURN (0); } @@ -262,8 +329,19 @@ TAO_UnionDef_i::members (const IR::UnionMemberSeq &members, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { + TAO_IFR_WRITE_GUARD; + + this->members_i (members, + ACE_TRY_ENV); +} + +void +TAO_UnionDef_i::members_i (const IR::UnionMemberSeq &members, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ // Destroy our old members, both refs and defns. - TAO_Container_i::destroy (ACE_TRY_ENV); + TAO_Container_i::destroy_i (ACE_TRY_ENV); ACE_CHECK; ACE_TString section_name; @@ -291,10 +369,9 @@ TAO_UnionDef_i::members (const IR::UnionMemberSeq &members, 1, member_key); - ACE_TString name (members[i].name); this->repo_->config ()->set_string_value (member_key, "name", - name); + members[i].name.in ()); PortableServer::ObjectId_var oid = this->repo_->ir_poa ()->reference_to_id (members[i].type_def, @@ -337,7 +414,7 @@ TAO_UnionDef_i::fetch_label (const ACE_Configuration_Section_Key member_key, "label", value); - CORBA::TypeCode_var tc = this->discriminator_type (ACE_TRY_ENV); + CORBA::TypeCode_var tc = this->discriminator_type_i (ACE_TRY_ENV); ACE_CHECK; CORBA::TCKind kind = tc->kind (ACE_TRY_ENV); |