SlideShare a Scribd company logo
1 of 17
Download to read offline
DDS Programming
using
IDL to C++11
Overview
This tutorial shows how the famous DDS shapes
example can be implemented using the IDL to C++11
language mapping
It assumes basic understanding of IDL and DDS
For more information take a look at our website
www.remedy.nl
Copyright © Remedy IT2
Problems with IDL to C++
The IDL to C++ language mapping is from the 90’s
IDL to C++ could not depend on various C++
features as
• C++ namespace
• C++ exceptions
• Standard Template Library
As a result
• Mapping is hard to use correctly
• Uses its own constructs for everything
Copyright © Remedy IT3
Why a new language
mapping?
IDL to C++ language mapping is impossible to
change because
• Multiple implementations are on the market (open
source and commercial)
• A huge amount of applications have been developed
An updated IDL to C++ language mapping would
force all vendors and users to update their products
The standardization of a new C++ revision in 2011
(ISO/IEC 14882:2011, called C++11) gives the
opportunity to define a new language mapping
• C++11 features are not backward compatible with
C++03 or C++99
• A new C++11 mapping leaves the existing mapping
intact Copyright © Remedy IT4
Goals
Simplify mapping for C++
Make use of the new C++11 features to
• Reduce amount of application code
• Reduce amount of possible errors made
• Gain runtime performance
• Speedup development and testing
Faster time to market
Reduced costs
Reduced training time
Copyright © Remedy IT5
OMG Specification
IDL to C++11 is now a formal OMG standard
IDL to C++11 v1.2 available from the OMG website
as formal/2015-08-01
Revision Task Force (RTF) is active to work on
issues reported
Copyright © Remedy IT6
More information IDL to C++11
For background, details, tutorials, and examples see
the following websites
• http://taox11.remedy.nl
• http://osportal.remedy.nl
• http://www.orbzone.org
Copyright © Remedy IT7
Shapes
Copyright © Remedy IT8
IDL Topic Type
In order to exchange data we define in IDL a DDS
Topic Type
Based on the IDL Topic Type the following will be
generated
• C++11 type representation
• C++11 type specific DDS API
Copyright © Remedy IT9
ShapeType
IDL definition
struct ShapeType {
string color; //@key
long x;
long y;
long shapesize;
};
Copyright © Remedy IT10
DDS::traits<>
For each IDL Topic Type a set of DDS traits will be
generated
The DDS traits enable access to all implied DDS
entities
Together with the IDL::traits<> we can easily write
C++11 applications that use DDS and have access to
the meta type information from IDL
Copyright © Remedy IT11
DDS::traits<> overview
The following DDS reference traits are used in our
tutorial
A reference behaves like a std::shared_ptr and
for each type also a weak_ref_type is available
Copyright © Remedy IT12
Reference trait Meaning
domainparticipant_ref_type Reference to the DDS DomainParticipant
topic_ref_type Reference to the DDS Topic
publisher_ref_type Reference to the DDS Publisher
datawriter_ref_type Reference to the DDS DataWriter
typed_datawriter_ref_type Reference to the DDS Topic Type DataWriter
subscriber_ref_type Reference to the DDS Subscriber
datareader_ref_type Reference to the DDS DataReader
typed_datareader_ref_type Reference to the DDS Topic Type DataReader
Sender implementation (1)
// Create all DDS entities, if something fails we just return
DDS::ReturnCode_t retcode {DDS::RETCODE_OK};
// Create a domain participant for domain 0 with default QoS
DDS::traits<ShapeType>::domainparticipant_ref_type domain_participant =
DDS::traits<DDS::DomainParticipantFactory>::get_instance ()->create_participant (
0, DDS::PARTICIPANT_QOS_DEFAULT, nullptr, 0);
if (retcode != DDS::RETCODE_OK) return;
// Create a topic with default QoS
DDS::traits<ShapeType>::topic_ref_type topic = domain_participant->create_topic (
"Square", DDS::traits<ShapeType>::get_type_name (), DDS::TOPIC_QOS_DEFAULT, nullptr, 0);
// Create a publisher with default QoS
DDS::traits<ShapeType>::publisher_ref_type publisher =
domain_participant->create_publisher (DDS::PUBLISHER_QOS_DEFAULT, nullptr, 0);
// When we have a publisher and topic we create a datawriter with default QoS
if (publisher && topic) {
DDS::traits<ShapeType>::datawriter_ref_type dw =
publisher->create_datawriter (topic, DDS::DATAWRITER_QOS_DEFAULT, nullptr, 0);
// Narrow the base datawriter to a topic type specific datawriter
DDS::traits<ShapeType>::typed_datawriter_ref_type shape_dw =
DDS::traits<ShapeType>::narrow (dw);
}
Copyright © Remedy IT13
Sender implementation (2)
// When we have a topic type specific datawriter we register an instance to DDS and write data
if (shape_dw) {
ShapeType square {"GREEN", 10, 10, 25};
DDS::InstanceHandle_t instance_handle = shape_dw->register_instance (square);
// Write 100 samples
for (uint32_t i = 0; i < 100; ++i) {
shape_dw->write (square, instance_handle);
std::cout << "Written sample " << square << std::endl;
++square.x(); ++square.y();
std::chrono::milliseconds sleep_time (2000);
std::this_thread::sleep_for (sleep_time);
}
std::cout << std::endl << "Written 100 samples. Last sample: " << square << std::endl;
// Unregister the instance from DDS
shape_dw->unregister_instance (square, instance_handle);
}
Copyright © Remedy IT14
Receiver implementation (1)
// DDS Listener implementation that receives the samples and prints them on the console
class ShapeTypeListener final : public DDS::traits<ShapeType>::datareaderlistener_type {
public:
void ShapeTypeListener::on_data_available (DDS::traits<ShapeType>::datareader_ref_type the_reader) {
DDS::traits<ShapeType>::typed_datareader_ref_type rd =
DDS::traits<ShapeType>::narrow (the_reader);
ShapeType shape;
DDS::SampleInfo info;
for(;;) {
DDS::ReturnCode_t retcode = rd->take_next_sample(shape, info);
if (retcode == DDS::RETCODE_NO_DATA) {
/* No more samples */
break;
} else if (retcode != DDS::RETCODE_OK) {
std::cerr << "Unable to take data from data reader, error “ << retcode << std::endl;
return;
} else if (info.valid_data ()) {
std::cout << "Received <" << ++received_ << ">: " << shape << std::endl;
}
}
// Left other operations out of this class for simplicity
}
Copyright © Remedy IT15
Receiver implementation (2)
// Code that is placed in main
// Create all DDS entities, if something fails we just return
DDS::ReturnCode_t retcode {DDS::RETCODE_OK};
DDS::traits<ShapeType>::domainparticipant_ref_type domain_participant =
DDS::traits< DDS::DomainParticipantFactory >::get_instance ()->create_participant (
0, DDS::PARTICIPANT_QOS_DEFAULT, nullptr, 0);
retcode = DDS::traits<ShapeType>::register_type (domain_participant, "ShapeType");
if (retcode != DDS::RETCODE_OK) return 1;
DDS::traits<ShapeType>::topic_ref_type topic = domain_participant->create_topic (
"Square", DDS::traits<ShapeType>::get_type_name (), DDS::TOPIC_QOS_DEFAULT, nullptr, 0);
DDS::traits<ShapeType>::subscriber_ref_type subscriber =
domain_participant->create_subscriber (DDS::SUBSCRIBER_QOS_DEFAULT, nullptr, 0);
if (topic && subscriber) {
DDS::traits<ShapeType>::datareaderlistener_ref_type listener =
DDS::make_reference<ShapeTypeListener>();
// Create datareader with an instance of the listener
subscriber->create_datareader (topic, DDS::DATAREADER_QOS_DEFAULT, listener,
DDS::DATA_AVAILABLE_STATUS);
// Run the main thread in a loop, give control to a framework, ..
// DDS will do a callback on its own thread
Copyright © Remedy IT16
Contact
Copyright © Remedy IT17
Remedy IT
Postbus 81
6930 AB Westervoort
The Netherlands
tel.: +31(0)88 – 053 0000
e-mail: sales@remedy.nl
website: www.remedy.nl
Twitter: @RemedyIT
Slideshare: RemedyIT
Subscribe to our mailing list

More Related Content

What's hot (20)

Chapter10
Chapter10Chapter10
Chapter10
 
C O R B A Unit 4
C O R B A    Unit 4C O R B A    Unit 4
C O R B A Unit 4
 
COM
COMCOM
COM
 
Corba by Example
Corba by ExampleCorba by Example
Corba by Example
 
IDL to C++11 OMG RTWS presentations
IDL to C++11 OMG RTWS presentationsIDL to C++11 OMG RTWS presentations
IDL to C++11 OMG RTWS presentations
 
D1 from interfaces to solid
D1 from interfaces to solidD1 from interfaces to solid
D1 from interfaces to solid
 
Lecture4 corba
Lecture4   corbaLecture4   corba
Lecture4 corba
 
Oracle goldengate ogg
Oracle goldengate oggOracle goldengate ogg
Oracle goldengate ogg
 
Chapter 17 corba
Chapter 17 corbaChapter 17 corba
Chapter 17 corba
 
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
Unit 10: XML and Beyond (Sematic Web, Web Services, ...)
 
Distributed objects & components of corba
Distributed objects & components of corbaDistributed objects & components of corba
Distributed objects & components of corba
 
Common Object Request Broker Architecture
Common Object Request Broker ArchitectureCommon Object Request Broker Architecture
Common Object Request Broker Architecture
 
Distributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMIDistributed Objects: CORBA/Java RMI
Distributed Objects: CORBA/Java RMI
 
85305524 i-t-case-study
85305524 i-t-case-study85305524 i-t-case-study
85305524 i-t-case-study
 
Boogie 2011 Hi-Lite
Boogie 2011 Hi-LiteBoogie 2011 Hi-Lite
Boogie 2011 Hi-Lite
 
Rmi, corba and java beans
Rmi, corba and java beansRmi, corba and java beans
Rmi, corba and java beans
 
CORBA - Introduction and Details
CORBA - Introduction and DetailsCORBA - Introduction and Details
CORBA - Introduction and Details
 
CORBA
CORBACORBA
CORBA
 
CORBA Basic and Deployment of CORBA
CORBA Basic and Deployment of CORBACORBA Basic and Deployment of CORBA
CORBA Basic and Deployment of CORBA
 
Corba introduction and simple example
Corba introduction and simple example Corba introduction and simple example
Corba introduction and simple example
 

Similar to DDS Programming with IDL to C++11 tutorial

Integrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approachIntegrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approachRemedy IT
 
Integrating DDS into AXCIOMA - The Component Approach
Integrating DDS into AXCIOMA - The Component ApproachIntegrating DDS into AXCIOMA - The Component Approach
Integrating DDS into AXCIOMA - The Component ApproachReal-Time Innovations (RTI)
 
Integrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approachIntegrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approachRemedy IT
 
CORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialCORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialRemedy IT
 
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDS
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDSOverloading in Overdrive: A Generic Data-Centric Messaging Library for DDS
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDSSumant Tambe
 
Model Driven, Component Based Development for CBDDS and IDL to C++11
Model Driven, Component Based Development for CBDDS and IDL to C++11Model Driven, Component Based Development for CBDDS and IDL to C++11
Model Driven, Component Based Development for CBDDS and IDL to C++11Remedy IT
 
Extensible and Dynamic Topic Types For DDS (out of date)
Extensible and Dynamic Topic Types For DDS (out of date)Extensible and Dynamic Topic Types For DDS (out of date)
Extensible and Dynamic Topic Types For DDS (out of date)Rick Warren
 
DDS-PSM-Cxx and simd-cxx
DDS-PSM-Cxx and simd-cxxDDS-PSM-Cxx and simd-cxx
DDS-PSM-Cxx and simd-cxxAngelo Corsaro
 
DFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber DefenseDFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber DefenseMike Beckerle
 
RedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis codeRedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis codeRedis Labs
 
Reactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and RxReactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and RxSumant Tambe
 
Jason Olson - IBM i DB2 Modernization to SQL
Jason Olson - IBM i DB2 Modernization to SQLJason Olson - IBM i DB2 Modernization to SQL
Jason Olson - IBM i DB2 Modernization to SQLJohn Zozzaro
 
Вениамин Гвоздиков: Особенности использования DTrace
Вениамин Гвоздиков: Особенности использования DTrace Вениамин Гвоздиков: Особенности использования DTrace
Вениамин Гвоздиков: Особенности использования DTrace Yandex
 
Diagnose RIDPool Failures
Diagnose RIDPool FailuresDiagnose RIDPool Failures
Diagnose RIDPool FailuresCuneyt Goksu
 
RDBMS to NoSQL: Practical Advice from Successful Migrations
RDBMS to NoSQL: Practical Advice from Successful MigrationsRDBMS to NoSQL: Practical Advice from Successful Migrations
RDBMS to NoSQL: Practical Advice from Successful MigrationsScyllaDB
 

Similar to DDS Programming with IDL to C++11 tutorial (20)

Integrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approachIntegrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approach
 
Integrating DDS into AXCIOMA - The Component Approach
Integrating DDS into AXCIOMA - The Component ApproachIntegrating DDS into AXCIOMA - The Component Approach
Integrating DDS into AXCIOMA - The Component Approach
 
Integrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approachIntegrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approach
 
CORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorialCORBA Programming with TAOX11/C++11 tutorial
CORBA Programming with TAOX11/C++11 tutorial
 
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDS
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDSOverloading in Overdrive: A Generic Data-Centric Messaging Library for DDS
Overloading in Overdrive: A Generic Data-Centric Messaging Library for DDS
 
Model Driven, Component Based Development for CBDDS and IDL to C++11
Model Driven, Component Based Development for CBDDS and IDL to C++11Model Driven, Component Based Development for CBDDS and IDL to C++11
Model Driven, Component Based Development for CBDDS and IDL to C++11
 
Extensible and Dynamic Topic Types For DDS (out of date)
Extensible and Dynamic Topic Types For DDS (out of date)Extensible and Dynamic Topic Types For DDS (out of date)
Extensible and Dynamic Topic Types For DDS (out of date)
 
DDS-PSM-Cxx and simd-cxx
DDS-PSM-Cxx and simd-cxxDDS-PSM-Cxx and simd-cxx
DDS-PSM-Cxx and simd-cxx
 
DFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber DefenseDFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
 
SimD
SimDSimD
SimD
 
RedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis codeRedisConf18 - Writing modular & encapsulated Redis code
RedisConf18 - Writing modular & encapsulated Redis code
 
Cdi implementation
Cdi implementationCdi implementation
Cdi implementation
 
Reactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and RxReactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and Rx
 
Jason Olson - IBM i DB2 Modernization to SQL
Jason Olson - IBM i DB2 Modernization to SQLJason Olson - IBM i DB2 Modernization to SQL
Jason Olson - IBM i DB2 Modernization to SQL
 
NetCDF and HDF5
NetCDF and HDF5NetCDF and HDF5
NetCDF and HDF5
 
Вениамин Гвоздиков: Особенности использования DTrace
Вениамин Гвоздиков: Особенности использования DTrace Вениамин Гвоздиков: Особенности использования DTrace
Вениамин Гвоздиков: Особенности использования DTrace
 
Diagnose RIDPool Failures
Diagnose RIDPool FailuresDiagnose RIDPool Failures
Diagnose RIDPool Failures
 
5c8605.ado.net
5c8605.ado.net5c8605.ado.net
5c8605.ado.net
 
W8/WP8 App Dev for SAP, Part 1A: Service Development with NetWeaver Gateway S...
W8/WP8 App Dev for SAP, Part 1A: Service Development with NetWeaver Gateway S...W8/WP8 App Dev for SAP, Part 1A: Service Development with NetWeaver Gateway S...
W8/WP8 App Dev for SAP, Part 1A: Service Development with NetWeaver Gateway S...
 
RDBMS to NoSQL: Practical Advice from Successful Migrations
RDBMS to NoSQL: Practical Advice from Successful MigrationsRDBMS to NoSQL: Practical Advice from Successful Migrations
RDBMS to NoSQL: Practical Advice from Successful Migrations
 

More from Remedy IT

AXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systemsAXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systemsRemedy IT
 
AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...Remedy IT
 
Remedy IT Company presentation
Remedy IT Company presentationRemedy IT Company presentation
Remedy IT Company presentationRemedy IT
 
Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Remedy IT
 
Modernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsModernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsRemedy IT
 
AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...Remedy IT
 
Modernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsModernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsRemedy IT
 
ACE/TAO/CIAO/DAnCE Maintenance overview
ACE/TAO/CIAO/DAnCE Maintenance overviewACE/TAO/CIAO/DAnCE Maintenance overview
ACE/TAO/CIAO/DAnCE Maintenance overviewRemedy IT
 
Remedy IT Revised Submission Presentation for the Unified Component Model (UC...
Remedy IT Revised Submission Presentation for the Unified Component Model (UC...Remedy IT Revised Submission Presentation for the Unified Component Model (UC...
Remedy IT Revised Submission Presentation for the Unified Component Model (UC...Remedy IT
 
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...Remedy IT
 
AXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systemsAXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systemsRemedy IT
 
Component Technologies for Fractionated Satellites
Component Technologies for Fractionated SatellitesComponent Technologies for Fractionated Satellites
Component Technologies for Fractionated SatellitesRemedy IT
 
UCM Initial Submission presentation
UCM Initial Submission presentationUCM Initial Submission presentation
UCM Initial Submission presentationRemedy IT
 
Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...
Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...
Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...Remedy IT
 
Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...
Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...
Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...Remedy IT
 
Request For Proposal Unified Component Model for Distributed, Real-Time and E...
Request For Proposal Unified Component Model for Distributed, Real-Time and E...Request For Proposal Unified Component Model for Distributed, Real-Time and E...
Request For Proposal Unified Component Model for Distributed, Real-Time and E...Remedy IT
 
Test What Matters Most
Test What Matters MostTest What Matters Most
Test What Matters MostRemedy IT
 
IDL to C++03 RFC
IDL to C++03 RFCIDL to C++03 RFC
IDL to C++03 RFCRemedy IT
 
F6COM: A Case Study in Extending Container Services through Connectors
F6COM: A Case Study in Extending Container Services through ConnectorsF6COM: A Case Study in Extending Container Services through Connectors
F6COM: A Case Study in Extending Container Services through ConnectorsRemedy IT
 
AMI4CCM, custom DDS connectors, and IDL to C++11
AMI4CCM, custom DDS connectors, and IDL to C++11AMI4CCM, custom DDS connectors, and IDL to C++11
AMI4CCM, custom DDS connectors, and IDL to C++11Remedy IT
 

More from Remedy IT (20)

AXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systemsAXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systems
 
AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...
 
Remedy IT Company presentation
Remedy IT Company presentationRemedy IT Company presentation
Remedy IT Company presentation
 
Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11Comparing IDL to C++ with IDL to C++11
Comparing IDL to C++ with IDL to C++11
 
Modernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsModernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standards
 
AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...AXCIOMA, the internals, the component framework for distributed, real-time, a...
AXCIOMA, the internals, the component framework for distributed, real-time, a...
 
Modernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standardsModernizing SCA through new Object Management Group (OMG) standards
Modernizing SCA through new Object Management Group (OMG) standards
 
ACE/TAO/CIAO/DAnCE Maintenance overview
ACE/TAO/CIAO/DAnCE Maintenance overviewACE/TAO/CIAO/DAnCE Maintenance overview
ACE/TAO/CIAO/DAnCE Maintenance overview
 
Remedy IT Revised Submission Presentation for the Unified Component Model (UC...
Remedy IT Revised Submission Presentation for the Unified Component Model (UC...Remedy IT Revised Submission Presentation for the Unified Component Model (UC...
Remedy IT Revised Submission Presentation for the Unified Component Model (UC...
 
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
 
AXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systemsAXCIOMA, the component framework for distributed, real-time and embedded systems
AXCIOMA, the component framework for distributed, real-time and embedded systems
 
Component Technologies for Fractionated Satellites
Component Technologies for Fractionated SatellitesComponent Technologies for Fractionated Satellites
Component Technologies for Fractionated Satellites
 
UCM Initial Submission presentation
UCM Initial Submission presentationUCM Initial Submission presentation
UCM Initial Submission presentation
 
Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...
Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...
Remedy IT Initial Submission for the Unified Component Model (UCM) for Distri...
 
Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...
Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...
Unified Component Model for Distributed, Real- Time and Embedded Systems Requ...
 
Request For Proposal Unified Component Model for Distributed, Real-Time and E...
Request For Proposal Unified Component Model for Distributed, Real-Time and E...Request For Proposal Unified Component Model for Distributed, Real-Time and E...
Request For Proposal Unified Component Model for Distributed, Real-Time and E...
 
Test What Matters Most
Test What Matters MostTest What Matters Most
Test What Matters Most
 
IDL to C++03 RFC
IDL to C++03 RFCIDL to C++03 RFC
IDL to C++03 RFC
 
F6COM: A Case Study in Extending Container Services through Connectors
F6COM: A Case Study in Extending Container Services through ConnectorsF6COM: A Case Study in Extending Container Services through Connectors
F6COM: A Case Study in Extending Container Services through Connectors
 
AMI4CCM, custom DDS connectors, and IDL to C++11
AMI4CCM, custom DDS connectors, and IDL to C++11AMI4CCM, custom DDS connectors, and IDL to C++11
AMI4CCM, custom DDS connectors, and IDL to C++11
 

Recently uploaded

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

DDS Programming with IDL to C++11 tutorial

  • 2. Overview This tutorial shows how the famous DDS shapes example can be implemented using the IDL to C++11 language mapping It assumes basic understanding of IDL and DDS For more information take a look at our website www.remedy.nl Copyright © Remedy IT2
  • 3. Problems with IDL to C++ The IDL to C++ language mapping is from the 90’s IDL to C++ could not depend on various C++ features as • C++ namespace • C++ exceptions • Standard Template Library As a result • Mapping is hard to use correctly • Uses its own constructs for everything Copyright © Remedy IT3
  • 4. Why a new language mapping? IDL to C++ language mapping is impossible to change because • Multiple implementations are on the market (open source and commercial) • A huge amount of applications have been developed An updated IDL to C++ language mapping would force all vendors and users to update their products The standardization of a new C++ revision in 2011 (ISO/IEC 14882:2011, called C++11) gives the opportunity to define a new language mapping • C++11 features are not backward compatible with C++03 or C++99 • A new C++11 mapping leaves the existing mapping intact Copyright © Remedy IT4
  • 5. Goals Simplify mapping for C++ Make use of the new C++11 features to • Reduce amount of application code • Reduce amount of possible errors made • Gain runtime performance • Speedup development and testing Faster time to market Reduced costs Reduced training time Copyright © Remedy IT5
  • 6. OMG Specification IDL to C++11 is now a formal OMG standard IDL to C++11 v1.2 available from the OMG website as formal/2015-08-01 Revision Task Force (RTF) is active to work on issues reported Copyright © Remedy IT6
  • 7. More information IDL to C++11 For background, details, tutorials, and examples see the following websites • http://taox11.remedy.nl • http://osportal.remedy.nl • http://www.orbzone.org Copyright © Remedy IT7
  • 9. IDL Topic Type In order to exchange data we define in IDL a DDS Topic Type Based on the IDL Topic Type the following will be generated • C++11 type representation • C++11 type specific DDS API Copyright © Remedy IT9
  • 10. ShapeType IDL definition struct ShapeType { string color; //@key long x; long y; long shapesize; }; Copyright © Remedy IT10
  • 11. DDS::traits<> For each IDL Topic Type a set of DDS traits will be generated The DDS traits enable access to all implied DDS entities Together with the IDL::traits<> we can easily write C++11 applications that use DDS and have access to the meta type information from IDL Copyright © Remedy IT11
  • 12. DDS::traits<> overview The following DDS reference traits are used in our tutorial A reference behaves like a std::shared_ptr and for each type also a weak_ref_type is available Copyright © Remedy IT12 Reference trait Meaning domainparticipant_ref_type Reference to the DDS DomainParticipant topic_ref_type Reference to the DDS Topic publisher_ref_type Reference to the DDS Publisher datawriter_ref_type Reference to the DDS DataWriter typed_datawriter_ref_type Reference to the DDS Topic Type DataWriter subscriber_ref_type Reference to the DDS Subscriber datareader_ref_type Reference to the DDS DataReader typed_datareader_ref_type Reference to the DDS Topic Type DataReader
  • 13. Sender implementation (1) // Create all DDS entities, if something fails we just return DDS::ReturnCode_t retcode {DDS::RETCODE_OK}; // Create a domain participant for domain 0 with default QoS DDS::traits<ShapeType>::domainparticipant_ref_type domain_participant = DDS::traits<DDS::DomainParticipantFactory>::get_instance ()->create_participant ( 0, DDS::PARTICIPANT_QOS_DEFAULT, nullptr, 0); if (retcode != DDS::RETCODE_OK) return; // Create a topic with default QoS DDS::traits<ShapeType>::topic_ref_type topic = domain_participant->create_topic ( "Square", DDS::traits<ShapeType>::get_type_name (), DDS::TOPIC_QOS_DEFAULT, nullptr, 0); // Create a publisher with default QoS DDS::traits<ShapeType>::publisher_ref_type publisher = domain_participant->create_publisher (DDS::PUBLISHER_QOS_DEFAULT, nullptr, 0); // When we have a publisher and topic we create a datawriter with default QoS if (publisher && topic) { DDS::traits<ShapeType>::datawriter_ref_type dw = publisher->create_datawriter (topic, DDS::DATAWRITER_QOS_DEFAULT, nullptr, 0); // Narrow the base datawriter to a topic type specific datawriter DDS::traits<ShapeType>::typed_datawriter_ref_type shape_dw = DDS::traits<ShapeType>::narrow (dw); } Copyright © Remedy IT13
  • 14. Sender implementation (2) // When we have a topic type specific datawriter we register an instance to DDS and write data if (shape_dw) { ShapeType square {"GREEN", 10, 10, 25}; DDS::InstanceHandle_t instance_handle = shape_dw->register_instance (square); // Write 100 samples for (uint32_t i = 0; i < 100; ++i) { shape_dw->write (square, instance_handle); std::cout << "Written sample " << square << std::endl; ++square.x(); ++square.y(); std::chrono::milliseconds sleep_time (2000); std::this_thread::sleep_for (sleep_time); } std::cout << std::endl << "Written 100 samples. Last sample: " << square << std::endl; // Unregister the instance from DDS shape_dw->unregister_instance (square, instance_handle); } Copyright © Remedy IT14
  • 15. Receiver implementation (1) // DDS Listener implementation that receives the samples and prints them on the console class ShapeTypeListener final : public DDS::traits<ShapeType>::datareaderlistener_type { public: void ShapeTypeListener::on_data_available (DDS::traits<ShapeType>::datareader_ref_type the_reader) { DDS::traits<ShapeType>::typed_datareader_ref_type rd = DDS::traits<ShapeType>::narrow (the_reader); ShapeType shape; DDS::SampleInfo info; for(;;) { DDS::ReturnCode_t retcode = rd->take_next_sample(shape, info); if (retcode == DDS::RETCODE_NO_DATA) { /* No more samples */ break; } else if (retcode != DDS::RETCODE_OK) { std::cerr << "Unable to take data from data reader, error “ << retcode << std::endl; return; } else if (info.valid_data ()) { std::cout << "Received <" << ++received_ << ">: " << shape << std::endl; } } // Left other operations out of this class for simplicity } Copyright © Remedy IT15
  • 16. Receiver implementation (2) // Code that is placed in main // Create all DDS entities, if something fails we just return DDS::ReturnCode_t retcode {DDS::RETCODE_OK}; DDS::traits<ShapeType>::domainparticipant_ref_type domain_participant = DDS::traits< DDS::DomainParticipantFactory >::get_instance ()->create_participant ( 0, DDS::PARTICIPANT_QOS_DEFAULT, nullptr, 0); retcode = DDS::traits<ShapeType>::register_type (domain_participant, "ShapeType"); if (retcode != DDS::RETCODE_OK) return 1; DDS::traits<ShapeType>::topic_ref_type topic = domain_participant->create_topic ( "Square", DDS::traits<ShapeType>::get_type_name (), DDS::TOPIC_QOS_DEFAULT, nullptr, 0); DDS::traits<ShapeType>::subscriber_ref_type subscriber = domain_participant->create_subscriber (DDS::SUBSCRIBER_QOS_DEFAULT, nullptr, 0); if (topic && subscriber) { DDS::traits<ShapeType>::datareaderlistener_ref_type listener = DDS::make_reference<ShapeTypeListener>(); // Create datareader with an instance of the listener subscriber->create_datareader (topic, DDS::DATAREADER_QOS_DEFAULT, listener, DDS::DATA_AVAILABLE_STATUS); // Run the main thread in a loop, give control to a framework, .. // DDS will do a callback on its own thread Copyright © Remedy IT16
  • 17. Contact Copyright © Remedy IT17 Remedy IT Postbus 81 6930 AB Westervoort The Netherlands tel.: +31(0)88 – 053 0000 e-mail: sales@remedy.nl website: www.remedy.nl Twitter: @RemedyIT Slideshare: RemedyIT Subscribe to our mailing list