The unmodified publication example generated by rtiddsgen using the C++11 option for the -language flag.
#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[])
{
using namespace application;
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;
}
<<value-type>> Represents a time interval
Definition: Duration.hpp:44
<<reference-type>> Container for all dds::core::Entity objects.
Definition: TDomainParticipant.hpp:63
static void finalize_participant_factory()
Finalize the DomainParticipantFactory.
Definition: TDomainParticipant.hpp:392
<<reference-type>> Allows an application to publish data for a dds::topic::Topic
Definition: TDataWriter.hpp:58
void write(const T &instance_data)
Modifies the value of a data instance.
Definition: TDataWriter.hpp:222
<<reference-type>> A publisher is the object responsible for the actual dissemination of publications...
Definition: TPublisher.hpp:52
int32_t domain_id() const
<<extension>> Get the domain ID associated with the discovered dds::domain::DomainParticipant.
Definition: BuiltinTopicImpl.hpp:245
<<reference-type>> Topic is the most basic description of the data to be published and subscribed.
Definition: TTopic.hpp:55
static Logger & instance()
Get the singleton instance of this type.
Definition: Logger.hpp:437
Verbosity verbosity()
Get the verbosity at which RTI Connext is currently logging diagnostic information.
void sleep(const dds::core::Duration &durationIn)
Blocks the calling thread for the specified duration.