Foo:
DataWriterQos writer_qos = new DataWriterQos(); DataWriterListener writer_listener = null; try { publisher.get_default_datawriter_qos(writer_qos); } catch (DDS.Exception) { Console.WriteLine( "***Error: failed to get default datawriter qos"); } DataWriter writer = publisher.create_datawriter(topic, writer_qos, writer_listener, StatusMask.STATUS_MASK_NONE); if (writer == null) { Console.WriteLine("***Error: failed to create writer"); }
Foo
Foo data = ...; // user data try { writer.get_key_value(data, ref instance_handle); } catch (DDS.Exception) { // ... check for cause of failure }
Foo
InstanceHandle_t instance_handle = InstanceHandle_t.HANDLE_NIL; instance_handle = writer.register_instance(data);
Foo
try { writer.unregister_instance(data, ref instance_handle); } catch (DDS.Exception) { // ... check for cause of failure }
Foo
try { writer.dispose(data, ref instance_handle); } catch (DDS.Exception) { // ... check for cause of failure }
Foo
try { publisher.delete_datawriter(ref writer); } catch (DDS.Exception) { Console.WriteLine("***Error: failed to delete writer"); }