Skip to content

Commit 23457bc

Browse files
Update ConnextDDS examples and tutorials to use IDL4 C++ Mapping instead of the legacy
1 parent 472b763 commit 23457bc

File tree

76 files changed

+254
-254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+254
-254
lines changed

examples/connext_dds/asynchronous_publication/c++11/async_publisher.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void run_publisher_application(
7777
std::cout << "Writing async, count " << samples_written << std::endl;
7878

7979
// Send count as data
80-
instance.x(samples_written);
80+
instance.x = samples_written;
8181

8282
// Send it, if using instance_handle:
8383
// writer.write(instance, instance_handle);

examples/connext_dds/asynchronous_publication/c++11/async_subscriber.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int process_data(dds::sub::DataReader<async> reader)
3333
double elapsed_ticks = clock() - InitTime;
3434
double elapsed_secs = elapsed_ticks / CLOCKS_PER_SEC;
3535
std::cout << "@ t=" << elapsed_secs << "s"
36-
<< ", got x = " << sample.data().x() << std::endl;
36+
<< ", got x = " << sample.data().x << std::endl;
3737
} else {
3838
std::cout << "Instance state changed to "
3939
<< sample.info().state().instance_state() << std::endl;

examples/connext_dds/asyncwaitset/c++11/AwsExample_publisher.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ AwsPublisher::AwsPublisher(
9292
dds::pub::Publisher(participant),
9393
topic);
9494
// set sample key value:
95-
sample_.key(publisher_id);
95+
sample_.key = publisher_id;
9696

9797

9898
// Send condition: to generate application-driven events to send samples
@@ -107,8 +107,8 @@ void AwsPublisher::generate_send_event()
107107

108108
void AwsPublisher::send_sample()
109109
{
110-
std::cout << "Send Sample: " << sample_.number() << std::endl;
111-
sample_.number(sample_.number() + 1);
110+
std::cout << "Send Sample: " << sample_.number << std::endl;
111+
sample_.number = sample_.number + 1;
112112
sender_.write(sample_);
113113
}
114114

examples/connext_dds/batching/c++11/batch_data_publisher.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void run_publisher_application(
7070
!application::shutdown_requested && samples_written < sample_count;
7171
samples_written++) {
7272
// Modify the data to be written here
73-
sample.x(samples_written);
73+
sample.x = samples_written;
7474

7575
std::cout << "Writing batch_data, count " << samples_written
7676
<< std::endl;

examples/connext_dds/builtin_qos_profiles/c++11/profiles_publisher.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void run_publisher_application(int domain_id, int sample_count)
6060
!application::shutdown_requested && samples_written < sample_count;
6161
samples_written++) {
6262
// Modify the data to be written here
63-
instance.msg("Hello World!");
63+
instance.msg = "Hello World!";
6464

6565
std::cout << "Writing HelloWord, count " << samples_written
6666
<< std::endl;

examples/connext_dds/builtin_topics/c++11/msg_publisher.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void run_publisher_application(
219219
std::cout << "Writing msg, count " << samples_written << std::endl;
220220

221221
// Send count as data
222-
instance.x(samples_written);
222+
instance.x = samples_written;
223223

224224
// Send it, if using instance_handle:
225225
// writer.write(instance, instance_handle);

examples/connext_dds/coherent_presentation/c++11/coherent_publisher.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void run_publisher_application(
5353
dds::pub::DataWriter<coherent> writer(publisher, topic, writer_qos);
5454

5555
coherent sample;
56-
sample.id(0);
56+
sample.id = 0;
5757
dds::core::InstanceHandle handle = writer.register_instance(sample);
5858

5959
int num_samples = 7;
@@ -65,10 +65,10 @@ void run_publisher_application(
6565
for (int i = 0; i < num_samples; i++, count++) {
6666
rti::util::sleep(dds::core::Duration(1));
6767

68-
sample.field('a' + i);
69-
sample.value((int) (rand() / (RAND_MAX / 10.0)));
70-
std::cout << "\tUpdating instance, " << sample.field() << "->"
71-
<< sample.value() << std::endl;
68+
sample.field = 'a' + i;
69+
sample.value = (int) (rand() / (RAND_MAX / 10.0));
70+
std::cout << "\tUpdating instance, " << sample.field << "->"
71+
<< sample.value << std::endl;
7272
writer.write(sample, handle);
7373
}
7474

examples/connext_dds/coherent_presentation/c++11/coherent_subscriber.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int process_data(dds::sub::DataReader<coherent> reader)
2929
rti::sub::valid_samples(samples.end()),
3030
std::inserter(values, values.begin()),
3131
[](const coherent &data) {
32-
return std::make_pair(data.field(), data.value());
32+
return std::make_pair(data.field, data.value);
3333
});
3434
std::cout << std::endl;
3535

examples/connext_dds/compression/c++11/compression_publisher.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ void run_publisher_application(
9898
std::string new_line;
9999
while (!std::getline(fileToCompress, new_line).eof()) {
100100
StringLine new_sample;
101-
new_sample.str(new_line);
101+
new_sample.str = new_line;
102102
samples.push_back(new_sample);
103103
}
104104
} else {
105105
// Create a sample fill with 1024 zeros to send if no file has been
106106
// provided
107107
StringLine new_sample;
108-
new_sample.str(std::string(1024, '0'));
108+
new_sample.str = std::string(1024, '0');
109109
samples.push_back(new_sample);
110110
}
111111

examples/connext_dds/content_filtered_topic/c++11/cft_publisher.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ void run_publisher_application(
6161
// reset the x counter to 0 every time we send 10 samples (x=0,1,..,9).
6262
// Using the value of count, we can get set x to the appropriate value
6363
// applying % 10 operation to it.
64-
instance.count(samples_written);
65-
instance.x(samples_written % 10);
64+
instance.count = samples_written;
65+
instance.x = samples_written % 10;
6666

67-
std::cout << "Writing cft, count " << instance.count() << "\t"
68-
<< "x=" << instance.x() << std::endl;
67+
std::cout << "Writing cft, count " << instance.count << "\t"
68+
<< "x=" << instance.x << std::endl;
6969

7070
writer.write(instance, instance_handle);
7171

0 commit comments

Comments
 (0)