📄 extvaluedef_i.cpp
字号:
/* -*- C++ -*- */
// ExtValueDef_i.cpp,v 1.9 2003/08/05 19:04:35 parsons Exp
#include "Repository_i.h"
#include "ExtValueDef_i.h"
#include "ExceptionDef_i.h"
#include "IFR_Service_Utils.h"
#include "IFR_Service_Utils_T.h"
ACE_RCSID (IFRService,
ExtValueDef_i,
"ExtValueDef_i.cpp,v 1.9 2003/08/05 19:04:35 parsons Exp")
TAO_ExtValueDef_i::TAO_ExtValueDef_i (TAO_Repository_i *repo)
: TAO_IRObject_i (repo),
TAO_Container_i (repo),
TAO_Contained_i (repo),
TAO_IDLType_i (repo),
TAO_ValueDef_i (repo)
{
}
TAO_ExtValueDef_i::~TAO_ExtValueDef_i (void)
{
}
CORBA::ExtInitializerSeq *
TAO_ExtValueDef_i::ext_initializers (
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->ext_initializers_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::ExtInitializerSeq *
TAO_ExtValueDef_i::ext_initializers_i (
ACE_ENV_SINGLE_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::ExtInitializerSeq *iseq = 0;
ACE_NEW_RETURN (iseq,
CORBA::ExtInitializerSeq,
0);
CORBA::ExtInitializerSeq_var retval = iseq;
ACE_Configuration_Section_Key initializers_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"initializers",
0,
initializers_key);
if (status != 0)
{
iseq->length (0);
return retval._retn ();
}
CORBA::ULong count = 0;
this->repo_->config ()->get_integer_value (initializers_key,
"count",
count);
iseq->length (count);
char *stringified = 0;
ACE_Configuration_Section_Key initializer_key, params_key, arg_key;
ACE_TString holder;
CORBA::ULong arg_count = 0;
for (CORBA::ULong i = 0; i < count; ++i)
{
stringified = TAO_IFR_Service_Utils::int_to_string (i);
this->repo_->config ()->open_section (initializers_key,
stringified,
0,
initializer_key);
this->repo_->config ()->get_string_value (initializer_key,
"name",
holder);
retval[i].name = holder.fast_rep ();
status =
this->repo_->config ()->open_section (initializer_key,
"params",
0,
params_key);
if (status != 0)
{
retval[i].members.length (0);
continue;
}
this->repo_->config ()->get_integer_value (params_key,
"count",
arg_count);
retval[i].members.length (arg_count);
CORBA::Object_var obj;
for (CORBA::ULong j = 0; j < arg_count; ++j)
{
stringified = TAO_IFR_Service_Utils::int_to_string (j);
this->repo_->config ()->open_section (params_key,
stringified,
0,
arg_key);
this->repo_->config ()->get_string_value (arg_key,
"arg_name",
holder);
retval[i].members[j].name = holder.fast_rep ();
this->repo_->config ()->get_string_value (arg_key,
"arg_path",
holder);
TAO_IDLType_i *impl =
TAO_IFR_Service_Utils::path_to_idltype (holder,
this->repo_);
retval[i].members[j].type =
impl->type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
obj =
TAO_IFR_Service_Utils::path_to_ir_object (holder,
this->repo_
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
retval[i].members[j].type_def =
CORBA::IDLType::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
}
this->fill_exceptions (retval[i].exceptions,
initializer_key,
"excepts"
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
}
return retval._retn ();
}
void
TAO_ExtValueDef_i::ext_initializers (
const CORBA::ExtInitializerSeq &ext_initializers
ACE_ENV_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
TAO_IFR_WRITE_GUARD;
this->update_key (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
this->ext_initializers_i (ext_initializers
ACE_ENV_ARG_PARAMETER);
}
void
TAO_ExtValueDef_i::ext_initializers_i (
const CORBA::ExtInitializerSeq &ext_initializers
ACE_ENV_ARG_DECL_NOT_USED
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_Configuration *config = this->repo_->config ();
config->remove_section (this->section_key_,
"initializers",
1);
/// This does not handle the initializer exceptions, so we do that below.
TAO_IFR_Generic_Utils<CORBA::ExtInitializerSeq>::set_initializers (
ext_initializers,
this->repo_->config (),
this->section_key_
);
CORBA::ULong length = ext_initializers.length ();
if (length > 0)
{
ACE_Configuration_Section_Key initializers_key, initializer_key;
char *stringified = 0;
this->repo_->config ()->open_section (this->section_key_,
"initializers",
0,
initializers_key);
for (CORBA::ULong i = 0; i < length; ++i)
{
stringified = TAO_IFR_Service_Utils::int_to_string (i);
this->repo_->config ()->open_section (initializers_key,
stringified,
0,
initializer_key);
this->exceptions (initializer_key,
"excepts",
ext_initializers[i].exceptions);
}
}
}
CORBA::ExtValueDef::ExtFullValueDescription *
TAO_ExtValueDef_i::describe_ext_value (
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_ext_value_i (ACE_ENV_SINGLE_ARG_PARAMETER);
}
CORBA::ExtValueDef::ExtFullValueDescription *
TAO_ExtValueDef_i::describe_ext_value_i (
ACE_ENV_SINGLE_ARG_DECL
)
ACE_THROW_SPEC ((CORBA::SystemException))
{
CORBA::ExtValueDef::ExtFullValueDescription *fv_desc = 0;
ACE_NEW_RETURN (fv_desc,
CORBA::ExtValueDef::ExtFullValueDescription,
0);
CORBA::ExtValueDef::ExtFullValueDescription_var retval = fv_desc;
ACE_TString holder;
this->repo_->config ()->get_string_value (this->section_key_,
"name",
holder);
fv_desc->name = holder.fast_rep ();
this->repo_->config ()->get_string_value (this->section_key_,
"id",
holder);
fv_desc->id = holder.fast_rep ();
CORBA::ULong val = 0;
this->repo_->config ()->get_integer_value (this->section_key_,
"is_abstract",
val);
fv_desc->is_abstract = ACE_static_cast (CORBA::Boolean,
val);
this->repo_->config ()->get_integer_value (this->section_key_,
"is_custom",
val);
fv_desc->is_custom = ACE_static_cast (CORBA::Boolean,
val);
this->repo_->config ()->get_string_value (this->section_key_,
"container_id",
holder);
fv_desc->defined_in = holder.fast_rep ();
this->repo_->config ()->get_string_value (this->section_key_,
"version",
holder);
fv_desc->version = holder.fast_rep ();
// Operations.
fv_desc->operations.length (0);
ACE_Configuration_Section_Key ops_key;
int status =
this->repo_->config ()->open_section (this->section_key_,
"ops",
0,
ops_key);
CORBA::ULong count = 0;
CORBA::ULong param_count = 0;
char *stringified = 0;
CORBA::ULong i = 0;
CORBA::ULong j = 0;
TAO_IDLType_i *idl_type = 0;
CORBA::Object_var obj;
ACE_Configuration_Section_Key params_key, excepts_key, except_def_key;
if (status == 0)
{
this->repo_->config ()->get_integer_value (ops_key,
"count",
count);
fv_desc->operations.length (count);
ACE_Configuration_Section_Key op_key, result_key, contexts_key;
for (i = 0; i < count; ++i)
{
stringified = TAO_IFR_Service_Utils::int_to_string (i);
this->repo_->config ()->open_section (ops_key,
stringified,
0,
op_key);
this->repo_->config ()->get_string_value (op_key,
"name",
holder);
fv_desc->operations[i].name = holder.fast_rep ();
this->repo_->config ()->get_string_value (op_key,
"id",
holder);
fv_desc->operations[i].id = holder.fast_rep ();
this->repo_->config ()->get_string_value (this->section_key_,
"id",
holder);
fv_desc->operations[i].defined_in = holder.fast_rep ();
this->repo_->config ()->get_string_value (op_key,
"result",
holder);
idl_type =
TAO_IFR_Service_Utils::path_to_idltype (holder,
this->repo_);
fv_desc->operations[i].result =
idl_type->type_i (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (0);
this->repo_->config ()->get_integer_value (op_key,
"mode",
val);
fv_desc->operations[i].mode = ACE_static_cast (CORBA::OperationMode,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -