Skip to content

Commit 4c02e58

Browse files
Update ConnextDDS examples and tutorials to use IDL4 C++ Mapping (#742)
* Update ConnextDDS examples and tutorials to use IDL4 C++ Mapping instead of the legacy * Update Security and services * Apply feedback -- add troubleshooting to readme * Add missing fix * Apply feedback
1 parent 472b763 commit 4c02e58

File tree

141 files changed

+1267
-332
lines changed

Some content is hidden

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

141 files changed

+1267
-332
lines changed

examples/connext_dds/asynchronous_publication/c++11/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,20 @@ using CMake, please refer to the
135135
[hello_world](../../../connext_dds/build_systems/cmake/) example, which includes
136136
a comprehensive `CMakeLists.txt` script with all the steps and instructions
137137
described in detail.
138+
139+
140+
## Troubleshooting
141+
142+
### Compilation fails accessing struct field
143+
144+
If the code compilation fails with errors such as "reference to non-static member
145+
function must be called" for code such as `my_sample.my_field = value` or
146+
`value = my_sample.my_field` this means that the rtiddsgen version you are using
147+
doesn't have the IDL4 C++ mapping enabled by default.
148+
149+
To fix it, upgrade your Connext version to 7.6+ or check out the branch for the
150+
Connext version you're using, e.g.
151+
152+
```sh
153+
git checkout release/7.3.0
154+
```

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/asyncwaitset/c++11/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,20 @@ using CMake, please refer to the
184184
[hello_world](../../../connext_dds/build_systems/cmake/) example, which includes
185185
a comprehensive `CMakeLists.txt` script with all the steps and instructions
186186
described in detail.
187+
188+
189+
## Troubleshooting
190+
191+
### Compilation fails accessing struct field
192+
193+
If the code compilation fails with errors such as "reference to non-static member
194+
function must be called" for code such as `my_sample.my_field = value` or
195+
`value = my_sample.my_field` this means that the rtiddsgen version you are using
196+
doesn't have the IDL4 C++ mapping enabled by default.
197+
198+
To fix it, upgrade your Connext version to 7.6+ or check out the branch for the
199+
Connext version you're using, e.g.
200+
201+
```sh
202+
git checkout release/7.3.0
203+
```

examples/connext_dds/batching/c++11/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,20 @@ using CMake, please refer to the
139139
[hello_world](../../../connext_dds/build_systems/cmake/) example, which includes
140140
a comprehensive CMakeLists.txt script with all the steps and instructions
141141
described in detail.
142+
143+
144+
## Troubleshooting
145+
146+
### Compilation fails accessing struct field
147+
148+
If the code compilation fails with errors such as "reference to non-static member
149+
function must be called" for code such as `my_sample.my_field = value` or
150+
`value = my_sample.my_field` this means that the rtiddsgen version you are using
151+
doesn't have the IDL4 C++ mapping enabled by default.
152+
153+
To fix it, upgrade your Connext version to 7.6+ or check out the branch for the
154+
Connext version you're using, e.g.
155+
156+
```sh
157+
git checkout release/7.3.0
158+
```

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/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,20 @@ using CMake, please refer to the
135135
[hello_world](../../../connext_dds/build_systems/cmake/) example, which includes
136136
a comprehensive `CMakeLists.txt` script with all the steps and instructions
137137
described in detail.
138+
139+
140+
## Troubleshooting
141+
142+
### Compilation fails accessing struct field
143+
144+
If the code compilation fails with errors such as "reference to non-static member
145+
function must be called" for code such as `my_sample.my_field = value` or
146+
`value = my_sample.my_field` this means that the rtiddsgen version you are using
147+
doesn't have the IDL4 C++ mapping enabled by default.
148+
149+
To fix it, upgrade your Connext version to 7.6+ or check out the branch for the
150+
Connext version you're using, e.g.
151+
152+
```sh
153+
git checkout release/7.3.0
154+
```

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/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,20 @@ using CMake, please refer to the
171171
[hello_world](../../../connext_dds/build_systems/cmake/) example, which includes
172172
a comprehensive `CMakeLists.txt` script with all the steps and instructions
173173
described in detail.
174+
175+
176+
## Troubleshooting
177+
178+
### Compilation fails accessing struct field
179+
180+
If the code compilation fails with errors such as "reference to non-static member
181+
function must be called" for code such as `my_sample.my_field = value` or
182+
`value = my_sample.my_field` this means that the rtiddsgen version you are using
183+
doesn't have the IDL4 C++ mapping enabled by default.
184+
185+
To fix it, upgrade your Connext version to 7.6+ or check out the branch for the
186+
Connext version you're using, e.g.
187+
188+
```sh
189+
git checkout release/7.3.0
190+
```

0 commit comments

Comments
 (0)