本文整理汇总了C#中DDS.delete_tc方法的典型用法代码示例。如果您正苦于以下问题:C# DDS.delete_tc方法的具体用法?C# DDS.delete_tc怎么用?C# DDS.delete_tc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DDS
的用法示例。
在下文中一共展示了DDS.delete_tc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: read_data
private static void read_data(DDS.DynamicData sample,
DDS.TypeCodeFactory tcf )
{
/* Creating typecodes */
DDS.TypeCode sequence_tc = sequence_get_typecode(tcf);
if (sequence_tc == null) {
Console.WriteLine("Error to create sequence_get_typecode in " +
"reading_data");
return;
}
/* Creating DynamicData */
DDS.DynamicData seq_member = new DDS.DynamicData(sequence_tc,
DDS.DynamicData.DYNAMIC_DATA_PROPERTY_DEFAULT);
DDS.DynamicData seq_element = new DDS.DynamicData(null,
DDS.DynamicData.DYNAMIC_DATA_PROPERTY_DEFAULT);
DDS.DynamicDataInfo info = new DDS.DynamicDataInfo();
sample.get_complex_member(seq_member, sequence_member_name,
DDS.DynamicData.MEMBER_ID_UNSPECIFIED);
/* Now we get the total amount of elements contained in the array
* by accessing the dynamic data info
*/
Console.WriteLine("* Getting sequence member info....");
seq_member.get_info(info);
Console.WriteLine("* Sequence contains {0} elements",
info.member_count);
for (int i = 0; i < info.member_count; ++i) {
/*
* The same results can be obtained using
* bind_complex_member method. The main difference, is that
* in that case the members are not copied, just referenced
*/
#if (USE_BIND_API)
try {
seq_member.bind_complex_member(seq_element, null, i + 1);
} catch (DDS.Exception e) {
Console.WriteLine("register_type error {0}", e);
return;
}
#else
try {
seq_member.get_complex_member(seq_element, null, i + 1);
} catch (DDS.Exception e) {
Console.WriteLine("register_type error {0}", e);
return;
}
#endif
long value = seq_element.get_long("a_member",
DDS.DynamicData.MEMBER_ID_UNSPECIFIED);
Console.WriteLine("Reading sequence element #{0} : ",
i + 1);
seq_element.print(1);
#if (USE_BIND_API)
try {
seq_member.unbind_complex_member(seq_element);
} catch (DDS.Exception e) {
Console.WriteLine("register_type error {0}", e);
return;
}
#endif
}
/* Delete the created TC */
if (sequence_tc != null) {
tcf.delete_tc(sequence_tc);
}
return;
}
示例2: write_data
private static void write_data(DDS.DynamicData sample,
DDS.TypeCodeFactory tcf)
{
/* Creating typecodes */
DDS.TypeCode sequence_tc = sequence_get_typecode(tcf);
if (sequence_tc == null) {
Console.WriteLine("Error to create sequence_get_typecode in " +
"writing_data");
return;
}
DDS.TypeCode sequence_element_tc = sequence_element_get_typecode(tcf);
if (sequence_element_tc == null) {
Console.WriteLine("Error to create sequence_element_get_typecode " +
"in writing_data");
return;
}
try {
/* Creating DynamicData */
DDS.DynamicData seq_member = new DDS.DynamicData(sequence_tc,
DDS.DynamicData.DYNAMIC_DATA_PROPERTY_DEFAULT);
DDS.DynamicData seq_element =
new DDS.DynamicData(sequence_element_tc,
DDS.DynamicData.DYNAMIC_DATA_PROPERTY_DEFAULT);
for (int i = 0; i < MAX_SEQ_LEN; ++i) {
/* To access the elements of a sequence it is necessary
* to use their id. This parameter allows accessing to every
* element of the sequence using a 1-based index.
* There are two ways of doing this: bind API and get API.
* See the NestedStructExample for further details about the
* differences between these two APIs. */
#if (USE_BIND_API)
seq_member.bind_complex_member(seq_element, null, i + 1);
seq_element.set_int("a_member",
DDS.DynamicData.MEMBER_ID_UNSPECIFIED, i);
Console.WriteLine("Writing sequence elemente #{0} : ", i + 1);
seq_element.print(1);
seq_member.unbind_complex_member(seq_element);
#else
seq_element.set_int("a_member",
DDS.DynamicData.MEMBER_ID_UNSPECIFIED, i);
Console.WriteLine("Writing sequence element #{0}", i + 1);
seq_element.print(1);
seq_member.set_complex_member(null, i + 1, seq_element);
#endif
}
sample.set_complex_member(sequence_member_name,
DDS.DynamicData.MEMBER_ID_UNSPECIFIED, seq_member);
/* Delete the created TC */
if (sequence_element_tc != null) {
tcf.delete_tc(sequence_element_tc);
}
if (sequence_tc != null) {
tcf.delete_tc(sequence_tc);
}
return;
} catch (DDS.Exception e) {
Console.WriteLine("register_type error {0}", e);
return;
}
}