📄 homedef_i.cpp
字号:
}
void
TAO_HomeDef_i::supported_interfaces_i (
const CORBA::InterfaceDefSeq &supported_interfaces
ACE_ENV_ARG_DECL_NOT_USED
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
this->repo_->config ()->remove_section (this->section_key_,
"supported",
1);
CORBA::ULong length = supported_interfaces.length ();
if (length == 0)
{
return;
}
ACE_Configuration_Section_Key supported_key;
this->repo_->config ()->open_section (this->section_key_,
"supported",
1,
supported_key);
char *stringified = 0;
char *path = 0;
for (CORBA::ULong i = 0; i < length; ++i)
{
stringified = TAO_IFR_Service_Utils::int_to_string (i);
path =
TAO_IFR_Service_Utils::reference_to_path (
supported_interfaces[i].in ()
);
this->repo_->config ()->set_string_value (supported_key,
stringified,
path);
}
}
CORBA::ComponentIR::ComponentDef_ptr
TAO_HomeDef_i::managed_component (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_READ_GUARD_RETURN (CORBA::ComponentIR::ComponentDef::_nil ());
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::ComponentDef::_nil ());
return this->managed_component_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::ComponentIR::ComponentDef_ptr
TAO_HomeDef_i::managed_component_i (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_TString path;
this->repo_->config ()->get_string_value (this->section_key_,
"managed",
path);
CORBA::Object_var obj =
TAO_IFR_Service_Utils::path_to_ir_object (path,
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::ComponentDef::_nil ());
return CORBA::ComponentIR::ComponentDef::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
}
void
TAO_HomeDef_i::managed_component (
CORBA::ComponentIR::ComponentDef_ptr managed_component
ACE_ENV_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD;
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->managed_component_i (managed_component
ACE_ENV_ARG_PARAMETER);
}
void
TAO_HomeDef_i::managed_component_i (
CORBA::ComponentIR::ComponentDef_ptr managed_component
ACE_ENV_ARG_DECL_NOT_USED
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
char *path = TAO_IFR_Service_Utils::reference_to_path (managed_component);
this->repo_->config ()->set_string_value (this->section_key_,
"managed",
path);
}
CORBA::ValueDef_ptr
TAO_HomeDef_i::primary_key (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_READ_GUARD_RETURN (CORBA::ValueDef::_nil ());
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ValueDef::_nil ());
return this->primary_key_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::ValueDef_ptr
TAO_HomeDef_i::primary_key_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_,
"primary_key",
path);
if (status != 0)
{
return CORBA::ValueDef::_nil ();
}
CORBA::Object_var obj =
TAO_IFR_Service_Utils::path_to_ir_object (path,
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ValueDef::_nil ());
return CORBA::ValueDef::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
}
void
TAO_HomeDef_i::primary_key (
CORBA::ValueDef_ptr primary_key
ACE_ENV_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD;
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->primary_key_i (primary_key
ACE_ENV_ARG_PARAMETER);
}
void
TAO_HomeDef_i::primary_key_i (
CORBA::ValueDef_ptr primary_key
ACE_ENV_ARG_DECL_NOT_USED
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (CORBA::is_nil (primary_key))
{
this->repo_->config ()->remove_value (this->section_key_,
"primary_key");
return;
}
char *path = TAO_IFR_Service_Utils::reference_to_path (primary_key);
this->repo_->config ()->set_string_value (this->section_key_,
"primary_key",
path);
}
CORBA::ComponentIR::FactoryDef_ptr
TAO_HomeDef_i::create_factory (const char *id,
const char *name,
const char *version,
const CORBA::ParDescriptionSeq ¶ms,
const CORBA::ExceptionDefSeq &exceptions
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD_RETURN (CORBA::ComponentIR::FactoryDef::_nil ());
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::FactoryDef::_nil ());
return this->create_factory_i (id,
name,
version,
params,
exceptions
ACE_ENV_ARG_PARAMETER);
}
CORBA::ComponentIR::FactoryDef_ptr
TAO_HomeDef_i::create_factory_i (
const char *id,
const char *name,
const char *version,
const CORBA::ParDescriptionSeq ¶ms,
const CORBA::ExceptionDefSeq &exceptions
ACE_ENV_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::Object_var obj = this->create_common (CORBA::dk_Factory,
id,
name,
version,
"factories",
params,
exceptions
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::FactoryDef::_nil ());
return CORBA::ComponentIR::FactoryDef::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
}
CORBA::ComponentIR::FinderDef_ptr
TAO_HomeDef_i::create_finder (const char *id,
const char *name,
const char *version,
const CORBA::ParDescriptionSeq ¶ms,
const CORBA::ExceptionDefSeq &exceptions
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD_RETURN (CORBA::ComponentIR::FinderDef::_nil ());
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::FinderDef::_nil ());
return this->create_finder_i (id,
name,
version,
params,
exceptions
ACE_ENV_ARG_PARAMETER);
}
CORBA::ComponentIR::FinderDef_ptr
TAO_HomeDef_i::create_finder_i (
const char *id,
const char *name,
const char *version,
const CORBA::ParDescriptionSeq ¶ms,
const CORBA::ExceptionDefSeq &exceptions
ACE_ENV_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::Object_var obj = this->create_common (CORBA::dk_Finder,
id,
name,
version,
"finders",
params,
exceptions
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::ComponentIR::FinderDef::_nil ());
return CORBA::ComponentIR::FinderDef::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
}
CORBA::Object_ptr
TAO_HomeDef_i::create_common (CORBA::DefinitionKind created_kind,
const char *id,
const char *name,
const char *version,
const char *sub_section,
const CORBA::ParDescriptionSeq ¶ms,
const CORBA::ExceptionDefSeq &exceptions
ACE_ENV_ARG_DECL)
{
TAO_Container_i::tmp_name_holder_ = name;
ACE_Configuration_Section_Key new_key;
// Common to all IR objects created in CORBA::Container.
ACE_TString result_path =
TAO_IFR_Service_Utils::create_common (CORBA::dk_Home,
created_kind,
this->section_key_,
new_key,
this->repo_,
id,
name,
&TAO_Container_i::same_as_tmp_name,
version,
sub_section
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::Object::_nil ());
// Set the 'result' field with the path of our managed component.
ACE_TString managed_path;
this->repo_->config ()->get_string_value (this->section_key_,
"managed",
managed_path);
this->repo_->config ()->set_string_value (new_key,
"result",
managed_path);
// Always OP_NORMAL for factories.
this->repo_->config ()->set_integer_value (new_key,
"mode",
CORBA::OP_NORMAL);
CORBA::ULong i = 0;
// Store the operation's parameter info.
CORBA::ULong length = params.length ();
if (length > 0)
{
ACE_Configuration_Section_Key params_key;
this->repo_->config ()->open_section (new_key,
"params",
1,
params_key);
this->repo_->config ()->set_integer_value (params_key,
"count",
length);
char *type_path = 0;
char *stringified = 0;
ACE_Configuration_Section_Key param_key;
for (i = 0; i < length; ++i)
{
stringified = TAO_IFR_Service_Utils::int_to_string (i);
this->repo_->config ()->open_section (params_key,
stringified,
1,
param_key);
this->repo_->config ()->set_string_value (param_key,
"name",
params[i].name.in ());
type_path =
TAO_IFR_Service_Utils::reference_to_path (
params[i].type_def.in ()
);
this->repo_->config ()->set_string_value (param_key,
"type_path",
type_path);
if (params[i].mode != CORBA::PARAM_IN)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -