The unmodified publication example generated by rtiddsgen using the C++11 option for the -language flag.
- See also
- Publication Example
#include <iostream>
#include <dds/pub/ddspub.hpp>
#include <rti/util/util.hpp>
#include <rti/config/Logger.hpp>
#include "application.hpp"
#include "Foo.hpp"
void run_publisher_application(
unsigned int domain_id,
unsigned int sample_count)
{
MyOtherType data;
for (unsigned int samples_written = 0;
!application::shutdown_requested && samples_written < sample_count;
samples_written++) {
data.m1(static_cast<int32_t>(samples_written));
std::cout << "Writing MyOtherType, count " << samples_written << std::endl;
}
}
int main(int argc, char *argv[])
{
auto arguments = parse_arguments(argc, argv);
if (arguments.parse_result == ParseReturn::exit) {
return EXIT_SUCCESS;
} else if (arguments.parse_result == ParseReturn::failure) {
return EXIT_FAILURE;
}
setup_signal_handlers();
try {
run_publisher_application(arguments.domain_id, arguments.sample_count);
} catch (const std::exception& ex) {
std::cerr << "Exception in run_publisher_application(): " << ex.what()
<< std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}