Working with data writers.
Working with data writers.
Setting up a data writer
- Set up publisher
- Set up a topic
- Create a data writer, FooDataWriter, of user data type
Foo:
MyWriterListener* writer_listener = new MyWriterListener();
retcode = publisher->get_default_datawriter_qos(writer_qos);
}
writer_qos,
writer_listener,
if (writer == NULL) {
};
DDS_ReturnCode_t
Type for return codes.
Definition: infrastructure.ifc:1336
@ DDS_RETCODE_OK
Successful return.
Definition: infrastructure.ifc:1339
#define DDS_STATUS_MASK_ALL
All bits are set.
Definition: infrastructure.ifc:1416
QoS policies supported by a DDSDataWriter entity.
Definition: publication.ifc:921
<<interface>> <<generic>> User data type specific data writer.
Definition: data.ifc:465
Managing instances
- Getting an instance "key" value of user data type
Foo
}
virtual DDS_ReturnCode_t get_key_value(Foo &key_holder, const DDS_InstanceHandle_t &handle)=0
Retrieve the instance key that corresponds to an instance handle.
A representative user-defined data type.
Definition: data.ifc:112
- Registering an instance of type
Foo
DDS_HANDLE_TYPE_NATIVE DDS_InstanceHandle_t
Type definition for an instance handle.
Definition: infrastructure.ifc:843
const DDS_InstanceHandle_t DDS_HANDLE_NIL
The NIL instance handle.
virtual DDS_InstanceHandle_t register_instance(const Foo &instance_data)=0
Informs RTI Connext that the application will be modifying a particular instance.
- Unregistering an instance of type
Foo
}
virtual DDS_ReturnCode_t unregister_instance(const Foo &instance_data, const DDS_InstanceHandle_t &handle)=0
Reverses the action of FooDataWriter::register_instance.
- Disposing of an instance of type
Foo
retcode = writer->
dispose(data, instance_handle);
}
virtual DDS_ReturnCode_t dispose(const Foo &instance_data, const DDS_InstanceHandle_t &instance_handle)=0
Requests the middleware to delete the instance.
Sending data
- Set up data writer
- Register instance
- Write instance of type
Foo
retcode = writer->
write(data, instance_handle);
}
virtual DDS_ReturnCode_t write(const Foo &instance_data, const DDS_InstanceHandle_t &handle)=0
Modifies the value of a data instance.
Tearing down a data writer
- Delete DDSDataWriter:
retcode = publisher->delete_datawriter(writer);
}