diff --git a/examples/connext_dds/asynchronous_publication/c++11/README.md b/examples/connext_dds/asynchronous_publication/c++11/README.md index 50acb8248..2be4b76b7 100644 --- a/examples/connext_dds/asynchronous_publication/c++11/README.md +++ b/examples/connext_dds/asynchronous_publication/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/asynchronous_publication/c++11/async_publisher.cxx b/examples/connext_dds/asynchronous_publication/c++11/async_publisher.cxx index d74fc3ac8..6498b16e0 100644 --- a/examples/connext_dds/asynchronous_publication/c++11/async_publisher.cxx +++ b/examples/connext_dds/asynchronous_publication/c++11/async_publisher.cxx @@ -77,7 +77,7 @@ void run_publisher_application( std::cout << "Writing async, count " << samples_written << std::endl; // Send count as data - instance.x(samples_written); + instance.x = samples_written; // Send it, if using instance_handle: // writer.write(instance, instance_handle); diff --git a/examples/connext_dds/asynchronous_publication/c++11/async_subscriber.cxx b/examples/connext_dds/asynchronous_publication/c++11/async_subscriber.cxx index dd1e94143..bdaf148a9 100644 --- a/examples/connext_dds/asynchronous_publication/c++11/async_subscriber.cxx +++ b/examples/connext_dds/asynchronous_publication/c++11/async_subscriber.cxx @@ -33,7 +33,7 @@ int process_data(dds::sub::DataReader reader) double elapsed_ticks = clock() - InitTime; double elapsed_secs = elapsed_ticks / CLOCKS_PER_SEC; std::cout << "@ t=" << elapsed_secs << "s" - << ", got x = " << sample.data().x() << std::endl; + << ", got x = " << sample.data().x << std::endl; } else { std::cout << "Instance state changed to " << sample.info().state().instance_state() << std::endl; diff --git a/examples/connext_dds/asyncwaitset/c++11/AwsExample_publisher.cxx b/examples/connext_dds/asyncwaitset/c++11/AwsExample_publisher.cxx index 65347801d..72becfde4 100644 --- a/examples/connext_dds/asyncwaitset/c++11/AwsExample_publisher.cxx +++ b/examples/connext_dds/asyncwaitset/c++11/AwsExample_publisher.cxx @@ -92,7 +92,7 @@ AwsPublisher::AwsPublisher( dds::pub::Publisher(participant), topic); // set sample key value: - sample_.key(publisher_id); + sample_.key = publisher_id; // Send condition: to generate application-driven events to send samples @@ -107,8 +107,8 @@ void AwsPublisher::generate_send_event() void AwsPublisher::send_sample() { - std::cout << "Send Sample: " << sample_.number() << std::endl; - sample_.number(sample_.number() + 1); + std::cout << "Send Sample: " << sample_.number << std::endl; + sample_.number = sample_.number + 1; sender_.write(sample_); } diff --git a/examples/connext_dds/asyncwaitset/c++11/README.md b/examples/connext_dds/asyncwaitset/c++11/README.md index 3042cce26..ee869904c 100644 --- a/examples/connext_dds/asyncwaitset/c++11/README.md +++ b/examples/connext_dds/asyncwaitset/c++11/README.md @@ -184,3 +184,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/batching/c++11/README.md b/examples/connext_dds/batching/c++11/README.md index 574f0c635..f60725fe6 100644 --- a/examples/connext_dds/batching/c++11/README.md +++ b/examples/connext_dds/batching/c++11/README.md @@ -139,3 +139,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive CMakeLists.txt script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/batching/c++11/batch_data_publisher.cxx b/examples/connext_dds/batching/c++11/batch_data_publisher.cxx index 368de82c8..623dc7a1d 100644 --- a/examples/connext_dds/batching/c++11/batch_data_publisher.cxx +++ b/examples/connext_dds/batching/c++11/batch_data_publisher.cxx @@ -70,7 +70,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - sample.x(samples_written); + sample.x = samples_written; std::cout << "Writing batch_data, count " << samples_written << std::endl; diff --git a/examples/connext_dds/builtin_qos_profiles/c++11/README.md b/examples/connext_dds/builtin_qos_profiles/c++11/README.md index f59bec22b..7259ee41e 100644 --- a/examples/connext_dds/builtin_qos_profiles/c++11/README.md +++ b/examples/connext_dds/builtin_qos_profiles/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/builtin_qos_profiles/c++11/profiles_publisher.cxx b/examples/connext_dds/builtin_qos_profiles/c++11/profiles_publisher.cxx index ad535c925..24876cf29 100644 --- a/examples/connext_dds/builtin_qos_profiles/c++11/profiles_publisher.cxx +++ b/examples/connext_dds/builtin_qos_profiles/c++11/profiles_publisher.cxx @@ -60,7 +60,7 @@ void run_publisher_application(int domain_id, int sample_count) !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - instance.msg("Hello World!"); + instance.msg = "Hello World!"; std::cout << "Writing HelloWord, count " << samples_written << std::endl; diff --git a/examples/connext_dds/builtin_topics/c++11/README.md b/examples/connext_dds/builtin_topics/c++11/README.md index 228c96a7f..44e278304 100644 --- a/examples/connext_dds/builtin_topics/c++11/README.md +++ b/examples/connext_dds/builtin_topics/c++11/README.md @@ -171,3 +171,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/builtin_topics/c++11/msg_publisher.cxx b/examples/connext_dds/builtin_topics/c++11/msg_publisher.cxx index 283c26c77..ca4324f4d 100644 --- a/examples/connext_dds/builtin_topics/c++11/msg_publisher.cxx +++ b/examples/connext_dds/builtin_topics/c++11/msg_publisher.cxx @@ -219,7 +219,7 @@ void run_publisher_application( std::cout << "Writing msg, count " << samples_written << std::endl; // Send count as data - instance.x(samples_written); + instance.x = samples_written; // Send it, if using instance_handle: // writer.write(instance, instance_handle); diff --git a/examples/connext_dds/coherent_presentation/c++11/README.md b/examples/connext_dds/coherent_presentation/c++11/README.md index 2c8d38963..2471121fc 100644 --- a/examples/connext_dds/coherent_presentation/c++11/README.md +++ b/examples/connext_dds/coherent_presentation/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/coherent_presentation/c++11/coherent_publisher.cxx b/examples/connext_dds/coherent_presentation/c++11/coherent_publisher.cxx index 85ce14149..525ac88e3 100644 --- a/examples/connext_dds/coherent_presentation/c++11/coherent_publisher.cxx +++ b/examples/connext_dds/coherent_presentation/c++11/coherent_publisher.cxx @@ -53,7 +53,7 @@ void run_publisher_application( dds::pub::DataWriter writer(publisher, topic, writer_qos); coherent sample; - sample.id(0); + sample.id = 0; dds::core::InstanceHandle handle = writer.register_instance(sample); int num_samples = 7; @@ -65,10 +65,10 @@ void run_publisher_application( for (int i = 0; i < num_samples; i++, count++) { rti::util::sleep(dds::core::Duration(1)); - sample.field('a' + i); - sample.value((int) (rand() / (RAND_MAX / 10.0))); - std::cout << "\tUpdating instance, " << sample.field() << "->" - << sample.value() << std::endl; + sample.field = 'a' + i; + sample.value = (int) (rand() / (RAND_MAX / 10.0)); + std::cout << "\tUpdating instance, " << sample.field << "->" + << sample.value << std::endl; writer.write(sample, handle); } diff --git a/examples/connext_dds/coherent_presentation/c++11/coherent_subscriber.cxx b/examples/connext_dds/coherent_presentation/c++11/coherent_subscriber.cxx index e61f47837..5688de2e6 100644 --- a/examples/connext_dds/coherent_presentation/c++11/coherent_subscriber.cxx +++ b/examples/connext_dds/coherent_presentation/c++11/coherent_subscriber.cxx @@ -29,7 +29,7 @@ int process_data(dds::sub::DataReader reader) rti::sub::valid_samples(samples.end()), std::inserter(values, values.begin()), [](const coherent &data) { - return std::make_pair(data.field(), data.value()); + return std::make_pair(data.field, data.value); }); std::cout << std::endl; diff --git a/examples/connext_dds/compression/c++11/README.md b/examples/connext_dds/compression/c++11/README.md index 52a282ef8..d3175dcf3 100644 --- a/examples/connext_dds/compression/c++11/README.md +++ b/examples/connext_dds/compression/c++11/README.md @@ -143,3 +143,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/compression/c++11/compression_publisher.cxx b/examples/connext_dds/compression/c++11/compression_publisher.cxx index 1410d00e7..b4d92d108 100644 --- a/examples/connext_dds/compression/c++11/compression_publisher.cxx +++ b/examples/connext_dds/compression/c++11/compression_publisher.cxx @@ -98,14 +98,14 @@ void run_publisher_application( std::string new_line; while (!std::getline(fileToCompress, new_line).eof()) { StringLine new_sample; - new_sample.str(new_line); + new_sample.str = new_line; samples.push_back(new_sample); } } else { // Create a sample fill with 1024 zeros to send if no file has been // provided StringLine new_sample; - new_sample.str(std::string(1024, '0')); + new_sample.str = std::string(1024, '0'); samples.push_back(new_sample); } diff --git a/examples/connext_dds/content_filtered_topic/c++11/README.md b/examples/connext_dds/content_filtered_topic/c++11/README.md index c788ed7ea..f94f2a416 100644 --- a/examples/connext_dds/content_filtered_topic/c++11/README.md +++ b/examples/connext_dds/content_filtered_topic/c++11/README.md @@ -138,3 +138,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/content_filtered_topic/c++11/cft_publisher.cxx b/examples/connext_dds/content_filtered_topic/c++11/cft_publisher.cxx index 6f7f5b6a6..fe86fb89f 100644 --- a/examples/connext_dds/content_filtered_topic/c++11/cft_publisher.cxx +++ b/examples/connext_dds/content_filtered_topic/c++11/cft_publisher.cxx @@ -61,11 +61,11 @@ void run_publisher_application( // reset the x counter to 0 every time we send 10 samples (x=0,1,..,9). // Using the value of count, we can get set x to the appropriate value // applying % 10 operation to it. - instance.count(samples_written); - instance.x(samples_written % 10); + instance.count = samples_written; + instance.x = samples_written % 10; - std::cout << "Writing cft, count " << instance.count() << "\t" - << "x=" << instance.x() << std::endl; + std::cout << "Writing cft, count " << instance.count << "\t" + << "x=" << instance.x << std::endl; writer.write(instance, instance_handle); diff --git a/examples/connext_dds/content_filtered_topic_string_filter/c++11/README.md b/examples/connext_dds/content_filtered_topic_string_filter/c++11/README.md index c2c5f7fc0..35fe6cb24 100644 --- a/examples/connext_dds/content_filtered_topic_string_filter/c++11/README.md +++ b/examples/connext_dds/content_filtered_topic_string_filter/c++11/README.md @@ -138,3 +138,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/content_filtered_topic_string_filter/c++11/cft_publisher.cxx b/examples/connext_dds/content_filtered_topic_string_filter/c++11/cft_publisher.cxx index c17270ff3..469c16ab8 100644 --- a/examples/connext_dds/content_filtered_topic_string_filter/c++11/cft_publisher.cxx +++ b/examples/connext_dds/content_filtered_topic_string_filter/c++11/cft_publisher.cxx @@ -48,11 +48,11 @@ void run_publisher_application( std::cout << "Writing cft, count " << samples_written << std::endl; // Modify sample data - sample.count(samples_written); + sample.count = samples_written; if (samples_written % 2 == 1) { - sample.name("ODD"); + sample.name = "ODD"; } else { - sample.name("EVEN"); + sample.name = "EVEN"; } writer.write(sample); diff --git a/examples/connext_dds/custom_content_filter/c++11/README.md b/examples/connext_dds/custom_content_filter/c++11/README.md index 8bda45b6f..a1940e97b 100644 --- a/examples/connext_dds/custom_content_filter/c++11/README.md +++ b/examples/connext_dds/custom_content_filter/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/custom_content_filter/c++11/ccf_publisher.cxx b/examples/connext_dds/custom_content_filter/c++11/ccf_publisher.cxx index 21dcd4119..362e6677a 100644 --- a/examples/connext_dds/custom_content_filter/c++11/ccf_publisher.cxx +++ b/examples/connext_dds/custom_content_filter/c++11/ccf_publisher.cxx @@ -44,7 +44,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { std::cout << "Writing ccf, count " << samples_written << std::endl; - instance.x(samples_written); + instance.x = samples_written; writer.write(instance); rti::util::sleep(dds::core::Duration(1)); diff --git a/examples/connext_dds/custom_content_filter/c++11/filter.hpp b/examples/connext_dds/custom_content_filter/c++11/filter.hpp index 2fe2013a0..9de30953f 100644 --- a/examples/connext_dds/custom_content_filter/c++11/filter.hpp +++ b/examples/connext_dds/custom_content_filter/c++11/filter.hpp @@ -80,7 +80,7 @@ class CustomFilterType const Foo &sample, const rti::topic::FilterSampleInfo &meta_data) { - return compile_data.eval_func(sample.x(), compile_data.param); + return compile_data.eval_func(sample.x, compile_data.param); } virtual void finalize(CustomCompileData &compile_data) diff --git a/examples/connext_dds/custom_flow_controller/c++11/README.md b/examples/connext_dds/custom_flow_controller/c++11/README.md index eacae7182..76bb236eb 100644 --- a/examples/connext_dds/custom_flow_controller/c++11/README.md +++ b/examples/connext_dds/custom_flow_controller/c++11/README.md @@ -205,3 +205,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/custom_flow_controller/c++11/cfc_publisher.cxx b/examples/connext_dds/custom_flow_controller/c++11/cfc_publisher.cxx index 2689cf98e..1cfe2a41e 100644 --- a/examples/connext_dds/custom_flow_controller/c++11/cfc_publisher.cxx +++ b/examples/connext_dds/custom_flow_controller/c++11/cfc_publisher.cxx @@ -100,7 +100,7 @@ void run_publisher_application( // Create a sample to write with a long payload. cfc sample; - sample.str(std::string(999, 'A')); + sample.str = std::string(999, 'A'); for (unsigned int samples_written = 0; !application::shutdown_requested && samples_written < sample_count; @@ -109,9 +109,9 @@ void run_publisher_application( rti::util::sleep(dds::core::Duration(1)); for (int i = 0; i < 10; i++) { - sample.x(samples_written * 10 + i); + sample.x = samples_written * 10 + i; - std::cout << "Writing cfc, sample " << sample.x() << std::endl; + std::cout << "Writing cfc, sample " << sample.x << std::endl; writer.write(sample); } } diff --git a/examples/connext_dds/custom_flow_controller/c++11/cfc_subscriber.cxx b/examples/connext_dds/custom_flow_controller/c++11/cfc_subscriber.cxx index 67a902713..25cf24d9f 100644 --- a/examples/connext_dds/custom_flow_controller/c++11/cfc_subscriber.cxx +++ b/examples/connext_dds/custom_flow_controller/c++11/cfc_subscriber.cxx @@ -32,7 +32,7 @@ int process_data(dds::sub::DataReader reader) double elapsed_secs = elapsed_ticks / CLOCKS_PER_SEC; std::cout << "@ t=" << elapsed_secs - << "s, got x = " << sample.data().x() << std::endl; + << "s, got x = " << sample.data().x << std::endl; } } diff --git a/examples/connext_dds/deadline_contentfilter/c++11/README.md b/examples/connext_dds/deadline_contentfilter/c++11/README.md index cb9345162..d091d6594 100644 --- a/examples/connext_dds/deadline_contentfilter/c++11/README.md +++ b/examples/connext_dds/deadline_contentfilter/c++11/README.md @@ -239,3 +239,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_publisher.cxx b/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_publisher.cxx index 63f13b1d8..f5159be40 100644 --- a/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_publisher.cxx +++ b/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_publisher.cxx @@ -32,7 +32,7 @@ class DeadlineWriterListener // Print out which instance missed its deadline. std::cout << "Offered deadline missed on instance code = " - << affected_sample.code() << std::endl; + << affected_sample.code << std::endl; } }; @@ -85,18 +85,18 @@ void run_publisher_application( rti::util::sleep(dds::core::Duration(1)); // Update non-key fields. - sample0.x(samples_written); - sample0.y(samples_written); - sample1.x(samples_written); - sample1.y(samples_written); + sample0.x = samples_written; + sample0.y = samples_written; + sample1.x = samples_written; + sample1.y = samples_written; - std::cout << "Writing instance0, x = " << sample0.x() - << ", y = " << sample0.y() << std::endl; + std::cout << "Writing instance0, x = " << sample0.x + << ", y = " << sample0.y << std::endl; writer.write(sample0, handle0); if (samples_written < 15) { - std::cout << "Writing instance1, x = " << sample1.x() - << ", y = " << sample1.y() << std::endl; + std::cout << "Writing instance1, x = " << sample1.x + << ", y = " << sample1.y << std::endl; writer.write(sample1, handle1); } else if (samples_written == 15) { std::cout << "Stopping writes to instance1" << std::endl; diff --git a/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_subscriber.cxx b/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_subscriber.cxx index bdea2ae75..47b7039b2 100644 --- a/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_subscriber.cxx +++ b/examples/connext_dds/deadline_contentfilter/c++11/deadline_contentfilter_subscriber.cxx @@ -35,7 +35,7 @@ class deadline_contentfilterReaderListener const deadline_contentfilter &data = sample.data(); std::cout << "@ t=" << elapsed_secs << "s, Instance" - << data.code() << ": <" << data.x() << "," << data.y() + << data.code << ": <" << data.x << "," << data.y << ">" << std::endl; } } @@ -56,7 +56,7 @@ class deadline_contentfilterReaderListener // Print out which instance missed its deadline. std::cout << "Missed deadline @ t=" << elapsed_secs - << "s on instance code = " << affected_sample.code() + << "s on instance code = " << affected_sample.code << std::endl; } }; diff --git a/examples/connext_dds/detect_samples_dropped/c++11/DroppedSamplesExample_publisher.cxx b/examples/connext_dds/detect_samples_dropped/c++11/DroppedSamplesExample_publisher.cxx index 85c1f3d7b..0174f2176 100644 --- a/examples/connext_dds/detect_samples_dropped/c++11/DroppedSamplesExample_publisher.cxx +++ b/examples/connext_dds/detect_samples_dropped/c++11/DroppedSamplesExample_publisher.cxx @@ -72,7 +72,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.x(static_cast(samples_written)); + data.x = static_cast(samples_written); std::cout << "Writing DroppedSamplesExample, count " << samples_written << std::endl; diff --git a/examples/connext_dds/detect_samples_dropped/c++11/README.md b/examples/connext_dds/detect_samples_dropped/c++11/README.md index 56f430c36..6f7547abf 100644 --- a/examples/connext_dds/detect_samples_dropped/c++11/README.md +++ b/examples/connext_dds/detect_samples_dropped/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/discovery_snapshot/c++11/README.md b/examples/connext_dds/discovery_snapshot/c++11/README.md index f99b2efb7..38e6ff8d8 100644 --- a/examples/connext_dds/discovery_snapshot/c++11/README.md +++ b/examples/connext_dds/discovery_snapshot/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/discovery_snapshot/c++11/discovery_snapshot_publisher.cxx b/examples/connext_dds/discovery_snapshot/c++11/discovery_snapshot_publisher.cxx index cf70c1b39..60a37b749 100644 --- a/examples/connext_dds/discovery_snapshot/c++11/discovery_snapshot_publisher.cxx +++ b/examples/connext_dds/discovery_snapshot/c++11/discovery_snapshot_publisher.cxx @@ -55,7 +55,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.msg(static_cast(samples_written)); + data.msg = static_cast(samples_written); std::cout << "Writing DiscoverySnapshot, count " << samples_written << std::endl; diff --git a/examples/connext_dds/flat_data_api/c++11/CameraImage_publisher.cxx b/examples/connext_dds/flat_data_api/c++11/CameraImage_publisher.cxx index 9f9151e06..c06f032b9 100644 --- a/examples/connext_dds/flat_data_api/c++11/CameraImage_publisher.cxx +++ b/examples/connext_dds/flat_data_api/c++11/CameraImage_publisher.cxx @@ -78,9 +78,9 @@ void build_data_sample_fast(CameraImageBuilder &builder, int seed) auto pixel_array = rti::flat::plain_cast(pixels); for (int i = 0; i < PIXEL_COUNT; i++) { auto &pixel = pixel_array[i]; - pixel.red((seed + i) % 100); - pixel.green((seed + i + 1) % 100); - pixel.blue((seed + i + 2) % 100); + pixel.red = (seed + i) % 100; + pixel.green = (seed + i + 1) % 100; + pixel.blue = (seed + i + 2) % 100; } } diff --git a/examples/connext_dds/flat_data_api/c++11/CameraImage_subscriber.cxx b/examples/connext_dds/flat_data_api/c++11/CameraImage_subscriber.cxx index 1990f0765..6ee75fa8d 100644 --- a/examples/connext_dds/flat_data_api/c++11/CameraImage_subscriber.cxx +++ b/examples/connext_dds/flat_data_api/c++11/CameraImage_subscriber.cxx @@ -54,9 +54,9 @@ void print_average_pixel_fast(const CameraImage &sample) unsigned int red_sum = 0, green_sum = 0, blue_sum = 0; for (unsigned int i = 0; i < pixel_count; i++) { const auto &pixel = pixel_array[i]; - red_sum += pixel.red(); - green_sum += pixel.green(); - blue_sum += pixel.blue(); + red_sum += pixel.red; + green_sum += pixel.green; + blue_sum += pixel.blue; } std::cout << "Avg. pixel: (" << red_sum / pixel_count << ", " diff --git a/examples/connext_dds/flat_data_api/c++11/README.md b/examples/connext_dds/flat_data_api/c++11/README.md index 332b13555..87f401db1 100644 --- a/examples/connext_dds/flat_data_api/c++11/README.md +++ b/examples/connext_dds/flat_data_api/c++11/README.md @@ -156,3 +156,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/flat_data_latency/c++11/CameraImage_publisher.cxx b/examples/connext_dds/flat_data_latency/c++11/CameraImage_publisher.cxx index 22165aaf8..936ccc1a6 100644 --- a/examples/connext_dds/flat_data_latency/c++11/CameraImage_publisher.cxx +++ b/examples/connext_dds/flat_data_latency/c++11/CameraImage_publisher.cxx @@ -178,11 +178,11 @@ void publisher_zero_copy(const application::ApplicationArguments &options) if ((count == options.sample_count) || (send_ts - start_ts >= options.execution_time)) { // notify reader about last sample - ping_sample->timestamp(0); + ping_sample->timestamp = 0; writer.write(*ping_sample); break; } - ping_sample->timestamp(send_ts); + ping_sample->timestamp = send_ts; writer.write(*ping_sample); if (latency_interval_start_time == 0) { @@ -198,7 +198,7 @@ void publisher_zero_copy(const application::ApplicationArguments &options) if (pong_samples.length() > 0 && pong_samples[0].info().valid()) { count++; uint64_t recv_ts = participant->current_time().to_microsecs(); - uint64_t latency = recv_ts - pong_samples[0].data().timestamp(); + uint64_t latency = recv_ts - pong_samples[0].data().timestamp; total_latency += latency; if (recv_ts - latency_interval_start_time > 4000000) { print_latency(total_latency, count); @@ -358,13 +358,13 @@ void publisher_plain(const application::ApplicationArguments &options) uint64_t send_ts = participant->current_time().to_microsecs(); if ((count == options.sample_count) || (send_ts - start_ts >= options.execution_time)) { - ping_sample->timestamp(0); + ping_sample->timestamp = 0; writer.write(*ping_sample); break; } // Write the ping sample: - ping_sample->timestamp(send_ts); + ping_sample->timestamp = send_ts; writer.write(*ping_sample); if (latency_interval_start_time == 0) { latency_interval_start_time = send_ts; @@ -380,7 +380,7 @@ void publisher_plain(const application::ApplicationArguments &options) if (pong_samples.length() > 0 && pong_samples[0].info().valid()) { count++; uint64_t recv_ts = participant->current_time().to_microsecs(); - uint64_t latency = recv_ts - pong_samples[0].data().timestamp(); + uint64_t latency = recv_ts - pong_samples[0].data().timestamp; total_latency += latency; if (recv_ts - latency_interval_start_time > 4000000) { print_latency(total_latency, count); @@ -409,17 +409,17 @@ void publisher_copy_sample(unsigned int domain_id, unsigned int sample_count) int count = 0; uint64_t total_latency = 0; while (!application::shutdown_requested && count < sample_count) { - ping_sample->data()[45345] = count + sample_count + 100; - ping_sample->timestamp(participant->current_time().to_microsecs()); + ping_sample->data[45345] = count + sample_count + 100; + ping_sample->timestamp = participant->current_time().to_microsecs(); *copy = *ping_sample; - if (copy->data()[45345] == 3) { + if (copy->data[45345] == 3) { return; } count++; uint64_t latency = participant->current_time().to_microsecs() - - ping_sample->timestamp(); + - ping_sample->timestamp; total_latency += latency; if (count % 10 == 0) { std::cout << "Average end-to-end latency: " diff --git a/examples/connext_dds/flat_data_latency/c++11/CameraImage_subscriber.cxx b/examples/connext_dds/flat_data_latency/c++11/CameraImage_subscriber.cxx index 1ad0aefc5..28d7a167c 100644 --- a/examples/connext_dds/flat_data_latency/c++11/CameraImage_subscriber.cxx +++ b/examples/connext_dds/flat_data_latency/c++11/CameraImage_subscriber.cxx @@ -137,7 +137,7 @@ void subscriber_zero_copy(const application::ApplicationArguments &options) auto ping_samples = reader.take(); if (ping_samples.length() > 0 && ping_samples[0].info().valid()) { - if (ping_samples[0].data().timestamp() == 0) { + if (ping_samples[0].data().timestamp == 0) { // last sample received, break out of receive loop break; } @@ -147,7 +147,7 @@ void subscriber_zero_copy(const application::ApplicationArguments &options) // Write the pong sample: CameraImage *pong_sample = writer.extensions().get_loan(); - pong_sample->timestamp(ping_samples[0].data().timestamp()); + pong_sample->timestamp = ping_samples[0].data().timestamp; if (reader->is_data_consistent(ping_samples[0])) { writer.write(*pong_sample); } @@ -281,14 +281,14 @@ void subscriber_plain(const application::ApplicationArguments &options) // Write the pong sample if (ping_samples.length() && ping_samples[0].info().valid()) { - if (ping_samples[0].data().timestamp() == 0) { + if (ping_samples[0].data().timestamp == 0) { // last sample received, break out of receive loop break; } if (options.display_sample) { display_plain_sample(ping_samples[0].data()); } - pong_sample->timestamp(ping_samples[0].data().timestamp()); + pong_sample->timestamp = ping_samples[0].data().timestamp; writer.write(*pong_sample); count++; } diff --git a/examples/connext_dds/flat_data_latency/c++11/Common.hpp b/examples/connext_dds/flat_data_latency/c++11/Common.hpp index a1a3fb3d2..aa345a551 100644 --- a/examples/connext_dds/flat_data_latency/c++11/Common.hpp +++ b/examples/connext_dds/flat_data_latency/c++11/Common.hpp @@ -66,13 +66,13 @@ void populate_flat_sample(CameraImageType &sample, int count) template void populate_plain_sample(CameraImageType &sample, int count) { - sample.format(common::Format::RGB); - sample.resolution().height(4320); - sample.resolution().width(7680); + sample.format = common::Format::RGB; + sample.resolution.height = 4320; + sample.resolution.width = 7680; for (int i = 0; i < 4; i++) { uint8_t image_value = (48 + count) % 124; - sample.data()[i] = image_value; + sample.data[i] = image_value; } } @@ -94,11 +94,11 @@ void display_flat_sample(const CameraImageType &sample) template void display_plain_sample(const CameraImageType &sample) { - std::cout << "\nTimestamp " << sample.timestamp() << " " << sample.format(); + std::cout << "\nTimestamp " << sample.timestamp << " " << sample.format; std::cout << " Data (4 Bytes) "; for (int i = 0; i < 4; i++) { - std::cout << sample.data()[i]; + std::cout << sample.data[i]; } std::cout << std::endl; } diff --git a/examples/connext_dds/flat_data_latency/c++11/README.md b/examples/connext_dds/flat_data_latency/c++11/README.md index a507dbb2b..417a93ab8 100644 --- a/examples/connext_dds/flat_data_latency/c++11/README.md +++ b/examples/connext_dds/flat_data_latency/c++11/README.md @@ -234,3 +234,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/fragmented_data_statistics/c++11/README.md b/examples/connext_dds/fragmented_data_statistics/c++11/README.md index f664476e5..a349a8c44 100644 --- a/examples/connext_dds/fragmented_data_statistics/c++11/README.md +++ b/examples/connext_dds/fragmented_data_statistics/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/fragmented_data_statistics/c++11/fragment_publisher.cxx b/examples/connext_dds/fragmented_data_statistics/c++11/fragment_publisher.cxx index cdb24e675..a7d5d4e37 100644 --- a/examples/connext_dds/fragmented_data_statistics/c++11/fragment_publisher.cxx +++ b/examples/connext_dds/fragmented_data_statistics/c++11/fragment_publisher.cxx @@ -51,7 +51,7 @@ void run_publisher_application( fragment data; // Create the data to be written, ensuring it is larger than // message_size_max */ - data.data().resize(8000); + data.data.resize(8000); rti::core::status::DataWriterProtocolStatus status; @@ -59,7 +59,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.x(static_cast(samples_written)); + data.x = static_cast(samples_written); std::cout << "Writing fragment, count " << samples_written << std::endl; diff --git a/examples/connext_dds/group_coherent_presentation/c++11/GroupCoherentExample_publisher.cxx b/examples/connext_dds/group_coherent_presentation/c++11/GroupCoherentExample_publisher.cxx index f602bb16a..f054cc35e 100644 --- a/examples/connext_dds/group_coherent_presentation/c++11/GroupCoherentExample_publisher.cxx +++ b/examples/connext_dds/group_coherent_presentation/c++11/GroupCoherentExample_publisher.cxx @@ -93,27 +93,27 @@ void run_publisher_application( writer_qos); Alarm alarm_data; - alarm_data.patient_id(1); - alarm_data.alarm_code(AlarmCode::PATIENT_OK); + alarm_data.patient_id = 1; + alarm_data.alarm_code = AlarmCode::PATIENT_OK; HeartRate heart_rate_data; - heart_rate_data.patient_id(1); - heart_rate_data.beats_per_minute(65); + heart_rate_data.patient_id = 1; + heart_rate_data.beats_per_minute = 65; Temperature temperature_data; - temperature_data.patient_id(1); - temperature_data.temperature(98.6); + temperature_data.patient_id = 1; + temperature_data.temperature = 98.6; // Below we will write a coherent set any time the patient's vitals are // abnormal. Otherwise, we will publish the patient's vitals normally for (unsigned int samples_written = 0; !application::shutdown_requested && samples_written < set_count; samples_written++) { - heart_rate_data.beats_per_minute(get_patient_heart_rate()); - temperature_data.temperature(get_patient_temperature()); + heart_rate_data.beats_per_minute = get_patient_heart_rate(); + temperature_data.temperature = get_patient_temperature(); - if (heart_rate_data.beats_per_minute() >= 100 - || heart_rate_data.beats_per_minute() <= 40 - || temperature_data.temperature() >= 100.0 - || temperature_data.temperature() <= 95.0) { + if (heart_rate_data.beats_per_minute >= 100 + || heart_rate_data.beats_per_minute <= 40 + || temperature_data.temperature >= 100.0 + || temperature_data.temperature <= 95.0) { // Sound an alarm. In this case, we want all of the patients vitals // along with the alarm to be delivered as a single coherent set of // data so that we can correlate the alarm with the set of vitals @@ -124,7 +124,7 @@ void run_publisher_application( heart_rate_writer.write(heart_rate_data); temperature_writer.write(temperature_data); - alarm_data.alarm_code(AlarmCode::ABNORMAL_READING); + alarm_data.alarm_code = AlarmCode::ABNORMAL_READING; alarm_writer.write(alarm_data); } // end coherent set } else { diff --git a/examples/connext_dds/group_coherent_presentation/c++11/README.md b/examples/connext_dds/group_coherent_presentation/c++11/README.md index 6b0dec9d8..8e417647c 100644 --- a/examples/connext_dds/group_coherent_presentation/c++11/README.md +++ b/examples/connext_dds/group_coherent_presentation/c++11/README.md @@ -139,3 +139,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/instance_statistics/c++11/README.md b/examples/connext_dds/instance_statistics/c++11/README.md index 3251d5097..a86e9f4b7 100644 --- a/examples/connext_dds/instance_statistics/c++11/README.md +++ b/examples/connext_dds/instance_statistics/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/instance_statistics/c++11/instance_publisher.cxx b/examples/connext_dds/instance_statistics/c++11/instance_publisher.cxx index 202d3cc69..faec11c11 100644 --- a/examples/connext_dds/instance_statistics/c++11/instance_publisher.cxx +++ b/examples/connext_dds/instance_statistics/c++11/instance_publisher.cxx @@ -56,7 +56,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.x(static_cast(samples_written)); + data.x = static_cast(samples_written); std::cout << "Writing instance, count " << samples_written << std::endl; instance_handle = writer.register_instance(data); diff --git a/examples/connext_dds/keyed_data/c++11/README.md b/examples/connext_dds/keyed_data/c++11/README.md index 6d736cdf8..d3bc62edb 100644 --- a/examples/connext_dds/keyed_data/c++11/README.md +++ b/examples/connext_dds/keyed_data/c++11/README.md @@ -218,3 +218,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive CMakeLists.txt script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/keyed_data/c++11/keys_publisher.cxx b/examples/connext_dds/keyed_data/c++11/keys_publisher.cxx index 85fe7c2f1..14eef2d18 100644 --- a/examples/connext_dds/keyed_data/c++11/keys_publisher.cxx +++ b/examples/connext_dds/keyed_data/c++11/keys_publisher.cxx @@ -57,19 +57,19 @@ void run_publisher_application( // In order to register the instances, we must set their associated // keys first. keys k; - k.code(i); + k.code = i; // Initially, we register only the first sample. if (i == 0) { // The keys must have been set before making this call. - std::cout << "Registering instance " << k.code() << std::endl; + std::cout << "Registering instance " << k.code << std::endl; instance_handles.push_back(writer.register_instance(k)); } else { instance_handles.push_back(dds::core::InstanceHandle::nil()); } // Finally, we modify the data to be sent. - k.x((i + 1) * 1000); + k.x = (i + 1) * 1000; samples.push_back(k); } @@ -81,22 +81,22 @@ void run_publisher_application( if (samples_written == 5) { // Start sending the second and third instances. - std::cout << "----Registering instance " << samples[1].code() + std::cout << "----Registering instance " << samples[1].code << std::endl; instance_handles[1] = writer.register_instance(samples[1]); - std::cout << "----Registering instance " << samples[2].code() + std::cout << "----Registering instance " << samples[2].code << std::endl; instance_handles[2] = writer.register_instance(samples[2]); } else if (samples_written == 10) { // Unregister the second instance. - std::cout << "----Unregistering instance " << samples[1].code() + std::cout << "----Unregistering instance " << samples[1].code << std::endl; writer.unregister_instance(instance_handles[1]); instance_handles[1] = dds::core::InstanceHandle::nil(); } else if (samples_written == 15) { // Dispose the third instance. - std::cout << "----Disposing instance " << samples[2].code() + std::cout << "----Disposing instance " << samples[2].code << std::endl; writer.dispose_instance(instance_handles[2]); instance_handles[2] = dds::core::InstanceHandle::nil(); @@ -105,10 +105,10 @@ void run_publisher_application( // Update sample data field and send if handle is not nil. for (int i = 0; i < num_samples; i++) { if (!instance_handles[i].is_nil()) { - samples[i].y(samples_written); - std::cout << "Writing instance " << samples[i].code() - << ", x: " << samples[i].x() - << ", y: " << samples[i].y() << std::endl; + samples[i].y = samples_written; + std::cout << "Writing instance " << samples[i].code + << ", x: " << samples[i].x + << ", y: " << samples[i].y << std::endl; writer.write(samples[i], instance_handles[i]); } } diff --git a/examples/connext_dds/keyed_data/c++11/keys_subscriber.cxx b/examples/connext_dds/keyed_data/c++11/keys_subscriber.cxx index e5dd9a49c..807e19bee 100644 --- a/examples/connext_dds/keyed_data/c++11/keys_subscriber.cxx +++ b/examples/connext_dds/keyed_data/c++11/keys_subscriber.cxx @@ -28,12 +28,12 @@ int process_data(dds::sub::DataReader reader) dds::sub::status::ViewState view_state = info.state().view_state(); if (view_state == dds::sub::status::ViewState::new_view()) { std::cout << "Found new instance; code = " - << sample.data().code() << std::endl; + << sample.data().code << std::endl; } - std::cout << "Instance " << sample.data().code() - << ", x: " << sample.data().x() - << ", y: " << sample.data().y() << std::endl; + std::cout << "Instance " << sample.data().code + << ", x: " << sample.data().x + << ", y: " << sample.data().y << std::endl; } else { keys sample; reader.key_value(sample, info.instance_handle()); @@ -41,15 +41,15 @@ int process_data(dds::sub::DataReader reader) info.state().instance_state(); if (state == dds::sub::status::InstanceState::not_alive_no_writers()) { - std::cout << "Instance " << sample.code() << " has no writers" + std::cout << "Instance " << sample.code << " has no writers" << std::endl; } else if ( state == dds::sub::status::InstanceState::not_alive_disposed()) { - std::cout << "Instance " << sample.code() << " is disposed" + std::cout << "Instance " << sample.code << " is disposed" << std::endl; } else { - std::cout << "Instance " << sample.code() << " is alive" + std::cout << "Instance " << sample.code << " is alive" << std::endl; } } diff --git a/examples/connext_dds/keyed_data_advanced/c++11/README.md b/examples/connext_dds/keyed_data_advanced/c++11/README.md index f2334cac4..88b2d60af 100644 --- a/examples/connext_dds/keyed_data_advanced/c++11/README.md +++ b/examples/connext_dds/keyed_data_advanced/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/keyed_data_advanced/c++11/keys_publisher.cxx b/examples/connext_dds/keyed_data_advanced/c++11/keys_publisher.cxx index 40e9b80be..a6d8e8019 100644 --- a/examples/connext_dds/keyed_data_advanced/c++11/keys_publisher.cxx +++ b/examples/connext_dds/keyed_data_advanced/c++11/keys_publisher.cxx @@ -82,12 +82,12 @@ void run_publisher_application( // In order to register the instances, we must set their associated // keys first. keys k; - k.code(i); + k.code = i; // Initially, we register only the first sample. if (i == 0) { // The keys must have been set before making this call. - std::cout << "----DW1 registering instance " << k.code() + std::cout << "----DW1 registering instance " << k.code << std::endl; instance_handles1.push_back(writer1.register_instance(k)); samples1_active.push_back(true); @@ -97,12 +97,12 @@ void run_publisher_application( } // Finally, we modify the data to be sent. - k.x(1); + k.x = 1; samples1.push_back(k); } - keys sample2(samples1[1].code(), 2, 0); - std::cout << "----DW2 registering instance " << sample2.code() << std::endl; + keys sample2(samples1[1].code, 2, 0); + std::cout << "----DW2 registering instance " << sample2.code << std::endl; dds::core::InstanceHandle instance_handle2 = writer2.register_instance(sample2); bool sample2_active = true; @@ -115,9 +115,9 @@ void run_publisher_application( // Control first DataWriter. if (samples_written == 4) { // Start sending the second and third instances. - std::cout << "----DW1 registering instance " << samples1[1].code() + std::cout << "----DW1 registering instance " << samples1[1].code << std::endl - << "----DW1 registering instance " << samples1[2].code() + << "----DW1 registering instance " << samples1[2].code << std::endl; instance_handles1[1] = writer1.register_instance(samples1[1]); instance_handles1[2] = writer1.register_instance(samples1[2]); @@ -126,33 +126,33 @@ void run_publisher_application( } else if (samples_written == 8) { // Dispose the second instance. - std::cout << "----DW1 disposing instance " << samples1[1].code() + std::cout << "----DW1 disposing instance " << samples1[1].code << std::endl; writer1.dispose_instance(instance_handles1[1]); samples1_active[1] = false; } else if (samples_written == 10) { // Unregister the second instance. - std::cout << "----DW1 unregistering instance " << samples1[1].code() + std::cout << "----DW1 unregistering instance " << samples1[1].code << std::endl; writer1.unregister_instance(instance_handles1[1]); samples1_active[1] = false; } else if (samples_written == 12) { // Unregister the third instance. - std::cout << "----DW1 unregistering instance " << samples1[2].code() + std::cout << "----DW1 unregistering instance " << samples1[2].code << std::endl; writer1.unregister_instance(instance_handles1[2]); samples1_active[2] = false; std::cout << "----DW1 re-registering instance " - << samples1[1].code() << std::endl; + << samples1[1].code << std::endl; instance_handles1[1] = writer1.register_instance(samples1[1]); samples1_active[1] = true; } else if (samples_written == 16) { std::cout << "----DW1 re-registering instance " - << samples1[2].code() << std::endl; + << samples1[2].code << std::endl; instance_handles1[2] = writer1.register_instance(samples1[2]); samples1_active[2] = true; } @@ -160,10 +160,10 @@ void run_publisher_application( // Send samples for writer 1 for (int i = 0; i < num_samples; i++) { if (samples1_active[i]) { - samples1[i].y(samples_written + i * 1000); - std::cout << "DW1 write; code: " << samples1[i].code() - << ", x: " << samples1[i].x() - << ", y: " << samples1[i].y() << std::endl; + samples1[i].y = samples_written + i * 1000; + std::cout << "DW1 write; code: " << samples1[i].code + << ", x: " << samples1[i].x + << ", y: " << samples1[i].y << std::endl; writer1.write(samples1[i], instance_handles1[i]); } } @@ -172,17 +172,17 @@ void run_publisher_application( if (samples_written == 16) { // Dispose the instance. // Since it has lower ownership strength, this does nothing. - std::cout << "----DW2 disposing instance " << sample2.code() + std::cout << "----DW2 disposing instance " << sample2.code << std::endl; writer2.dispose_instance(instance_handle2); sample2_active = false; } // Send sample for writer 2 - sample2.y(-samples_written - 1000); + sample2.y = -samples_written - 1000; if (sample2_active) { - std::cout << "DW2 write; code: " << sample2.code() - << ", x: " << sample2.x() << ", y: " << sample2.y() + std::cout << "DW2 write; code: " << sample2.code + << ", x: " << sample2.x << ", y: " << sample2.y << std::endl; writer2.write(sample2, instance_handle2); } diff --git a/examples/connext_dds/keyed_data_advanced/c++11/keys_subscriber.cxx b/examples/connext_dds/keyed_data_advanced/c++11/keys_subscriber.cxx index 8263446f0..aaee5e22d 100644 --- a/examples/connext_dds/keyed_data_advanced/c++11/keys_subscriber.cxx +++ b/examples/connext_dds/keyed_data_advanced/c++11/keys_subscriber.cxx @@ -40,7 +40,7 @@ void new_instance_found( // occur due to lost liveliness or missed deadlines, so those // listeners would also need to update the instance state. - int code = msg.code(); + int code = msg.code; // If we don't have any information about it, it's a new instance. if (sampleState.count(code) == 0) { @@ -65,8 +65,8 @@ void instance_lost_writers( const keys &msg, std::map &sampleState) { - std::cout << "Instance has no writers; code = " << msg.code() << std::endl; - sampleState[msg.code()] = + std::cout << "Instance has no writers; code = " << msg.code << std::endl; + sampleState[msg.code] = dds::sub::status::InstanceState::not_alive_no_writers(); } @@ -74,15 +74,15 @@ void instance_disposed( const keys &msg, std::map &sampleState) { - std::cout << "Instance disposed; code = " << msg.code() << std::endl; - sampleState[msg.code()] = + std::cout << "Instance disposed; code = " << msg.code << std::endl; + sampleState[msg.code] = dds::sub::status::InstanceState::not_alive_disposed(); } void handle_data(const keys &msg) { - std::cout << "code: " << msg.code() << ", x: " << msg.x() - << ", y: " << msg.y() << std::endl; + std::cout << "code: " << msg.code << ", x: " << msg.x + << ", y: " << msg.y << std::endl; } int process_data(dds::sub::DataReader reader) diff --git a/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_publisher.cxx b/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_publisher.cxx index 3e63b01f0..b013e23ac 100644 --- a/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_publisher.cxx +++ b/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_publisher.cxx @@ -40,7 +40,7 @@ void run_publisher_application( "stock_cft", participant, [](const Stock &stock) { - return stock.symbol() == "GOOG" || stock.symbol() == "IBM"; + return stock.symbol == "GOOG" || stock.symbol == "IBM"; }); // Create a Topic -- and automatically register the type @@ -59,8 +59,8 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - sample.symbol(symbols[distribution(random_device)]); - sample.value(distribution(random_device) * 1.1); + sample.symbol = symbols[distribution(random_device)]; + sample.value = distribution(random_device) * 1.1; // Print the sample we're writting std::cout << "Writing " << sample << std::endl; diff --git a/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_subscriber.cxx b/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_subscriber.cxx index 842d6133d..8c98f0382 100644 --- a/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_subscriber.cxx +++ b/examples/connext_dds/lambda_content_filter/c++11/LambdaFilterExample_subscriber.cxx @@ -35,7 +35,7 @@ void run_subscriber_application( "stock_cft", topic, [](const Stock &stock) { - return stock.symbol() == "GOOG" || stock.symbol() == "IBM"; + return stock.symbol == "GOOG" || stock.symbol == "IBM"; }); dds::sub::DataReader reader( diff --git a/examples/connext_dds/lambda_content_filter/c++11/README.md b/examples/connext_dds/lambda_content_filter/c++11/README.md index 3280435d7..6b09fcaa8 100644 --- a/examples/connext_dds/lambda_content_filter/c++11/README.md +++ b/examples/connext_dds/lambda_content_filter/c++11/README.md @@ -133,3 +133,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/lbediscovery_xml_app_creation/c++11/README.md b/examples/connext_dds/lbediscovery_xml_app_creation/c++11/README.md index 3b08f2b87..3eeee1bbb 100644 --- a/examples/connext_dds/lbediscovery_xml_app_creation/c++11/README.md +++ b/examples/connext_dds/lbediscovery_xml_app_creation/c++11/README.md @@ -141,3 +141,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive CMakeLists.txt script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/lbediscovery_xml_app_creation/c++11/ShapeType_publisher.cxx b/examples/connext_dds/lbediscovery_xml_app_creation/c++11/ShapeType_publisher.cxx index 12b6b6a83..ad8990805 100644 --- a/examples/connext_dds/lbediscovery_xml_app_creation/c++11/ShapeType_publisher.cxx +++ b/examples/connext_dds/lbediscovery_xml_app_creation/c++11/ShapeType_publisher.cxx @@ -51,19 +51,19 @@ void run_publisher_application( // Declare both ShapeType instances and set the fields that don't change ShapeType red_data, blue_data; - red_data.shapesize(30); - red_data.color("RED"); - blue_data.shapesize(30); - blue_data.color("BLUE"); + red_data.shapesize = 30; + red_data.color = "RED"; + blue_data.shapesize = 30; + blue_data.color = "BLUE"; for (unsigned int samples_written = 0; !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify (X, Y) coordinates of both instances - red_data.x(samples_written); - red_data.y(samples_written); - blue_data.x(samples_written); - blue_data.y(samples_written); + red_data.x = samples_written; + red_data.y = samples_written; + blue_data.x = samples_written; + blue_data.y = samples_written; // Write std::cout << "Writing RED ShapeType sample, count " << samples_written diff --git a/examples/connext_dds/listeners/c++11/README.md b/examples/connext_dds/listeners/c++11/README.md index eb0553ccd..9e18842fb 100644 --- a/examples/connext_dds/listeners/c++11/README.md +++ b/examples/connext_dds/listeners/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/listeners/c++11/listeners_publisher.cxx b/examples/connext_dds/listeners/c++11/listeners_publisher.cxx index dbf8838de..eda49ff39 100644 --- a/examples/connext_dds/listeners/c++11/listeners_publisher.cxx +++ b/examples/connext_dds/listeners/c++11/listeners_publisher.cxx @@ -138,7 +138,7 @@ void run_publisher_application( << std::endl; // Modify data and send it. - instance.x(samples_written); + instance.x = samples_written; writer.write(instance); rti::util::sleep(dds::core::Duration(2)); diff --git a/examples/connext_dds/multichannel/c++11/README.md b/examples/connext_dds/multichannel/c++11/README.md index 203ce72bf..a77617c36 100644 --- a/examples/connext_dds/multichannel/c++11/README.md +++ b/examples/connext_dds/multichannel/c++11/README.md @@ -218,3 +218,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/multichannel/c++11/market_data_publisher.cxx b/examples/connext_dds/multichannel/c++11/market_data_publisher.cxx index c6e2937a4..d1f15dc2d 100644 --- a/examples/connext_dds/multichannel/c++11/market_data_publisher.cxx +++ b/examples/connext_dds/multichannel/c++11/market_data_publisher.cxx @@ -106,8 +106,8 @@ void run_publisher_application( samples_written++) { // Update the sample. char symbol = (char) ('A' + (samples_written % 26)); - sample.Symbol(std::string(1, symbol)); - sample.Price(samples_written); + sample.Symbol = std::string(1, symbol); + sample.Price = samples_written; // Send and wait. writer.write(sample); diff --git a/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/README.md b/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/README.md index 35c4498ba..298fc1ff0 100644 --- a/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/README.md +++ b/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/network_capture_publisher.cxx b/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/network_capture_publisher.cxx index e49582e51..296e8ab75 100644 --- a/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/network_capture_publisher.cxx +++ b/examples/connext_dds/network_capture/01_shared_memory_and_udp/c++11/network_capture_publisher.cxx @@ -48,7 +48,7 @@ void run_publisher_application( for (unsigned int samples_written = 0; !application::shutdown_requested && samples_written < sample_count; samples_written++) { - data.msg("Hello World " + std::to_string(samples_written)); + data.msg = "Hello World " + std::to_string(samples_written); std::cout << "Writing NetworkCapture, count " << samples_written << std::endl; diff --git a/examples/connext_dds/ordered_presentation/c++11/README.md b/examples/connext_dds/ordered_presentation/c++11/README.md index ce33dcb0f..0b3cb472a 100644 --- a/examples/connext_dds/ordered_presentation/c++11/README.md +++ b/examples/connext_dds/ordered_presentation/c++11/README.md @@ -219,3 +219,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/ordered_presentation/c++11/ordered_publisher.cxx b/examples/connext_dds/ordered_presentation/c++11/ordered_publisher.cxx index d9e442e0f..a48c871d8 100644 --- a/examples/connext_dds/ordered_presentation/c++11/ordered_publisher.cxx +++ b/examples/connext_dds/ordered_presentation/c++11/ordered_publisher.cxx @@ -68,15 +68,15 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Update content. - instance0.value(samples_written); - instance1.value(samples_written); + instance0.value = samples_written; + instance1.value = samples_written; // Write the two samples. - std::cout << "writing instance0, value->" << instance0.value() + std::cout << "writing instance0, value->" << instance0.value << std::endl; writer.write(instance0, handle0); - std::cout << "writing instance1, value->" << instance1.value() + std::cout << "writing instance1, value->" << instance1.value << std::endl; writer.write(instance1, handle1); diff --git a/examples/connext_dds/ordered_presentation/c++11/ordered_subscriber.cxx b/examples/connext_dds/ordered_presentation/c++11/ordered_subscriber.cxx index 43ede73bc..8acacef29 100644 --- a/examples/connext_dds/ordered_presentation/c++11/ordered_subscriber.cxx +++ b/examples/connext_dds/ordered_presentation/c++11/ordered_subscriber.cxx @@ -29,8 +29,8 @@ unsigned int poll_readers(std::vector> &readers) for (auto sample : samples) { if (sample.info().valid()) { std::cout << std::string(i, '\t') << "Reader " << i - << ": Instance" << sample.data().id() - << "->value = " << sample.data().value() << std::endl; + << ": Instance" << sample.data().id + << "->value = " << sample.data().value << std::endl; samples_read++; } } diff --git a/examples/connext_dds/ordered_presentation_group/c++11/README.md b/examples/connext_dds/ordered_presentation_group/c++11/README.md index f7bae5487..76a46398d 100644 --- a/examples/connext_dds/ordered_presentation_group/c++11/README.md +++ b/examples/connext_dds/ordered_presentation_group/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/ordered_presentation_group/c++11/ordered_group_publisher.cxx b/examples/connext_dds/ordered_presentation_group/c++11/ordered_group_publisher.cxx index 7cc5dc8aa..f4169bc55 100644 --- a/examples/connext_dds/ordered_presentation_group/c++11/ordered_group_publisher.cxx +++ b/examples/connext_dds/ordered_presentation_group/c++11/ordered_group_publisher.cxx @@ -59,21 +59,21 @@ void run_publisher_application( << std::endl; // Modify twice the first instance and send with the first writer. - instance1.message("First sample, Topic 1 sent by DataWriter number 1"); + instance1.message = "First sample, Topic 1 sent by DataWriter number 1"; writer1.write(instance1); - instance1.message("Second sample, Topic 1 sent by DataWriter number 1"); + instance1.message = "Second sample, Topic 1 sent by DataWriter number 1"; writer1.write(instance1); // Modify twice the second instance and send with the second writer. - instance2.message("First sample, Topic 2 sent by DataWriter number 2"); + instance2.message = "First sample, Topic 2 sent by DataWriter number 2"; writer2.write(instance2); - instance2.message("Second sample, Topic 2 sent by DataWriter number 2"); + instance2.message = "Second sample, Topic 2 sent by DataWriter number 2"; writer2.write(instance2); // Modify twice the third instance and send with the third writer. - instance3.message("First sample, Topic 3 sent by DataWriter number 3"); + instance3.message = "First sample, Topic 3 sent by DataWriter number 3"; writer3.write(instance3); - instance3.message("Second sample, Topic 3 sent by DataWriter number 3"); + instance3.message = "Second sample, Topic 3 sent by DataWriter number 3"; writer3.write(instance3); rti::util::sleep(dds::core::Duration(1)); diff --git a/examples/connext_dds/partitions/c++11/README.md b/examples/connext_dds/partitions/c++11/README.md index 287812f9d..be49bc002 100644 --- a/examples/connext_dds/partitions/c++11/README.md +++ b/examples/connext_dds/partitions/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/partitions/c++11/partitions_publisher.cxx b/examples/connext_dds/partitions/c++11/partitions_publisher.cxx index 47f7ab038..04bbb84c1 100644 --- a/examples/connext_dds/partitions/c++11/partitions_publisher.cxx +++ b/examples/connext_dds/partitions/c++11/partitions_publisher.cxx @@ -75,7 +75,7 @@ void run_publisher_application( << std::endl; // Modify and send the sample. - instance.x(samples_written); + instance.x = samples_written; writer.write(instance); // Every 5 samples we will change the partition name. diff --git a/examples/connext_dds/polling_querycondition/c++11/README.md b/examples/connext_dds/polling_querycondition/c++11/README.md index 9eed66c7c..9a9adcd16 100644 --- a/examples/connext_dds/polling_querycondition/c++11/README.md +++ b/examples/connext_dds/polling_querycondition/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/polling_querycondition/c++11/flights_publisher.cxx b/examples/connext_dds/polling_querycondition/c++11/flights_publisher.cxx index d0dc53a56..025426e0a 100644 --- a/examples/connext_dds/polling_querycondition/c++11/flights_publisher.cxx +++ b/examples/connext_dds/polling_querycondition/c++11/flights_publisher.cxx @@ -54,8 +54,8 @@ void run_publisher_application( for (auto &flight : flights_info) { // Set the plane altitude lineally (usually the max is at 41,000ft). - int altitude = flight.altitude() + samples_written * 100; - flight.altitude(altitude >= 41000 ? 41000 : altitude); + int altitude = flight.altitude + samples_written * 100; + flight.altitude = (altitude >= 41000 ? 41000 : altitude); std::cout << "\t" << flight << std::endl; } diff --git a/examples/connext_dds/polling_read/c++11/README.md b/examples/connext_dds/polling_read/c++11/README.md index 1b628df23..6bf941bed 100644 --- a/examples/connext_dds/polling_read/c++11/README.md +++ b/examples/connext_dds/polling_read/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/polling_read/c++11/poll_publisher.cxx b/examples/connext_dds/polling_read/c++11/poll_publisher.cxx index fff3d4030..b7bf974eb 100644 --- a/examples/connext_dds/polling_read/c++11/poll_publisher.cxx +++ b/examples/connext_dds/polling_read/c++11/poll_publisher.cxx @@ -37,10 +37,10 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Set x to a random number between 0 and 9. - sample.x((int) (rand() / (RAND_MAX / 10.0))); + sample.x = (int) (rand() / (RAND_MAX / 10.0)); std::cout << "Writing poll, count " << samples_written - << ", x = " << sample.x() << std::endl; + << ", x = " << sample.x << std::endl; writer.write(sample); rti::util::sleep(dds::core::Duration(1)); diff --git a/examples/connext_dds/polling_read/c++11/poll_subscriber.cxx b/examples/connext_dds/polling_read/c++11/poll_subscriber.cxx index 358091d4c..c07c245d5 100644 --- a/examples/connext_dds/polling_read/c++11/poll_subscriber.cxx +++ b/examples/connext_dds/polling_read/c++11/poll_subscriber.cxx @@ -49,7 +49,7 @@ void run_subscriber_application( for (const auto &sample : samples) { if (sample.info().valid()) { samples_read++; - sum += sample.data().x(); + sum += sample.data().x; } } diff --git a/examples/connext_dds/printing_qos/c++11/README.md b/examples/connext_dds/printing_qos/c++11/README.md index adeadf24a..4e281c247 100644 --- a/examples/connext_dds/printing_qos/c++11/README.md +++ b/examples/connext_dds/printing_qos/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/printing_qos/c++11/printing_publisher.cxx b/examples/connext_dds/printing_qos/c++11/printing_publisher.cxx index fe2076e04..57ff913e5 100644 --- a/examples/connext_dds/printing_qos/c++11/printing_publisher.cxx +++ b/examples/connext_dds/printing_qos/c++11/printing_publisher.cxx @@ -65,7 +65,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.x(static_cast(samples_written)); + data.x = static_cast(samples_written); std::cout << "Writing printing, count " << samples_written << std::endl; diff --git a/examples/connext_dds/remote_procedure_call/c++11/Inventory_client.cxx b/examples/connext_dds/remote_procedure_call/c++11/Inventory_client.cxx index 4ac0fe764..df0f5eb15 100644 --- a/examples/connext_dds/remote_procedure_call/c++11/Inventory_client.cxx +++ b/examples/connext_dds/remote_procedure_call/c++11/Inventory_client.cxx @@ -47,7 +47,7 @@ void run_client( try { client.remove_item(::Item(item_name, quantity)); } catch (const UnknownItemError &e) { - std::cout << "Unknown item: " << e.name() << std::endl; + std::cout << "Unknown item: " << e.name << std::endl; } } diff --git a/examples/connext_dds/remote_procedure_call/c++11/Inventory_service.cxx b/examples/connext_dds/remote_procedure_call/c++11/Inventory_service.cxx index c028591b0..a00567151 100644 --- a/examples/connext_dds/remote_procedure_call/c++11/Inventory_service.cxx +++ b/examples/connext_dds/remote_procedure_call/c++11/Inventory_service.cxx @@ -35,7 +35,7 @@ class InventoryImpl : public InventoryService { std::lock_guard lock(mutex); for (const auto &item : inventory) { - contents.items().push_back(::Item(item.first, item.second)); + contents.items.push_back(::Item(item.first, item.second)); } return contents; @@ -48,10 +48,10 @@ class InventoryImpl : public InventoryService { } std::lock_guard lock(mutex); - if (inventory.find(item.name()) == inventory.end()) { - inventory[item.name()] = item.quantity(); + if (inventory.find(item.name) == inventory.end()) { + inventory[item.name] = item.quantity; } else { - inventory[item.name()] += item.quantity(); + inventory[item.name] += item.quantity; } } @@ -62,13 +62,13 @@ class InventoryImpl : public InventoryService { } std::lock_guard lock(mutex); - if (inventory.find(item.name()) == inventory.end()) { - throw UnknownItemError(item.name()); + if (inventory.find(item.name) == inventory.end()) { + throw UnknownItemError(item.name); } - inventory[item.name()] -= item.quantity(); - if (inventory[item.name()] <= 0) { - inventory.erase(item.name()); + inventory[item.name] -= item.quantity; + if (inventory[item.name] <= 0) { + inventory.erase(item.name); } } diff --git a/examples/connext_dds/remote_procedure_call/c++11/README.md b/examples/connext_dds/remote_procedure_call/c++11/README.md index aa215d0b4..1a0d48d80 100644 --- a/examples/connext_dds/remote_procedure_call/c++11/README.md +++ b/examples/connext_dds/remote_procedure_call/c++11/README.md @@ -143,3 +143,20 @@ Updated inventory: [items: {[name: apples, quantity: 100], [name: oranges, quant A service runs its operations in a thread pool; the number of threads can be configured with the `dds::rpc::ServerParams` argument. The example sets the number of threads to 4. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/time_based_filter/c++11/README.md b/examples/connext_dds/time_based_filter/c++11/README.md index f04e9fe6c..7578318c0 100644 --- a/examples/connext_dds/time_based_filter/c++11/README.md +++ b/examples/connext_dds/time_based_filter/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/time_based_filter/c++11/tbf_publisher.cxx b/examples/connext_dds/time_based_filter/c++11/tbf_publisher.cxx index 026a14ad1..20277da86 100644 --- a/examples/connext_dds/time_based_filter/c++11/tbf_publisher.cxx +++ b/examples/connext_dds/time_based_filter/c++11/tbf_publisher.cxx @@ -43,15 +43,15 @@ void run_publisher_application( // Update instance1 (code = 1) every 0.5 seconds => when count is even. if ((samples_written + 1) % 2 == 0) { std::cout << "Publishing instance 1" << std::endl; - sample.code(1); - sample.x(samples_written); + sample.code = 1; + sample.x = samples_written; writer.write(sample); } // Update instance 0 (code = 0) every 0.25 seconds. std::cout << "Publishing instance 0" << std::endl; - sample.code(0); - sample.x(samples_written); + sample.code = 0; + sample.x = samples_written; writer.write(sample); // The loop to write new samples will sleep for 0.25 second. diff --git a/examples/connext_dds/time_based_filter/c++11/tbf_subscriber.cxx b/examples/connext_dds/time_based_filter/c++11/tbf_subscriber.cxx index eda26ab93..59b6859f7 100644 --- a/examples/connext_dds/time_based_filter/c++11/tbf_subscriber.cxx +++ b/examples/connext_dds/time_based_filter/c++11/tbf_subscriber.cxx @@ -31,8 +31,8 @@ int process_data(dds::sub::DataReader reader) sample.info().source_timestamp().to_secs(); const tbf &data = sample.data(); - std::cout << source_timestamp << "\t" << data.code() << "\t\t" - << data.x() << std::endl; + std::cout << source_timestamp << "\t" << data.code << "\t\t" + << data.x << std::endl; } } diff --git a/examples/connext_dds/using_qos_profiles/c++11/README.md b/examples/connext_dds/using_qos_profiles/c++11/README.md index e2b10c2fd..6d9c6f220 100644 --- a/examples/connext_dds/using_qos_profiles/c++11/README.md +++ b/examples/connext_dds/using_qos_profiles/c++11/README.md @@ -136,3 +136,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/using_qos_profiles/c++11/profiles_publisher.cxx b/examples/connext_dds/using_qos_profiles/c++11/profiles_publisher.cxx index 0fa027999..b22cf96e4 100644 --- a/examples/connext_dds/using_qos_profiles/c++11/profiles_publisher.cxx +++ b/examples/connext_dds/using_qos_profiles/c++11/profiles_publisher.cxx @@ -60,12 +60,12 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Update the counter value of the sample. - instance.x(samples_written); + instance.x = samples_written; // Send the sample using the DataWriter with "volatile" durability. std::cout << "Writing profile_name = volatile_profile,\t x = " << samples_written << std::endl; - instance.profile_name("volatile_profile"); + instance.profile_name = "volatile_profile"; writer_volatile.write(instance); // Send the sample using the DataWriter with "transient_local" @@ -73,7 +73,7 @@ void run_publisher_application( std::cout << "Writing profile_name = transient_local_profile,\t x = " << samples_written << std::endl << std::endl; - instance.profile_name("transient_local_profile"); + instance.profile_name = "transient_local_profile"; writer_transient_local.write(instance); // Send the sample every second. diff --git a/examples/connext_dds/using_typecodes/c++11/README.md b/examples/connext_dds/using_typecodes/c++11/README.md index b57fa76e1..ccaa80278 100644 --- a/examples/connext_dds/using_typecodes/c++11/README.md +++ b/examples/connext_dds/using_typecodes/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/using_typecodes/c++11/msg_publisher.cxx b/examples/connext_dds/using_typecodes/c++11/msg_publisher.cxx index 386d38ebc..b3aae094c 100644 --- a/examples/connext_dds/using_typecodes/c++11/msg_publisher.cxx +++ b/examples/connext_dds/using_typecodes/c++11/msg_publisher.cxx @@ -48,7 +48,7 @@ void run_publisher_application( samples_written++) { // Update sample and send it. std::cout << "Writing msg, count " << samples_written << std::endl; - sample.count(samples_written); + sample.count = samples_written; writer.write(sample); rti::util::sleep(dds::core::Duration(4)); diff --git a/examples/connext_dds/waitset_query_cond/c++11/README.md b/examples/connext_dds/waitset_query_cond/c++11/README.md index 470337151..ddb25c722 100644 --- a/examples/connext_dds/waitset_query_cond/c++11/README.md +++ b/examples/connext_dds/waitset_query_cond/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/waitset_query_cond/c++11/waitset_query_cond_publisher.cxx b/examples/connext_dds/waitset_query_cond/c++11/waitset_query_cond_publisher.cxx index 309846005..540c9a023 100644 --- a/examples/connext_dds/waitset_query_cond/c++11/waitset_query_cond_publisher.cxx +++ b/examples/connext_dds/waitset_query_cond/c++11/waitset_query_cond_publisher.cxx @@ -45,13 +45,13 @@ void run_publisher_application( << std::endl; // Set x value - instance.x(samples_written); + instance.x = samples_written; // Set name field if (samples_written % 2 == 1) { - instance.name("ODD"); + instance.name = "ODD"; } else { - instance.name("EVEN"); + instance.name = "EVEN"; } writer.write(instance); diff --git a/examples/connext_dds/waitset_status_cond/c++11/README.md b/examples/connext_dds/waitset_status_cond/c++11/README.md index bca632ea4..ab65d9f4c 100644 --- a/examples/connext_dds/waitset_status_cond/c++11/README.md +++ b/examples/connext_dds/waitset_status_cond/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/waitset_status_cond/c++11/waitset_cond_modern_publisher.cxx b/examples/connext_dds/waitset_status_cond/c++11/waitset_cond_modern_publisher.cxx index 20ddc0719..f0681945e 100644 --- a/examples/connext_dds/waitset_status_cond/c++11/waitset_cond_modern_publisher.cxx +++ b/examples/connext_dds/waitset_status_cond/c++11/waitset_cond_modern_publisher.cxx @@ -34,7 +34,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { std::cout << "Writing Foo, count " << samples_written << std::endl; - sample.x(samples_written); + sample.x = samples_written; writer.write(sample); rti::util::sleep(dds::core::Duration(1)); } diff --git a/examples/connext_dds/waitsets/c++11/README.md b/examples/connext_dds/waitsets/c++11/README.md index ce0eca792..c6619b180 100644 --- a/examples/connext_dds/waitsets/c++11/README.md +++ b/examples/connext_dds/waitsets/c++11/README.md @@ -135,3 +135,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_dds/waitsets/c++11/waitsets_publisher.cxx b/examples/connext_dds/waitsets/c++11/waitsets_publisher.cxx index 7d2effc45..d04807b36 100644 --- a/examples/connext_dds/waitsets/c++11/waitsets_publisher.cxx +++ b/examples/connext_dds/waitsets/c++11/waitsets_publisher.cxx @@ -53,7 +53,7 @@ void run_publisher_application( std::cout << "Writing waitsets, count " << samples_written << std::endl; // Modify sample and send the sample. - instance.x(samples_written); + instance.x = samples_written; writer.write(instance); // Send a new sample every second. diff --git a/examples/connext_secure/cds/c++11/CDS_publisher.cxx b/examples/connext_secure/cds/c++11/CDS_publisher.cxx index a0bdb7a3d..093c27e88 100644 --- a/examples/connext_secure/cds/c++11/CDS_publisher.cxx +++ b/examples/connext_secure/cds/c++11/CDS_publisher.cxx @@ -48,7 +48,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.value(static_cast(samples_written)); + data.value = static_cast(samples_written); std::cout << "Writing CDS, count " << samples_written << std::endl; writer.write(data); diff --git a/examples/connext_secure/cds/c++11/README.md b/examples/connext_secure/cds/c++11/README.md index 96d0b9d2c..a7d3a216b 100644 --- a/examples/connext_secure/cds/c++11/README.md +++ b/examples/connext_secure/cds/c++11/README.md @@ -49,3 +49,20 @@ To filter traffic going to CDS in Wireshark, use udp.dstport == 9999. To filter traffic relayed by CDS, use rtps.flag.cloud_discovery_service_announcer == 1. You will that all traffic is SIGNED when using the secure configuration. This means that the secure prefix and postfix are present for all Data(p)s. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_secure/certificate_revocation_list/c++11/Crl_publisher.cxx b/examples/connext_secure/certificate_revocation_list/c++11/Crl_publisher.cxx index 91e564d50..9ae5c0cab 100644 --- a/examples/connext_secure/certificate_revocation_list/c++11/Crl_publisher.cxx +++ b/examples/connext_secure/certificate_revocation_list/c++11/Crl_publisher.cxx @@ -48,7 +48,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.value(static_cast(samples_written)); + data.value = static_cast(samples_written); std::cout << "Writing Crl, count " << samples_written << std::endl; writer.write(data); diff --git a/examples/connext_secure/certificate_revocation_list/c++11/README.md b/examples/connext_secure/certificate_revocation_list/c++11/README.md index e9d334fed..d7abfe7df 100644 --- a/examples/connext_secure/certificate_revocation_list/c++11/README.md +++ b/examples/connext_secure/certificate_revocation_list/c++11/README.md @@ -109,3 +109,20 @@ They will start communicating again, because of the `com.rti.serv.secure.files_poll_interval` property. This allows you to renew your certificates without having to restart your applications. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_secure/lightweight/c++11/Lws_publisher.cxx b/examples/connext_secure/lightweight/c++11/Lws_publisher.cxx index 7f0cb55f4..629b2a3e4 100644 --- a/examples/connext_secure/lightweight/c++11/Lws_publisher.cxx +++ b/examples/connext_secure/lightweight/c++11/Lws_publisher.cxx @@ -45,24 +45,24 @@ void run_publisher_application( dds::pub::DataWriter writer2(publisher, topic2); Shape data1, data2; - data1.color("BLUE"); - data2.color("RED"); + data1.color = "BLUE"; + data2.color = "RED"; // Main loop, write data for (unsigned int samples_written = 0; !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data1.x(static_cast(samples_written)); - data1.y(static_cast(samples_written)); - data1.shapesize(static_cast(samples_written)); + data1.x = static_cast(samples_written); + data1.y = static_cast(samples_written); + data1.shapesize = static_cast(samples_written); std::cout << "Writing BLUE Shape, count " << samples_written << std::endl; writer1.write(data1); - data2.x(static_cast(samples_written)); - data2.y(static_cast(samples_written)); - data2.shapesize(static_cast(samples_written)); + data2.x = static_cast(samples_written); + data2.y = static_cast(samples_written); + data2.shapesize = static_cast(samples_written); std::cout << "Writing RED Shape, count " << samples_written << std::endl; diff --git a/examples/connext_secure/lightweight/c++11/README.md b/examples/connext_secure/lightweight/c++11/README.md index d906ecb89..74219dd6a 100644 --- a/examples/connext_secure/lightweight/c++11/README.md +++ b/examples/connext_secure/lightweight/c++11/README.md @@ -77,3 +77,20 @@ Lws subscriber sleeping up to 1 sec... [color: BLUE, x: 10, y: 10, shapesize: 10] Lws subscriber sleeping up to 1 sec... ``` + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_secure/whitelist/c++11/README.md b/examples/connext_secure/whitelist/c++11/README.md index 77a97b2f2..7b9a9596a 100644 --- a/examples/connext_secure/whitelist/c++11/README.md +++ b/examples/connext_secure/whitelist/c++11/README.md @@ -93,3 +93,20 @@ error for the subscriber that is not in the whitelist. The example finishes by adding both subscribers back to the whitelist. They should start to receive samples again. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/connext_secure/whitelist/c++11/Whitelist_publisher.cxx b/examples/connext_secure/whitelist/c++11/Whitelist_publisher.cxx index 81b884460..3f8379b75 100644 --- a/examples/connext_secure/whitelist/c++11/Whitelist_publisher.cxx +++ b/examples/connext_secure/whitelist/c++11/Whitelist_publisher.cxx @@ -50,7 +50,7 @@ void run_publisher_application( !application::shutdown_requested && samples_written < sample_count; samples_written++) { // Modify the data to be written here - data.value(static_cast(samples_written)); + data.value = static_cast(samples_written); std::cout << "Writing Whitelist, count " << samples_written << std::endl; diff --git a/examples/persistence_service/persistent_storage/c++11/README.md b/examples/persistence_service/persistent_storage/c++11/README.md index 4854a9653..3a8e49d67 100644 --- a/examples/persistence_service/persistent_storage/c++11/README.md +++ b/examples/persistence_service/persistent_storage/c++11/README.md @@ -274,3 +274,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/persistence_service/persistent_storage/c++11/hello_world_publisher.cxx b/examples/persistence_service/persistent_storage/c++11/hello_world_publisher.cxx index 2933a6673..67b8d7443 100644 --- a/examples/persistence_service/persistent_storage/c++11/hello_world_publisher.cxx +++ b/examples/persistence_service/persistent_storage/c++11/hello_world_publisher.cxx @@ -50,7 +50,7 @@ void publisher_main( hello_world sample; for (int count = 0; count < sample_count || sample_count == 0; count++) { std::cout << "Writing hello_world, count " << count << std::endl; - sample.data(initial_value++); + sample.data = initial_value++; writer.write(sample); std::this_thread::sleep_for(std::chrono::seconds(1)); diff --git a/examples/recording_service/pluggable_storage/c++11/HelloMsg_publisher.cxx b/examples/recording_service/pluggable_storage/c++11/HelloMsg_publisher.cxx index 1d5dab5ef..49c21a8b3 100644 --- a/examples/recording_service/pluggable_storage/c++11/HelloMsg_publisher.cxx +++ b/examples/recording_service/pluggable_storage/c++11/HelloMsg_publisher.cxx @@ -36,8 +36,8 @@ void publisher_main(int domain_id, int sample_count) // Modify the data to be written here std::stringstream string_builder; string_builder << std::string("Sample string ") << count << std::endl; - sample.id(count); - sample.msg(string_builder.str()); + sample.id = count; + sample.msg = string_builder.str(); std::cout << "Writing HelloMsg, count " << count << std::endl; diff --git a/examples/recording_service/pluggable_storage/c++11/README.md b/examples/recording_service/pluggable_storage/c++11/README.md index 10e9a020b..09b6d42da 100644 --- a/examples/recording_service/pluggable_storage/c++11/README.md +++ b/examples/recording_service/pluggable_storage/c++11/README.md @@ -236,3 +236,20 @@ you want to link against. For example: ```sh cmake -DCONNEXTDDS_ARCH=x64Linux3gcc5.4.0 .. ``` + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/routing_service/monitoring/c++11/README.md b/examples/routing_service/monitoring/c++11/README.md index c82cd1bb4..5e7630c5a 100644 --- a/examples/routing_service/monitoring/c++11/README.md +++ b/examples/routing_service/monitoring/c++11/README.md @@ -152,3 +152,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/routing_service/monitoring/c++11/RoutingServiceMonitoring_subscriber.cxx b/examples/routing_service/monitoring/c++11/RoutingServiceMonitoring_subscriber.cxx index 231f9fd3a..7e38eae8e 100644 --- a/examples/routing_service/monitoring/c++11/RoutingServiceMonitoring_subscriber.cxx +++ b/examples/routing_service/monitoring/c++11/RoutingServiceMonitoring_subscriber.cxx @@ -69,46 +69,46 @@ int processPeriodicData( for (const auto &sample : samples) { if (sample.info().valid()) { count++; - switch (sample.data().value()._d()) { + switch (sample.data().value._d()) { case (RTI::Service::Monitoring::ResourceKind:: ROUTING_DOMAIN_ROUTE): { auto config = getConfig( configReader, sample.info().instance_handle()); std::cout << "Periodic data:\n\tDomain Route: "; - if (config.value() + if (config.value .routing_domain_route() - .connections() + .connections .value() .size() > 0) { std::cout << " { "; for (const auto &connection : - config.value() + config.value .routing_domain_route() - .connections() + .connections .value()) { - std::cout << connection.name() << ", "; + std::cout << connection.name << ", "; } std::cout << " } " << std::endl; } std::cout << "\n\t\t in samples/s (mean): " << sample.data() - .value() + .value .routing_domain_route() - .in_samples_per_sec() + .in_samples_per_sec .value() - .publication_period_metrics() - .mean() + .publication_period_metrics + .mean << ", out samples/s (mean): " << sample.data() - .value() + .value .routing_domain_route() - .out_samples_per_sec() + .out_samples_per_sec .value() - .publication_period_metrics() - .mean() + .publication_period_metrics + .mean << std::endl; break; } @@ -118,19 +118,19 @@ int processPeriodicData( configReader, sample.info().instance_handle()); std::cout << "Periodic data:\n\t > Routing Service " - << config.value() + << config.value .routing_service() - .application_name() + .application_name << "\n\t\t cpu usage (mean): " << sample.data() - .value() + .value .routing_service() - .process() + .process .value() - .cpu_usage_percentage() + .cpu_usage_percentage .value() - .publication_period_metrics() - .mean() + .publication_period_metrics + .mean << " %" << std::endl; break; } @@ -171,31 +171,31 @@ int processEventData( for (const auto &sample : samples) { if (sample.info().valid()) { count++; - switch (sample.data().value()._d()) { + switch (sample.data().value._d()) { case (RTI::Service::Monitoring::ResourceKind:: ROUTING_DOMAIN_ROUTE): { std::cout << "\t > The Domain Route status is " << sample.data() - .value() + .value .routing_domain_route() - .state() + .state << std::endl; if (sample.data() - .value() + .value .routing_domain_route() - .connections() + .connections .value() .size() > 0) { std::cout << "\t\t Connections available: { "; for (const auto &connection : sample.data() - .value() + .value .routing_domain_route() - .connections() + .connections .value()) { std::cout << " Participant name: " - << connection.name() << ", "; + << connection.name << ", "; } std::cout << " } " << std::endl; } @@ -205,28 +205,28 @@ int processEventData( auto config = getConfig( configReader, sample.info().instance_handle()); - if (config.value()._d() + if (config.value._d() == RTI::Service::Monitoring::ResourceKind:: ROUTING_INPUT) { std::cout << "\t > The Input " - << config.value().routing_input().resource_id() + << config.value.routing_input().resource_id << std::endl; std::cout << "\t\t status is " - << sample.data().value().routing_input().state() + << sample.data().value.routing_input().state << std::endl; std::cout << "\t\t Topic: " - << config.value().routing_input().stream_name() + << config.value.routing_input().stream_name << ", Type: " - << config.value() + << config.value .routing_input() - .registered_type_name() + .registered_type_name << ", Participant name: " - << config.value() + << config.value .routing_input() - .connection_name() + .connection_name << std::endl; } break; @@ -235,30 +235,30 @@ int processEventData( auto config = getConfig( configReader, sample.info().instance_handle()); - if (config.value()._d() + if (config.value._d() == RTI::Service::Monitoring::ResourceKind:: ROUTING_OUTPUT) { std::cout << "\t > The Output " - << config.value().routing_output().resource_id() + << config.value.routing_output().resource_id << std::endl; std::cout << "\t > status is " << sample.data() - .value() + .value .routing_output() - .state() + .state << std::endl; std::cout << "\t\t Topic: " - << config.value().routing_output().stream_name() + << config.value.routing_output().stream_name << ", Type: " - << config.value() + << config.value .routing_output() - .registered_type_name() + .registered_type_name << ", Participant name: " - << config.value() + << config.value .routing_output() - .connection_name() + .connection_name << std::endl; } break; diff --git a/examples/routing_service/remote_admin/c++11/README.md b/examples/routing_service/remote_admin/c++11/README.md index db111b7a6..8d1171376 100644 --- a/examples/routing_service/remote_admin/c++11/README.md +++ b/examples/routing_service/remote_admin/c++11/README.md @@ -130,3 +130,20 @@ you want to link against. For example: ```sh cmake -DCONNEXTDDS_ARCH=x64Linux3gcc5.4.0 .. ``` + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/examples/routing_service/remote_admin/c++11/src/Requester.cxx b/examples/routing_service/remote_admin/c++11/src/Requester.cxx index 15779be68..532fd71d6 100644 --- a/examples/routing_service/remote_admin/c++11/src/Requester.cxx +++ b/examples/routing_service/remote_admin/c++11/src/Requester.cxx @@ -35,7 +35,7 @@ static void send( CommandRequest &request) { dds::topic::topic_type_support::to_cdr_buffer( - reinterpret_cast &>(request.octet_body()), + reinterpret_cast &>(request.octet_body), EntityState(EntityStateKind::DISABLED)); /* * Send disable @@ -43,10 +43,10 @@ static void send( requester.send_request(request); CommandReply reply = requester.receive_replies(Duration(WAIT_TIMEOUT_SEC_MAX))[0]; - if (reply.retcode() == CommandReplyRetcode::OK_RETCODE) { - std::cout << "Command returned: " << reply.string_body() << std::endl; + if (reply.retcode == CommandReplyRetcode::OK_RETCODE) { + std::cout << "Command returned: " << reply.string_body << std::endl; } else { - std::cout << "Unsuccessful command returned value " << reply.retcode() + std::cout << "Unsuccessful command returned value " << reply.retcode << "." << std::endl; throw dds::core::Error("Error in replier"); } @@ -94,10 +94,10 @@ int main(int argc, char *argv[]) * Setup command */ CommandRequest request; - request.action(args_parser.command_kind()); - request.resource_identifier(args_parser.resource_identifier()); + request.action = args_parser.command_kind(); + request.resource_identifier = args_parser.resource_identifier(); if (args_parser.body_str() != "") { - request.string_body(args_parser.body_str()); + request.string_body = args_parser.body_str(); } send(requester, request); diff --git a/examples/routing_service/struct_array_transf/c++11/README.md b/examples/routing_service/struct_array_transf/c++11/README.md index 084328671..c3cede862 100644 --- a/examples/routing_service/struct_array_transf/c++11/README.md +++ b/examples/routing_service/struct_array_transf/c++11/README.md @@ -225,3 +225,20 @@ using CMake, please refer to the [hello_world](../../../connext_dds/build_systems/cmake/) example, which includes a comprehensive `CMakeLists.txt` script with all the steps and instructions described in detail. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` \ No newline at end of file diff --git a/examples/routing_service/struct_array_transf/c++11/SensorAttributesCollectionPublisher.cxx b/examples/routing_service/struct_array_transf/c++11/SensorAttributesCollectionPublisher.cxx index e9e82348a..d4dd98efa 100644 --- a/examples/routing_service/struct_array_transf/c++11/SensorAttributesCollectionPublisher.cxx +++ b/examples/routing_service/struct_array_transf/c++11/SensorAttributesCollectionPublisher.cxx @@ -33,10 +33,10 @@ void publisher_main(int domain_id, int sample_count) SensorAttributesCollection data; for (int count = 0; count < sample_count || sample_count == 0; count++) { - for (size_t i = 0; i < data.sensor_array().size(); i++) { - data.sensor_array().at(i).id(count); - data.sensor_array().at(i).value((float) i / count); - data.sensor_array().at(i).is_active(true); + for (size_t i = 0; i < data.sensor_array.size(); i++) { + data.sensor_array.at(i).id = count; + data.sensor_array.at(i).value = (float) i / count; + data.sensor_array.at(i).is_active = true; } std::cout << "Writing SensorAttributesCollection, count " << count diff --git a/examples/routing_service/struct_array_transf/c++11/StructArrayTransformation.cxx b/examples/routing_service/struct_array_transf/c++11/StructArrayTransformation.cxx index 70ee56f4a..c6b5c2037 100644 --- a/examples/routing_service/struct_array_transf/c++11/StructArrayTransformation.cxx +++ b/examples/routing_service/struct_array_transf/c++11/StructArrayTransformation.cxx @@ -33,14 +33,14 @@ DynamicData *StructArrayTransformation::convert_sample( SensorData native_sensor_data; /* Map elements from SensorAttributesCollection to SensorData */ - for (int32_t count = 0; count < native_collection.sensor_array().size(); + for (int32_t count = 0; count < native_collection.sensor_array.size(); ++count) { - native_sensor_data.id().at(count) = - native_collection.sensor_array().at(count).id(); - native_sensor_data.value().at(count) = - native_collection.sensor_array().at(count).value(); - native_sensor_data.is_active().at(count) = - native_collection.sensor_array().at(count).is_active(); + native_sensor_data.id.at(count) = + native_collection.sensor_array.at(count).id; + native_sensor_data.value.at(count) = + native_collection.sensor_array.at(count).value; + native_sensor_data.is_active.at(count) = + native_collection.sensor_array.at(count).is_active; } return new DynamicData(rti::core::xtypes::convert(native_sensor_data)); diff --git a/tutorials/application_design/c++11/README.md b/tutorials/application_design/c++11/README.md index 65414477c..8787c0af2 100644 --- a/tutorials/application_design/c++11/README.md +++ b/tutorials/application_design/c++11/README.md @@ -46,3 +46,20 @@ cmake --build . --config Release|Debug ## Running the Example :rocket: See the tutorial for instructions. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/tutorials/application_design/c++11/common.hpp b/tutorials/application_design/c++11/common.hpp index a361ce668..00e968f71 100644 --- a/tutorials/application_design/c++11/common.hpp +++ b/tutorials/application_design/c++11/common.hpp @@ -25,7 +25,7 @@ using CoordSequence = rti::core::bounded_sequence; std::string to_string(const Coord &coord) { std::ostringstream ss; - ss << "Coord(lat: " << coord.lat() << ", lon: " << coord.lon() << ")"; + ss << "Coord(lat: " << coord.lat << ", lon: " << coord.lon << ")"; return ss.str(); } diff --git a/tutorials/application_design/c++11/publisher.cxx b/tutorials/application_design/c++11/publisher.cxx index 6b6a22c5e..d6d160dd1 100644 --- a/tutorials/application_design/c++11/publisher.cxx +++ b/tutorials/application_design/c++11/publisher.cxx @@ -28,12 +28,12 @@ class PublisherSimulation { auto new_vin = utils::new_vin(); auto new_route = utils::create_new_route(); - metrics_.vehicle_vin(new_vin); - metrics_.fuel_level(100.0); + metrics_.vehicle_vin = new_vin; + metrics_.fuel_level = 100.0; - transit_.vehicle_vin(new_vin); - transit_.current_route(new_route); - transit_.current_position(new_route.front()); + transit_.vehicle_vin = new_vin; + transit_.current_route = new_route; + transit_.current_position = new_route.front(); } bool has_ended() const @@ -52,13 +52,13 @@ class PublisherSimulation { bool is_out_of_fuel() const { - return metrics_.fuel_level() <= 0.0; + return metrics_.fuel_level <= 0.0; } bool is_on_standby() const { - return !transit_.current_route().has_value() - || transit_.current_route().value().empty(); + return !transit_.current_route.has_value() + || transit_.current_route.value().empty(); } }; @@ -71,25 +71,25 @@ void PublisherSimulation::run() std::this_thread::sleep_for(std::chrono::seconds(1)); if (is_on_standby()) { - std::cout << "Vehicle '" << metrics_.vehicle_vin() + std::cout << "Vehicle '" << metrics_.vehicle_vin << "' has reached its destination, now moving to a " "new location..." << std::endl; auto new_route = utils::create_new_route(); - new_route.front() = transit_.current_position(); - transit_.current_route(new_route); + new_route.front() = transit_.current_position; + transit_.current_route = new_route; } - metrics_.fuel_level() -= 10 * utils::random_stduniform(); - transit_.current_position(transit_.current_route().value().front()); - transit_.current_route().value().erase( - transit_.current_route().value().begin()); + metrics_.fuel_level -= 10 * utils::random_stduniform(); + transit_.current_position = transit_.current_route.value().front(); + transit_.current_route.value().erase( + transit_.current_route.value().begin()); if (is_out_of_fuel()) { - metrics_.fuel_level(0.0); + metrics_.fuel_level = 0.0; - std::cout << "Vehicle '" << metrics_.vehicle_vin() + std::cout << "Vehicle '" << metrics_.vehicle_vin << "' ran out of fuel!" << std::endl; } } diff --git a/tutorials/application_design/c++11/subscriber.cxx b/tutorials/application_design/c++11/subscriber.cxx index d5dcb71dd..df49a36d0 100644 --- a/tutorials/application_design/c++11/subscriber.cxx +++ b/tutorials/application_design/c++11/subscriber.cxx @@ -97,14 +97,14 @@ std::string SubscriberDashboard::create_new_position_string( continue; } - ss << "[INFO] Vehicle " << sample.data().vehicle_vin(); - auto ¤t_route = sample.data().current_route(); + ss << "[INFO] Vehicle " << sample.data().vehicle_vin; + auto ¤t_route = sample.data().current_route; if (current_route.has_value() && !current_route->empty()) { ss << " is en route to " << to_string(current_route->back()) - << " from " << to_string(sample.data().current_position()); + << " from " << to_string(sample.data().current_position); } else { ss << " has arrived at its destination in " - << to_string(sample.data().current_position()); + << to_string(sample.data().current_position); } ss << "\n"; } @@ -172,7 +172,7 @@ SubscriberDashboard::build_dashboard_data() continue; auto new_handle = sample.info().instance_handle(); - auto new_data = DashboardItem { sample.data().vehicle_vin() }; + auto new_data = DashboardItem { sample.data().vehicle_vin }; it = data.emplace(new_handle, new_data).first; } @@ -184,7 +184,7 @@ SubscriberDashboard::build_dashboard_data() continue; } - item.fuel_history.push_back(sample.data().fuel_level()); + item.fuel_history.push_back(sample.data().fuel_level); } for (const auto &sample : transit_samples) { auto it = data.find(sample.info().instance_handle()); @@ -194,7 +194,7 @@ SubscriberDashboard::build_dashboard_data() continue; auto new_handle = sample.info().instance_handle(); - auto new_data = DashboardItem { sample.data().vehicle_vin() }; + auto new_data = DashboardItem { sample.data().vehicle_vin }; it = data.emplace(new_handle, new_data).first; } @@ -206,7 +206,7 @@ SubscriberDashboard::build_dashboard_data() continue; } - auto ¤t_route = sample.data().current_route(); + auto ¤t_route = sample.data().current_route; if (current_route->size() > 0) { item.current_destination = current_route->back(); } else { diff --git a/tutorials/content_filtering/c++11/README.md b/tutorials/content_filtering/c++11/README.md index 0fcdc1ecc..f4ff40048 100644 --- a/tutorials/content_filtering/c++11/README.md +++ b/tutorials/content_filtering/c++11/README.md @@ -48,3 +48,21 @@ cmake --build . --config Release|Debug ## Running the Example :rocket: See the tutorial for instructions. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` + diff --git a/tutorials/content_filtering/c++11/home_automation_publisher.cxx b/tutorials/content_filtering/c++11/home_automation_publisher.cxx index 024acd5db..84a1306fc 100644 --- a/tutorials/content_filtering/c++11/home_automation_publisher.cxx +++ b/tutorials/content_filtering/c++11/home_automation_publisher.cxx @@ -25,7 +25,7 @@ void publish_sensor( DeviceStatus device_status { sensor_name, room_name, false }; for (int i = 0; i < 1000; i++) { - device_status.is_open(!device_status.is_open()); + device_status.is_open = !device_status.is_open; writer.write(device_status); std::this_thread::sleep_for(std::chrono::seconds(2)); } diff --git a/tutorials/content_filtering/c++11/home_automation_subscriber.cxx b/tutorials/content_filtering/c++11/home_automation_subscriber.cxx index 1cc2c34f6..e4780d6b4 100644 --- a/tutorials/content_filtering/c++11/home_automation_subscriber.cxx +++ b/tutorials/content_filtering/c++11/home_automation_subscriber.cxx @@ -33,8 +33,8 @@ int main(int argc, char **argv) [](const rti::sub::LoanedSample &sample) { if (sample.info().valid()) { // ignore samples with only // meta-data - std::cout << "WARNING: " << sample.data().sensor_name() - << " in " << sample.data().room_name() + std::cout << "WARNING: " << sample.data().sensor_name + << " in " << sample.data().room_name << " is open!" << std::endl; } }); diff --git a/tutorials/content_filtering/c++11/home_automation_subscriber_update_filter.cxx b/tutorials/content_filtering/c++11/home_automation_subscriber_update_filter.cxx index e6120e7fb..de0eee708 100644 --- a/tutorials/content_filtering/c++11/home_automation_subscriber_update_filter.cxx +++ b/tutorials/content_filtering/c++11/home_automation_subscriber_update_filter.cxx @@ -41,8 +41,8 @@ int main(int argc, char **argv) [](const rti::sub::LoanedSample &sample) { if (sample.info().valid()) { // ignore samples with only // meta-data - std::cout << "WARNING: " << sample.data().sensor_name() - << " in " << sample.data().room_name() + std::cout << "WARNING: " << sample.data().sensor_name + << " in " << sample.data().room_name << " is open!" << std::endl; } }); diff --git a/tutorials/data_persistence/c++11/README.md b/tutorials/data_persistence/c++11/README.md index ce44127d3..a0d3e976e 100644 --- a/tutorials/data_persistence/c++11/README.md +++ b/tutorials/data_persistence/c++11/README.md @@ -48,3 +48,20 @@ cmake --build . --config Release|Debug ## Running the Example :rocket: See the tutorial for instructions. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/tutorials/data_persistence/c++11/temperature_durable_publisher.cxx b/tutorials/data_persistence/c++11/temperature_durable_publisher.cxx index 2cd554df6..26d88493d 100644 --- a/tutorials/data_persistence/c++11/temperature_durable_publisher.cxx +++ b/tutorials/data_persistence/c++11/temperature_durable_publisher.cxx @@ -37,9 +37,9 @@ void publish_temperature(const std::string &sensor_name) dds::pub::DataWriter writer(topic, writer_qos); Temperature temp_reading; - temp_reading.sensor_name(sensor_name); + temp_reading.sensor_name = sensor_name; for (int i = 0; i < 1000; i++) { - temp_reading.degrees((rand() % 10) + 30); + temp_reading.degrees = (rand() % 10) + 30; writer.write(temp_reading); std::this_thread::sleep_for(std::chrono::seconds(1)); } diff --git a/tutorials/data_persistence/c++11/temperature_durable_subscriber.cxx b/tutorials/data_persistence/c++11/temperature_durable_subscriber.cxx index 0656fba2b..f87c0c528 100644 --- a/tutorials/data_persistence/c++11/temperature_durable_subscriber.cxx +++ b/tutorials/data_persistence/c++11/temperature_durable_subscriber.cxx @@ -51,8 +51,8 @@ void sensor_monitoring(std::string subscriber_name) uint64_t timestamp = sample.info().source_timestamp().to_millisecs(); - std::cout << sample.data().sensor_name() << ": " << std::fixed - << std::setprecision(2) << sample.data().degrees() + std::cout << sample.data().sensor_name << ": " << std::fixed + << std::setprecision(2) << sample.data().degrees << " degrees (" << timestamp / 1000.0 << "s)" << std::endl; }); diff --git a/tutorials/data_persistence/c++11/temperature_publisher.cxx b/tutorials/data_persistence/c++11/temperature_publisher.cxx index 41ebb90e8..6b56c88d9 100644 --- a/tutorials/data_persistence/c++11/temperature_publisher.cxx +++ b/tutorials/data_persistence/c++11/temperature_publisher.cxx @@ -22,9 +22,9 @@ void publish_temperature(const std::string &sensor_name) dds::pub::DataWriter writer(topic); Temperature temp_reading; - temp_reading.sensor_name(sensor_name); + temp_reading.sensor_name = sensor_name; for (int i = 0; i < 1000; i++) { - temp_reading.degrees((rand() % 10) + 30); + temp_reading.degrees = (rand() % 10) + 30; writer.write(temp_reading); std::this_thread::sleep_for(std::chrono::seconds(1)); } diff --git a/tutorials/data_persistence/c++11/temperature_subscriber.cxx b/tutorials/data_persistence/c++11/temperature_subscriber.cxx index 7c582fd95..fb8fe02dc 100644 --- a/tutorials/data_persistence/c++11/temperature_subscriber.cxx +++ b/tutorials/data_persistence/c++11/temperature_subscriber.cxx @@ -35,8 +35,8 @@ int main(int argc, char **argv) uint64_t timestamp = sample.info().source_timestamp().to_millisecs(); - std::cout << sample.data().sensor_name() << ": " << std::fixed - << std::setprecision(2) << sample.data().degrees() + std::cout << sample.data().sensor_name << ": " << std::fixed + << std::setprecision(2) << sample.data().degrees << " degrees (" << timestamp / 1000.0 << "s)" << std::endl; }); diff --git a/tutorials/discovery/c++11/README.md b/tutorials/discovery/c++11/README.md index d3a340a21..5f42b7437 100644 --- a/tutorials/discovery/c++11/README.md +++ b/tutorials/discovery/c++11/README.md @@ -53,3 +53,20 @@ cd build ./home_automation_publisher ... ``` + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/tutorials/discovery/c++11/home_automation_publisher.cxx b/tutorials/discovery/c++11/home_automation_publisher.cxx index 59868e7ac..e906c9202 100644 --- a/tutorials/discovery/c++11/home_automation_publisher.cxx +++ b/tutorials/discovery/c++11/home_automation_publisher.cxx @@ -29,7 +29,7 @@ void publish_sensor( DeviceStatus device_status { sensor_name, room_name, false }; for (int i = 0; i < 15; i++) { - device_status.is_open(!device_status.is_open()); + device_status.is_open = !device_status.is_open; writer.write(device_status); std::this_thread::sleep_for(std::chrono::seconds(2)); } diff --git a/tutorials/discovery/c++11/home_automation_subscriber.cxx b/tutorials/discovery/c++11/home_automation_subscriber.cxx index 3e1ee66f7..c7ab47e7e 100644 --- a/tutorials/discovery/c++11/home_automation_subscriber.cxx +++ b/tutorials/discovery/c++11/home_automation_subscriber.cxx @@ -63,9 +63,9 @@ int main(int argc, char **argv) [](const rti::sub::LoanedSample &sample) { if (sample.info().valid()) { // ignore samples with only // meta-data - if (sample.data().is_open()) { - std::cout << "WARNING: " << sample.data().sensor_name() - << " in " << sample.data().room_name() + if (sample.data().is_open) { + std::cout << "WARNING: " << sample.data().sensor_name + << " in " << sample.data().room_name << " is open!" << std::endl; } } diff --git a/tutorials/distributed_data_cache/c++11/README.md b/tutorials/distributed_data_cache/c++11/README.md index 20c079146..703a04948 100644 --- a/tutorials/distributed_data_cache/c++11/README.md +++ b/tutorials/distributed_data_cache/c++11/README.md @@ -48,3 +48,20 @@ cmake --build . --config Release|Debug ## Running the Example :rocket: See the tutorial for instructions. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/tutorials/distributed_data_cache/c++11/home_automation_publisher.cxx b/tutorials/distributed_data_cache/c++11/home_automation_publisher.cxx index 5966059d1..f11afe332 100644 --- a/tutorials/distributed_data_cache/c++11/home_automation_publisher.cxx +++ b/tutorials/distributed_data_cache/c++11/home_automation_publisher.cxx @@ -25,7 +25,7 @@ void publish_sensor( DeviceStatus device_status(sensor_name, room_name, false); for (int i = 0; i < 1000; i++) { // Simulate the door/window opening and closing - device_status.is_open(!device_status.is_open()); + device_status.is_open = !device_status.is_open; writer.write(device_status); std::this_thread::sleep_for(std::chrono::seconds(2)); } diff --git a/tutorials/distributed_data_cache/c++11/home_automation_subscriber.cxx b/tutorials/distributed_data_cache/c++11/home_automation_subscriber.cxx index be1551d24..e3b658f7d 100644 --- a/tutorials/distributed_data_cache/c++11/home_automation_subscriber.cxx +++ b/tutorials/distributed_data_cache/c++11/home_automation_subscriber.cxx @@ -106,6 +106,6 @@ int main(int argc, char **argv) for (auto sample : samples) { reader.key_value(key_holder, sample.info().instance_handle()); - std::cout << key_holder.sensor_name() << std::endl; + std::cout << key_holder.sensor_name << std::endl; } } diff --git a/tutorials/distributed_data_cache/c++11/interactive_sensor_publisher.cxx b/tutorials/distributed_data_cache/c++11/interactive_sensor_publisher.cxx index 5bc31cfe1..0b7a3c70a 100644 --- a/tutorials/distributed_data_cache/c++11/interactive_sensor_publisher.cxx +++ b/tutorials/distributed_data_cache/c++11/interactive_sensor_publisher.cxx @@ -33,14 +33,14 @@ class WindowSensor { void open_window() { std::cout << "Opening the window..." << std::endl; - status_.is_open(true); + status_.is_open = true; writer_->write(status_, instance_); } void close_window() { std::cout << "Closing the window..." << std::endl; - status_.is_open(false); + status_.is_open = false; writer_->write(status_, instance_); } diff --git a/tutorials/distributed_data_cache/c++11/interactive_sensor_subscriber.cxx b/tutorials/distributed_data_cache/c++11/interactive_sensor_subscriber.cxx index 92cf14077..37db0fb48 100644 --- a/tutorials/distributed_data_cache/c++11/interactive_sensor_subscriber.cxx +++ b/tutorials/distributed_data_cache/c++11/interactive_sensor_subscriber.cxx @@ -36,7 +36,7 @@ int main(int argc, char **argv) for (auto sample : samples) { DeviceStatus key_holder; reader.key_value(key_holder, sample.info().instance_handle()); - disposed_instances.insert(key_holder.sensor_name()); + disposed_instances.insert(key_holder.sensor_name); } std::cout << "Disposed instances: " << std::endl; diff --git a/tutorials/last_value_cache/c++11/README.md b/tutorials/last_value_cache/c++11/README.md index d305232d1..76ed4b5c2 100644 --- a/tutorials/last_value_cache/c++11/README.md +++ b/tutorials/last_value_cache/c++11/README.md @@ -48,3 +48,20 @@ cmake --build . --config Release|Debug ## Running the Example :rocket: See the tutorial for instructions. + + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/tutorials/last_value_cache/c++11/home_automation_publisher.cxx b/tutorials/last_value_cache/c++11/home_automation_publisher.cxx index 47f539ac7..61007e464 100644 --- a/tutorials/last_value_cache/c++11/home_automation_publisher.cxx +++ b/tutorials/last_value_cache/c++11/home_automation_publisher.cxx @@ -25,9 +25,9 @@ void publish_sensor( DeviceStatus device_status { sensor_name, room_name, false }; for (int i = 0; i < 1000; i++) { - device_status.is_open(!device_status.is_open()); + device_status.is_open = !device_status.is_open; std::cout << sensor_name << " is now: " - << (device_status.is_open() ? "open" : "closed") << std::endl; + << (device_status.is_open ? "open" : "closed") << std::endl; writer.write(device_status); std::this_thread::sleep_for(std::chrono::seconds(10)); } diff --git a/tutorials/last_value_cache/c++11/home_automation_subscriber.cxx b/tutorials/last_value_cache/c++11/home_automation_subscriber.cxx index 89a13559c..88bb88d33 100644 --- a/tutorials/last_value_cache/c++11/home_automation_subscriber.cxx +++ b/tutorials/last_value_cache/c++11/home_automation_subscriber.cxx @@ -29,13 +29,13 @@ int main(int argc, char **argv) [](const rti::sub::LoanedSample &sample) { if (sample.info().valid()) { // ignore samples with only // meta-data - if (sample.data().is_open()) { - std::cout << "WARNING: " << sample.data().sensor_name() - << " in " << sample.data().room_name() + if (sample.data().is_open) { + std::cout << "WARNING: " << sample.data().sensor_name + << " in " << sample.data().room_name << " is open!" << std::endl; } else { - std::cout << "INFO: " << sample.data().sensor_name() - << " in " << sample.data().room_name() + std::cout << "INFO: " << sample.data().sensor_name + << " in " << sample.data().room_name << " is closed." << std::endl; } } diff --git a/tutorials/publish_subscribe/c++11/README.md b/tutorials/publish_subscribe/c++11/README.md index 0ef4325ea..f388b2665 100644 --- a/tutorials/publish_subscribe/c++11/README.md +++ b/tutorials/publish_subscribe/c++11/README.md @@ -54,3 +54,19 @@ cd build ./home_automation_publisher ... ``` + +## Troubleshooting + +### Compilation fails accessing struct field + +If the code compilation fails with errors such as "reference to non-static member +function must be called" for code such as `my_sample.my_field = value` or +`value = my_sample.my_field` this means that the rtiddsgen version you are using +doesn't have the IDL4 C++ mapping enabled by default. + +To fix it, upgrade your Connext version to 7.6+ or check out the branch for the +Connext version you're using, e.g. + +```sh +git checkout release/7.3.0 +``` diff --git a/tutorials/publish_subscribe/c++11/home_alerts.cxx b/tutorials/publish_subscribe/c++11/home_alerts.cxx index 72daec350..2ab90f1b7 100644 --- a/tutorials/publish_subscribe/c++11/home_alerts.cxx +++ b/tutorials/publish_subscribe/c++11/home_alerts.cxx @@ -34,14 +34,14 @@ int main(int argc, char **argv) status_reader, [alert_writer](const rti::sub::LoanedSample &sample) mutable { - if (!sample.info().valid() || !sample.data().is_open()) { + if (!sample.info().valid() || !sample.data().is_open) { return; } alert_writer.write( KeyedString( - sample.data().sensor_name(), - "Window in " + sample.data().room_name() + sample.data().sensor_name, + "Window in " + sample.data().room_name + " was just opened"), sample.info().source_timestamp()); }); diff --git a/tutorials/publish_subscribe/c++11/home_automation_publisher.cxx b/tutorials/publish_subscribe/c++11/home_automation_publisher.cxx index 024acd5db..84a1306fc 100644 --- a/tutorials/publish_subscribe/c++11/home_automation_publisher.cxx +++ b/tutorials/publish_subscribe/c++11/home_automation_publisher.cxx @@ -25,7 +25,7 @@ void publish_sensor( DeviceStatus device_status { sensor_name, room_name, false }; for (int i = 0; i < 1000; i++) { - device_status.is_open(!device_status.is_open()); + device_status.is_open = !device_status.is_open; writer.write(device_status); std::this_thread::sleep_for(std::chrono::seconds(2)); } diff --git a/tutorials/publish_subscribe/c++11/home_automation_subscriber.cxx b/tutorials/publish_subscribe/c++11/home_automation_subscriber.cxx index 6fbc359f1..43dabef08 100644 --- a/tutorials/publish_subscribe/c++11/home_automation_subscriber.cxx +++ b/tutorials/publish_subscribe/c++11/home_automation_subscriber.cxx @@ -29,9 +29,9 @@ int main(int argc, char **argv) [](const rti::sub::LoanedSample &sample) { if (sample.info().valid()) { // ignore samples with only // meta-data - if (sample.data().is_open()) { - std::cout << "WARNING: " << sample.data().sensor_name() - << " in " << sample.data().room_name() + if (sample.data().is_open) { + std::cout << "WARNING: " << sample.data().sensor_name + << " in " << sample.data().room_name << " is open!" << std::endl; } } diff --git a/tutorials/publish_subscribe/c++11/home_automation_subscriber_with_timestamp.cxx b/tutorials/publish_subscribe/c++11/home_automation_subscriber_with_timestamp.cxx index 773ec2ae2..2b7c115b3 100644 --- a/tutorials/publish_subscribe/c++11/home_automation_subscriber_with_timestamp.cxx +++ b/tutorials/publish_subscribe/c++11/home_automation_subscriber_with_timestamp.cxx @@ -32,11 +32,11 @@ int main(int argc, char **argv) return; } - if (sample.data().is_open()) { + if (sample.data().is_open) { uint64_t timestamp = sample.info().source_timestamp().to_millisecs(); - std::cout << "WARNING: " << sample.data().sensor_name() - << " in " << sample.data().room_name() + std::cout << "WARNING: " << sample.data().sensor_name + << " in " << sample.data().room_name << " is open " << "(" << std::fixed << std::setprecision(2) << timestamp / 1000.0 << "s)" << std::endl;