本文整理汇总了C#中DDS.create_union_tc方法的典型用法代码示例。如果您正苦于以下问题:C# DDS.create_union_tc方法的具体用法?C# DDS.create_union_tc怎么用?C# DDS.create_union_tc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDS
的用法示例。
在下文中一共展示了DDS.create_union_tc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: create_type_code
private static DDS.TypeCode create_type_code(DDS.TypeCodeFactory tcf)
{
DDS.UnionMemberSeq members = new DDS.UnionMemberSeq();
/* First, we create the typeCode for a union */
/* Default-member index refers to which member of the union
* will be the default one. In this example index = 1 refers
* to the the member 'aLong'. Take into account that index
* starts in 0 */
try {
DDS.TypeCode unionTC = tcf.create_union_tc("Foo",
DDS.ExtensibilityKind.MUTABLE_EXTENSIBILITY,
DDS.TypeCode.TC_LONG,
1, /* default-member index */
members); /* For now, it does not have any member */
/* Case 1 will be a short named aShort */
unionTC.add_member("aShort", DDS.DynamicData.MEMBER_ID_UNSPECIFIED,
DDS.TypeCode.TC_SHORT, DDS.TypeCode.NONKEY_MEMBER);
/* Case 2, the default, will be a long named aLong */
unionTC.add_member("aLong", 2, DDS.TypeCode.TC_LONG,
DDS.TypeCode.NONKEY_MEMBER);
/* Case 3 will be a double named aDouble */
unionTC.add_member("aDouble", 3, DDS.TypeCode.TC_DOUBLE,
DDS.TypeCode.NONKEY_MEMBER);
return unionTC;
} catch (Exception e) {
Console.WriteLine("register_type error {0}", e);
return null;
}
}