📄 homedef_i.cpp
字号:
/* -*- C++ -*- */
// HomeDef_i.cpp,v 1.11 2003/08/05 19:04:35 parsons Exp
#include "Repository_i.h"
#include "HomeDef_i.h"
#include "FactoryDef_i.h"
#include "FinderDef_i.h"
#include "ValueDef_i.h"
#include "ExceptionDef_i.h"
#include "AttributeDef_i.h"
#include "IFR_Service_Utils_T.h"
ACE_RCSID (IFRService,
HomeDef_i,
"HomeDef_i.cpp,v 1.11 2003/08/05 19:04:35 parsons Exp")
TAO_HomeDef_i::TAO_HomeDef_i (TAO_Repository_i *repo)
: TAO_IRObject_i (repo),
TAO_Container_i (repo),
TAO_Contained_i (repo),
TAO_IDLType_i (repo),
TAO_InterfaceDef_i (repo),
TAO_InterfaceAttrExtension_i (repo),
TAO_ExtInterfaceDef_i (repo)
{
}
TAO_HomeDef_i::~TAO_HomeDef_i (void)
{
}
CORBA::DefinitionKind
TAO_HomeDef_i::def_kind (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
return CORBA::dk_Home;
}
void
TAO_HomeDef_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD;
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->destroy_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
void
TAO_HomeDef_i::destroy_i (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
// Destroy our special subsections first, then call destroy_i
// on our base class.
TAO_IFR_Generic_Utils<TAO_FactoryDef_i>::destroy_special (
"factories",
this->repo_,
this->section_key_
ACE_ENV_ARG_PARAMETER
);
ACE_CHECK;
TAO_IFR_Generic_Utils<TAO_FinderDef_i>::destroy_special (
"finders",
this->repo_,
this->section_key_
ACE_ENV_ARG_PARAMETER
);
ACE_CHECK;
this->TAO_ExtInterfaceDef_i::destroy_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::Contained::Description *
TAO_HomeDef_i::describe (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_READ_GUARD_RETURN (0);
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
return this->describe_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::Contained::Description *
TAO_HomeDef_i::describe_i (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::ComponentIR::HomeDescription home_desc;
TAO_IFR_Desc_Utils<CORBA::ComponentIR::HomeDescription,
TAO_HomeDef_i>::fill_desc_begin (home_desc,
this->repo_,
this->section_key_
ACE_ENV_ARG_PARAMETER);
ACE_TString holder;
int status =
this->repo_->config ()->get_string_value (this->section_key_,
"base_home",
holder);
ACE_Configuration_Section_Key tmp_key;
if (status == 0)
{
this->repo_->config ()->expand_path (this->repo_->root_key (),
holder,
tmp_key,
0);
this->repo_->config ()->get_string_value (tmp_key,
"id",
holder);
home_desc.base_home = holder.fast_rep ();
}
// No need to check the status - this one is required.
this->repo_->config ()->get_string_value (this->section_key_,
"managed",
holder);
home_desc.managed_component = holder.fast_rep ();
status =
this->repo_->config ()->get_string_value (this->section_key_,
"primary_key",
holder);
if (status == 0)
{
this->repo_->config ()->expand_path (this->repo_->root_key (),
holder,
tmp_key,
0);
TAO_ValueDef_i impl (this->repo_);
impl.section_key (tmp_key);
impl.fill_value_description (home_desc.primary_key
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
}
this->fill_op_desc_seq (this->section_key_,
home_desc.factories,
"factories"
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
this->fill_op_desc_seq (this->section_key_,
home_desc.finders,
"finders"
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
this->fill_op_desc_seq (this->section_key_,
home_desc.operations,
"ops"
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
home_desc.type = this->type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
CORBA::Contained::Description *retval = 0;
ACE_NEW_RETURN (retval,
CORBA::Contained::Description,
0);
retval->kind = CORBA::dk_Home;
retval->value <<= home_desc;
return retval;
}
CORBA::TypeCode_ptr
TAO_HomeDef_i::type (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_READ_GUARD_RETURN (CORBA::TypeCode::_nil ());
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::TypeCode::_nil ());
return this->type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::TypeCode_ptr
TAO_HomeDef_i::type_i (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_TString id;
this->repo_->config ()->get_string_value (this->section_key_,
"id",
id);
ACE_TString name;
this->repo_->config ()->get_string_value (this->section_key_,
"name",
name);
return this->repo_->tc_factory ()->create_home_tc (id.fast_rep (),
name.fast_rep ()
ACE_ENV_ARG_PARAMETER);
}
CORBA::ComponentIR::HomeDef_ptr
TAO_HomeDef_i::base_home (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_READ_GUARD_RETURN (CORBA::ComponentIR::HomeDef::_nil ());
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::HomeDef::_nil ());
return this->base_home_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::ComponentIR::HomeDef_ptr
TAO_HomeDef_i::base_home_i (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_TString path;
int status =
this->repo_->config ()->get_string_value (this->section_key_,
"base_home",
path);
if (status != 0)
{
return CORBA::ComponentIR::HomeDef::_nil ();
}
CORBA::Object_var obj =
TAO_IFR_Service_Utils::path_to_ir_object (path,
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::HomeDef::_nil ());
return CORBA::ComponentIR::HomeDef::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
}
void
TAO_HomeDef_i::base_home (
CORBA::ComponentIR::HomeDef_ptr base_home
ACE_ENV_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD;
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->base_home_i (base_home
ACE_ENV_ARG_PARAMETER);
}
void
TAO_HomeDef_i::base_home_i (
CORBA::ComponentIR::HomeDef_ptr base_home
ACE_ENV_ARG_DECL_NOT_USED
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
char *path = TAO_IFR_Service_Utils::reference_to_path (base_home);
this->repo_->config ()->set_string_value (this->section_key_,
"base_home",
path);
}
CORBA::InterfaceDefSeq *
TAO_HomeDef_i::supported_interfaces (
ACE_ENV_SINGLE_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_READ_GUARD_RETURN (0);
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
return this->supported_interfaces_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::InterfaceDefSeq *
TAO_HomeDef_i::supported_interfaces_i (
ACE_ENV_SINGLE_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::InterfaceDefSeq *retval = 0;
ACE_NEW_RETURN (retval,
CORBA::InterfaceDefSeq,
0);
CORBA::InterfaceDefSeq_var safe_retval = retval;
retval->length (0);
ACE_Configuration_Section_Key supported_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"supported",
0,
supported_key);
if (status != 0)
{
return retval;
}
CORBA::ULong count = 0;
this->repo_->config ()->get_integer_value (supported_key,
"count",
count);
retval->length (count);
char *stringified = 0;
ACE_TString holder;
CORBA::Object_var obj;
for (CORBA::ULong i = 0; i < count; ++i)
{
stringified = TAO_IFR_Service_Utils::int_to_string (i);
this->repo_->config ()->get_string_value (supported_key,
stringified,
holder);
obj = TAO_IFR_Service_Utils::path_to_ir_object (holder,
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
safe_retval[i] = CORBA::InterfaceDef::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
}
return safe_retval._retn ();
}
void
TAO_HomeDef_i::supported_interfaces (
const CORBA::InterfaceDefSeq &supported_interfaces
ACE_ENV_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD;
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->supported_interfaces_i (supported_interfaces
ACE_ENV_ARG_PARAMETER);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -