Foo:
DDS_DataWriterQos writer_qos; DDS_ReturnCode_t retcode; // MyWriterListener is user defined and // extends DDSDataWriterListener MyWriterListener* writer_listener = new MyWriterListener(); // or = NULL retcode = publisher->get_default_datawriter_qos(writer_qos); if (retcode != DDS_RETCODE_OK) { // ... error } FooDataWriter* writer = publisher->create_datawriter(topic, writer_qos, writer_listener, DDS_STATUS_MASK_ALL); if (writer == NULL) { // ... error };
Foo
Foo* data = ...; // user data retcode = writer->get_key_value(*data, instance_handle); if (retcode != DDS_RETCODE_OK) { // ... check for cause of failure }
Foo
DDS_InstanceHandle_t instance_handle = DDS_HANDLE_NIL; instance_handle = writer->register_instance(data);
Foo
retcode = writer->unregister_instance(data, instance_handle); if (retcode != DDS_RETCODE_OK) { // ... check for cause of failure }
Foo
retcode = writer->dispose(data, instance_handle); if (retcode != DDS_RETCODE_OK) { // ... check for cause of failure }
Foo
Foo* data; // user data DDS_InstanceHandle_t instance_handle = DDS_HANDLE_NIL; // or a valid registered handle DDS_ReturnCode_t retcode; retcode = writer->write(data, instance_handle); if (retcode != DDS_RETCODE_OK) { // ... check for cause of failure }
DDS_ReturnCode_t retcode; retcode = publisher->delete_datawriter(writer); if (retcode != DDS_RETCODE_OK) { // ... check for cause of failure }