本文整理汇总了C++中corba::ORB_var::create_struct_tc方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_var::create_struct_tc方法的具体用法?C++ ORB_var::create_struct_tc怎么用?C++ ORB_var::create_struct_tc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::ORB_var
的用法示例。
在下文中一共展示了ORB_var::create_struct_tc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
CORBA::TypeCode_var iface_tc =
orb->create_interface_tc (CORBA::string_dup ("IDL:iface:1.0"),
CORBA::string_dup ("iface"));
CORBA::ULong length = 5;
CORBA::UnionMemberSeq foo_members (length);
foo_members.length (length);
// The first three members are multiple case labels for a
// single string member. The label values are not in order
// or consecutive.
foo_members[0].name = CORBA::string_dup ("foo_str_member");
// The type member of the UnionMember takes ownership.
foo_members[0].type = CORBA::TypeCode::_duplicate (CORBA::_tc_string);
// Not needed for ORB-created typecodes
// (see CORBA 2.4.2 section 10.7.3).
foo_members[0].type_def = CORBA::IDLType::_nil ();
CORBA::Short label_value = 3;
foo_members[0].label <<= label_value;
foo_members[1].name = CORBA::string_dup ("foo_str_member");
foo_members[1].type = CORBA::TypeCode::_duplicate (CORBA::_tc_string);
foo_members[1].type_def = CORBA::IDLType::_nil ();
label_value = 4;
foo_members[1].label <<= label_value;
foo_members[2].name = CORBA::string_dup ("foo_str_member");
foo_members[2].type = CORBA::TypeCode::_duplicate (CORBA::_tc_string);
foo_members[2].type_def = CORBA::IDLType::_nil ();
label_value = 1;
foo_members[2].label <<= label_value;
// The default member.
foo_members[3].name = CORBA::string_dup ("foo_iface_member");
foo_members[3].type = CORBA::TypeCode::_duplicate (iface_tc.in ());
foo_members[3].type_def = CORBA::IDLType::_nil ();
CORBA::Octet default_label_value = 0;
foo_members[3].label <<= CORBA::Any::from_octet (default_label_value);
// The last member is the same type as the previous one, but has
// a different name.
foo_members[4].name = CORBA::string_dup ("foo_iface_member2");
foo_members[4].type = CORBA::TypeCode::_duplicate (iface_tc.in ());
foo_members[4].type_def = CORBA::IDLType::_nil ();
label_value = 0;
foo_members[4].label <<= label_value;
CORBA::TypeCode_ptr foo_tc = orb->create_union_tc ("IDL:foo:1.0",
"foo",
CORBA::_tc_short,
foo_members);
length = 2;
CORBA::StructMemberSeq bar_members (length);
bar_members.length (length);
bar_members[0].name = CORBA::string_dup ("bar_long_member");
bar_members[0].type = CORBA::TypeCode::_duplicate (CORBA::_tc_long);
bar_members[0].type_def = CORBA::IDLType::_nil ();
bar_members[1].name = CORBA::string_dup ("bar_foo_member");
bar_members[1].type = foo_tc;
bar_members[1].type_def = CORBA::IDLType::_nil ();
CORBA::TypeCode_var bar_tc = orb->create_struct_tc ("IDL:bar:1.0",
"bar",
bar_members);
// Check for equality with the typecode created by the IDL compiler.
CORBA::Boolean eq = bar_tc->equal (_tc_bar);
if (!eq)
{
ACE_ERROR_RETURN ((LM_ERROR,
"ORB-created typecode not correct!\n"),
-1);
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("exception:");
return 1;
}
return 0;
//.........这里部分代码省略.........