📄 container_i.cpp
字号:
index++,
section_name
)
== 0)
{
this->repo_->config ()->open_section (
ops_key,
section_name.c_str (),
0,
work_key
);
ACE_TString op_name;
this->repo_->config ()->get_string_value (
work_key,
"name",
op_name
);
// If we're here, name has only one segment.
if (op_name == work_string)
{
so_far_so_good = 1;
break;
}
}
if (so_far_so_good)
{
break;
}
}
}
}
}
}
return CORBA::Contained::_nil ();
}
ACE_TString id;
this->repo_->config ()->get_string_value (work_key,
"id",
id);
ACE_TString path;
this->repo_->config ()->get_string_value (this->repo_->repo_ids_key (),
id.c_str (),
path);
CORBA::Object_var obj =
TAO_IFR_Service_Utils::path_to_ir_object (path,
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::Contained::_nil ());
return CORBA::Contained::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
}
CORBA::ContainedSeq *
TAO_Container_i::contents (CORBA::DefinitionKind limit_type,
CORBA::Boolean exclude_inherited
ACE_ENV_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->contents_i (limit_type,
exclude_inherited
ACE_ENV_ARG_PARAMETER);
}
CORBA::ContainedSeq *
TAO_Container_i::contents_i (CORBA::DefinitionKind limit_type,
CORBA::Boolean exclude_inherited
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::ContainedSeq *contents = 0;
ACE_NEW_THROW_EX (contents,
CORBA::ContainedSeq,
CORBA::NO_MEMORY ());
ACE_CHECK_RETURN (0);
CORBA::ContainedSeq_var retval = contents;
retval->length (0);
if (limit_type == CORBA::dk_none)
{
return retval._retn ();
}
ACE_Unbounded_Queue<CORBA::DefinitionKind> kind_queue;
ACE_Unbounded_Queue<ACE_TString> path_queue;
// Definitions
ACE_Configuration_Section_Key defns_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"defns",
0,
defns_key);
// If there are no contents (other than possible attributes or
// operations), skip this part.
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)
{
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);
if (limit_type == CORBA::dk_all
|| limit_type == def_kind)
{
kind_queue.enqueue_tail (def_kind);
ACE_TString id;
this->repo_->config ()->get_string_value (defn_key,
"id",
id);
ACE_TString path;
this->repo_->config ()->get_string_value (
this->repo_->repo_ids_key (),
id.c_str (),
path
);
path_queue.enqueue_tail (path);
}
}
}
}
// Base interfaces
CORBA::DefinitionKind def_kind = this->def_kind (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
if (def_kind == CORBA::dk_Interface)
{
if (limit_type == CORBA::dk_Operation
|| limit_type == CORBA::dk_Attribute
|| limit_type == CORBA::dk_all)
{
TAO_InterfaceDef_i iface (this->repo_);
iface.section_key (this->section_key_);
iface.interface_contents (kind_queue,
path_queue,
limit_type,
exclude_inherited
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
}
}
CORBA::ULong size = ACE_static_cast (CORBA::ULong, kind_queue.size ());
retval->length (size);
for (CORBA::ULong j = 0; j < size; ++j)
{
CORBA::DefinitionKind next_kind;
kind_queue.dequeue_head (next_kind);
ACE_TString next_path;
path_queue.dequeue_head (next_path);
CORBA::Object_var obj =
TAO_IFR_Service_Utils::create_objref (next_kind,
next_path.c_str (),
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
CORBA::Contained_var next_cont =
CORBA::Contained::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
retval[j] = next_cont._retn ();
}
return retval._retn ();
}
CORBA::ContainedSeq *
TAO_Container_i::lookup_name (const char *search_name,
CORBA::Long levels_to_search,
CORBA::DefinitionKind limit_type,
CORBA::Boolean exclude_inherited
ACE_ENV_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->lookup_name_i (search_name,
levels_to_search,
limit_type,
exclude_inherited
ACE_ENV_ARG_PARAMETER);
}
CORBA::ContainedSeq *
TAO_Container_i::lookup_name_i (const char *search_name,
CORBA::Long levels_to_search,
CORBA::DefinitionKind limit_type,
CORBA::Boolean exclude_inherited
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_Unbounded_Queue<CORBA::DefinitionKind> kind_queue;
ACE_Unbounded_Queue<ACE_TString> path_queue;
this->lookup_name_recursive (kind_queue,
path_queue,
search_name,
levels_to_search,
limit_type,
exclude_inherited
ACE_ENV_ARG_PARAMETER);
CORBA::ULong size = ACE_static_cast (CORBA::ULong, kind_queue.size ());
CORBA::ContainedSeq *holder;
ACE_NEW_THROW_EX (holder,
CORBA::ContainedSeq (size),
CORBA::NO_MEMORY ());
ACE_CHECK_RETURN (0);
CORBA::ContainedSeq_var retval = holder;
retval->length (size);
for (CORBA::ULong i = 0; i < size; ++i)
{
CORBA::DefinitionKind next_kind;
kind_queue.dequeue_head (next_kind);
ACE_TString next_path;
path_queue.dequeue_head (next_path);
CORBA::Object_var obj =
TAO_IFR_Service_Utils::create_objref (next_kind,
next_path.c_str (),
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
CORBA::Contained_var next_cont =
CORBA::Contained::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
retval[i] = next_cont._retn ();
}
return retval._retn ();
}
CORBA::Container::DescriptionSeq *
TAO_Container_i::describe_contents (CORBA::DefinitionKind limit_type,
CORBA::Boolean exclude_inherited,
CORBA::Long max_returned_objs
ACE_ENV_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_contents_i (limit_type,
exclude_inherited,
max_returned_objs
ACE_ENV_ARG_PARAMETER);
}
CORBA::Container::DescriptionSeq *
TAO_Container_i::describe_contents_i (CORBA::DefinitionKind limit_type,
CORBA::Boolean exclude_inherited,
CORBA::Long max_returned_objs
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::ContainedSeq_var contents = this->contents_i (limit_type,
exclude_inherited
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
CORBA::ULong length = contents->length ();
CORBA::ULong ret_len = 0;
if (max_returned_objs == -1)
{
ret_len = length;
}
else
{
ret_len = length < ACE_static_cast (CORBA::ULong, max_returned_objs)
? length
: max_returned_objs;
}
CORBA::Container::DescriptionSeq *desc_seq;
ACE_NEW_THROW_EX (desc_seq,
CORBA::Container::DescriptionSeq (ret_len),
CORBA::NO_MEMORY ());
ACE_CHECK_RETURN (0);
desc_seq->length (ret_len);
CORBA::Container::DescriptionSeq_var retval = desc_seq;
CORBA::Contained::Description_var desc;
ACE_Configuration_Section_Key contained_key;
PortableServer::ObjectId_var oid;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -