📄 contained_i.cpp
字号:
CORBA::Any_var value = impl.value_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
container_impl->create_constant_i (new_id.c_str (),
new_name,
new_version,
type_def.in (),
value.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
break;
}
case CORBA::dk_Attribute:
{
TAO_AttributeDef_i impl (this->repo_);
impl.section_key (this->section_key_);
CORBA::IDLType_var type_def =
impl.type_def_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
CORBA::AttributeMode mode =
impl.mode_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
if (container_dk == CORBA::dk_Interface)
{
TAO_InterfaceDef_i idef (this->repo_);
idef.section_key (container_key);
idef.create_attribute_i (new_id.c_str (),
new_name,
new_version,
type_def.in (),
mode
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
break;
}
else if (container_dk == CORBA::dk_Value)
{
TAO_ValueDef_i vdef (this->repo_);
vdef.section_key (container_key);
vdef.create_attribute_i (new_id.c_str (),
new_name,
new_version,
type_def.in (),
mode
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
break;
}
else
{
ACE_THROW (CORBA::BAD_PARAM (4, CORBA::COMPLETED_NO));
}
}
case CORBA::dk_Operation:
{
TAO_OperationDef_i impl (this->repo_);
impl.section_key (this->section_key_);
CORBA::IDLType_var result =
impl.result_def_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
CORBA::OperationMode mode =
impl.mode_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
CORBA::ParDescriptionSeq_var params =
impl.params_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
CORBA::ExceptionDefSeq_var exceptions =
impl.exceptions_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
CORBA::ContextIdSeq_var contexts =
impl.contexts_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
if (container_dk == CORBA::dk_Interface)
{
TAO_InterfaceDef_i idef (this->repo_);
idef.section_key (container_key);
idef.create_operation_i (new_id.c_str (),
new_name,
new_version,
result.in (),
mode,
params.in (),
exceptions.in (),
contexts.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
break;
}
else if (container_dk == CORBA::dk_Value)
{
TAO_ValueDef_i vdef (this->repo_);
impl.section_key (container_key);
vdef.create_operation_i (new_id.c_str (),
new_name,
new_version,
result.in (),
mode,
params.in (),
exceptions.in (),
contexts.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
break;
}
else
{
ACE_THROW (CORBA::BAD_PARAM (4, CORBA::COMPLETED_NO));
}
}
case CORBA::dk_Value:
case CORBA::dk_Home:
case CORBA::dk_Component:
case CORBA::dk_Factory:
case CORBA::dk_Finder:
case CORBA::dk_Provides:
case CORBA::dk_Uses:
case CORBA::dk_Emits:
case CORBA::dk_Publishes:
case CORBA::dk_Consumes:
case CORBA::dk_ValueMember:
case CORBA::dk_Event:
// TODO
default:
break;
}
}
ACE_CATCHANY
{
// If the move was not successful, we must restore this.
this->repo_->config ()->set_string_value (
this->repo_->repo_ids_key (),
id.in (),
my_path
);
ACE_RE_THROW;
}
ACE_ENDTRY;
ACE_CHECK;
if (cleanup)
{
// Remove the old database entry.
ACE_TString container_id;
ACE_Configuration_Section_Key parent_key;
this->repo_->config ()->get_string_value (old_section_key,
"container_id",
container_id);
if (container_id == "")
{
parent_key = this->repo_->root_key ();
}
else
{
ACE_TString parent_path;
this->repo_->config ()->get_string_value (
this->repo_->repo_ids_key (),
container_id.c_str (),
parent_path
);
this->repo_->config ()->expand_path (this->repo_->root_key (),
parent_path,
parent_key,
0);
}
ACE_Configuration_Section_Key defns_key;
this->repo_->config ()->open_section (parent_key,
"defns",
0,
defns_key);
ACE_TString last_seg = my_path.substr (my_path.rfind ('\\') + 1);
this->repo_->config ()->remove_section (defns_key,
last_seg.c_str (),
1);
}
}
void
TAO_Contained_i::move_pre_process (CORBA::Container_ptr container,
const char *contained_path,
const char *name
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
char *container_path =
TAO_IFR_Service_Utils::reference_to_path (container);
ACE_Configuration_Section_Key container_key;
this->repo_->config ()->expand_path (this->repo_->root_key (),
container_path,
container_key,
0);
ACE_Configuration_Section_Key refs_key;
this->repo_->config ()->open_section (container_key,
"refs",
0,
refs_key);
int index = 0;
ACE_TString section_name;
while (this->repo_->config ()->enumerate_sections (refs_key,
index++,
section_name)
== 0)
{
ACE_Configuration_Section_Key ref_key;
this->repo_->config ()->open_section (refs_key,
section_name.c_str (),
0,
ref_key);
ACE_TString ref_name;
this->repo_->config ()->get_string_value (ref_key,
"name",
ref_name);
ACE_TString path;
this->repo_->config ()->get_string_value (ref_key,
"path",
path);
if (ref_name == name && path == contained_path)
{
ref_name += this->repo_->extension ();
this->repo_->config ()->set_string_value (ref_key,
"name",
ref_name);
break;
}
}
}
void
TAO_Contained_i::move_contents (CORBA::Container_ptr new_container
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_TString name;
ACE_TString version;
ACE_Configuration_Section_Key defns_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"defns",
0,
defns_key);
if (status == 0)
{
u_int count = 0;
this->repo_->config ()->get_integer_value (defns_key,
"count",
count);
for (u_int i = 0; i < count; ++i)
{
ACE_Configuration_Section_Key defn_key;
char *stringified = TAO_IFR_Service_Utils::int_to_string (i);
status =
this->repo_->config ()->open_section (defns_key,
stringified,
0,
defn_key);
if (status == 0)
{
this->repo_->config ()->get_string_value (defn_key,
"name",
name);
this->repo_->config ()->get_string_value (defn_key,
"version",
version);
u_int kind = 0;
this->repo_->config ()->get_integer_value (defn_key,
"def_kind",
kind);
CORBA::DefinitionKind def_kind =
ACE_static_cast (CORBA::DefinitionKind, kind);
TAO_Contained_i *impl = this->repo_->select_contained (def_kind);
impl->section_key (defn_key);
impl->move_i (new_container,
name.c_str (),
version.c_str (),
0
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
}
}
CORBA::DefinitionKind kind = this->def_kind (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
// Specific to InterfaceDef_i and ValueDef_i
if (kind == CORBA::dk_Interface || kind == CORBA::dk_Value)
{
int index = 0;
ACE_TString section_name;
// Attributes
ACE_Configuration_Section_Key attrs_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"attrs",
0,
attrs_key);
if (status == 0)
{
while (this->repo_->config ()->enumerate_sections (attrs_key,
index++,
section_name)
== 0)
{
ACE_Configuration_Section_Key attr_key;
this->repo_->config ()->open_section (attrs_key,
section_name.c_str (),
0,
attr_key);
this->repo_->config ()->get_string_value (attr_key,
"name",
name);
this->repo_->config ()->get_string_value (attr_key,
"version",
version);
TAO_AttributeDef_i impl (this->repo_);
impl.section_key (attr_key);
impl.move_i (new_container,
name.c_str (),
version.c_str (),
0
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
}
index = 0;
// Operations
ACE_Configuration_Section_Key ops_key;
status =
this->repo_->config ()->open_section (this->section_key_,
"ops",
0,
ops_key);
if (status == 0)
{
while (this->repo_->config ()->enumerate_sections (ops_key,
index++,
section_name)
== 0)
{
ACE_Configuration_Section_Key op_key;
this->repo_->config ()->open_section (ops_key,
section_name.c_str (),
0,
op_key);
this->repo_->config ()->get_string_value (op_key,
"name",
name);
this->repo_->config ()->get_string_value (op_key,
"version",
version);
TAO_OperationDef_i impl (this->repo_);
impl.section_key (op_key);
impl.move_i (new_container,
name.c_str (),
version.c_str (),
0
ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -