DDS ISO C++ PSM
-
Upload
angelo-corsaro -
Category
Technology
-
view
1.470 -
download
6
description
Transcript of DDS ISO C++ PSM
![Page 1: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/1.jpg)
1
ISO C++ DDS PSM
Angelo CorsaroOMG DDS Co-Chair
Rick WarrenRTI
POC: Angelo Corsaro <[email protected]>
![Page 2: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/2.jpg)
Copyright 2010, PrismTech / RTI
Agenda
- Status Update
- Submission Scope
- API Overview
- Resource Management
- Code Example
- Type Mapping Example
- Next Steps
![Page 3: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/3.jpg)
Copyright 2010, PrismTech / RTI
Status Update
- Tuesday 20th Sept. 2010, after a “conclave” of 4+ hours PrismTech and RTI have resolved all open issues and points of divergence!
- This presentation provides a unified view of what the joint final submission will be.
![Page 4: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/4.jpg)
Copyright 2010, PrismTech / RTI
Agenda
- Status Update
- Submission Scope
- API Overview
- Resource Management
- Code Example
- Type Mapping Example
- Next Steps
![Page 5: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/5.jpg)
Copyright 2010, PrismTech / RTI
Submission Scope
The ISO C++ DDS PSM has the following scope:
- Full API for DCPS v1.2 PIM
- Full API for Extensible Topics
- ISO C++ mapping of DDS Type System (as defined in xtypes)
![Page 6: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/6.jpg)
Copyright 2010, PrismTech / RTI
Agenda
- Status Update
- Submission Scope
- API Overview
- Resource Management
- Code Example
- Type Mapping Example
- Next Steps
![Page 7: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/7.jpg)
Copyright 2010, PrismTech / RTI
Key Highlights
- Simple, safe, efficient, extensible and portable C++ API
- Well defined and safe resource management
- Use of C++ templates to ensure type safety and improve compile time error detection
- Consistent use of Standard C++ types and idioms, such as, std::string, std::vector, iterators, RAII Pattern, etc., throughout the API
![Page 8: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/8.jpg)
Copyright 2010, PrismTech / RTI
API Organization
dds
iddstdds
ANSI/ISO C++ PSM
Vendor Implementation for the DELEGATE layer
DELEGATE
Standard API instantiated from the parametrized API and the vendor implementation of the DELEGATE layer.
DDS type constructors.
![Page 9: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/9.jpg)
Copyright 2010, PrismTech / RTI
Agenda
- Status Update
- Submission Scope
- API Overview
- Resource Management
- Code Example
- Type Mapping Example
- Next Steps
![Page 10: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/10.jpg)
Copyright 2010, PrismTech / RTI
Resource Management- Principles
Safety: Never access uninitialized, freed, or undefined state
Determinism: Applications control when local and remote resources are allocated and released
Expressiveness: Maintain capabilities from PIM
![Page 11: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/11.jpg)
Copyright 2010, PrismTech / RTI
Resource Management
- Expression of principles differ for different kinds of types Reference types: Identity based on reference
• DDS Entities• Wait sets and conditions
Value types: Identity based on state• Entity QoS and QoS policies• Status• Time and duration
![Page 12: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/12.jpg)
Copyright 2010, PrismTech / RTI
Reference Type Usage- Access is through smart pointers, allocated by
factory methods. These: Provide null initialization Throw exception on access to “closed” object May automatically manage resources
- Examples: Null pointer:
• Publisher pub;• if (pub == dds::core::null) { … }
Initialization:• pub = dp.create_publisher();
Copying reference:• Publisher pub2 = pub1; —or— Publisher pub2(pub1);
// 2 references to same object Polymorphism & Down-Casting:
• Entity e = pub; // Publisher pub• Publisher pub = dds::core::polymorphic_cast<Publisher>(e);
![Page 13: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/13.jpg)
Copyright 2010, PrismTech / RTI
Reference Type Mgmt
- Reference types have close() method Disposes object and its contained objects
- Service may automatically close objects no longer in use “May” gives vendors flexibility to balance determinism,
convenience for their users Similar to resource management practice in JMS Common-sense rules:
• If I keep a reference to it, I intend to call it: still in use• If I set a listener, I want it to call me: still in use• If I call retain(): still in use
- Summary: Deterministic way to halt communication, reclaim resources Deterministic way to continue communication, maintain resources Flexibility for vendors
![Page 14: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/14.jpg)
Copyright 2010, PrismTech / RTI
Agenda
- Status Update
- Submission Scope
- API Overview
- Resource Management
- Type Mapping Example
- Code Example
- Next Steps
![Page 15: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/15.jpg)
Copyright 2010, PrismTech / RTI
DDS Types Mapping
- The ISO C++ API is independent from the specific mapping used for DDS Topic Types, as far as generated types have value semantics The ISO C++ API can be used with the existing
IDL2C++ type mapping, or It can be used with the ISO C++ mapping for
DDS Types as defined in the DDS-XTypes specification
![Page 16: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/16.jpg)
Copyright 2010, PrismTech / RTI
ISO C++ Mapping
-Main Characteristics Use of ISO C++ / StdLib types Full Attribute Encapsulation via accessors Container Safe
- Example... see next slide
![Page 17: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/17.jpg)
Copyright 2010, PrismTech / RTI
DDS Type Mapping
struct TelephoneNumber { string prefix; string number;};
DDS Topic Type ISO C++ Mappingclass TelephoneNumber {
public: TelephoneNumber();
explicit TelephoneNumber(const std::string& prefix,
const std::string& number);
virtual ~TelephoneNumber()public: const std::string& prefix() const; void prefix(const std::string& s); const std::string& number() const; void number(const std::string& s);
// State representation // is implementation dependent};
![Page 18: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/18.jpg)
Copyright 2010, PrismTech / RTI
DDS Type MappingDDS Topic Type
enum MarrialStatus { SINGLE, MARRIED, DIVORCED };
struct Person { long age; //@id(1) wstring name; MarrialStatus married; sequence<TelephoneNumber> tel; sequence<TelefoneNumber, 2> fax; double height; //@optional double weight; //@optional sequence<byte> photo; //@shared };
![Page 19: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/19.jpg)
enum MarrialStatus { SINGLE, MARRIED, DIVORCED };
struct Person { long age; //@id(1) wstring name; MarrialStatus married; sequence<TelephoneNumber> tel; sequence<TelefoneNumber, 2> fax; double height; //@optional double weight; //@optional sequence<byte> photo; //@shared };
Copyright 2010, PrismTech / RTI
DDS Type MappingDDS Topic Type
class Person {public: int32_t age() const; void age(int32_t i);};
ISO C++ Mapping
![Page 20: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/20.jpg)
enum MarrialStatus { SINGLE, MARRIED, DIVORCED };
struct Person { long age; //@id(1) wstring name; MarrialStatus married; sequence<TelephoneNumber> tel; sequence<TelefoneNumber, 2> fax; double height; //@optional double weight; //@optional sequence<byte> photo; //@shared };
Copyright 2010, PrismTech / RTI
DDS Type MappingDDS Topic Type
class Person {public: std::wstring name() const; void name(const std::wstring s);};
ISO C++ Mapping
![Page 21: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/21.jpg)
enum MarrialStatus { SINGLE, MARRIED, DIVORCED };
struct Person { long age; //@id(1) wstring name; MarrialStatus married; sequence<TelephoneNumber> tel; sequence<TelefoneNumber, 2> fax; double height; //@optional double weight; //@optional sequence<byte> photo; //@shared };
Copyright 2010, PrismTech / RTI
DDS Type MappingDDS Topic Type
class Person {public: const std::vector<TelephoneNumber>& tel() const; void tel(const std::vector<TelephoneNumber>& s);};
ISO C++ Mapping
![Page 22: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/22.jpg)
enum MarrialStatus { SINGLE, MARRIED, DIVORCED };
struct Person { long age; //@id(1) wstring name; MarrialStatus married; sequence<TelephoneNumber> tel; sequence<TelefoneNumber, 2> fax; double height; //@optional double weight; //@optional sequence<byte> photo; //@shared };
Copyright 2010, PrismTech / RTI
DDS Type MappingDDS Topic Type
class Person {public: const dds::core::optional<double>& height() const; void height(double d); void height(const dds::core::optional<double>& o);};
ISO C++ Mapping
![Page 23: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/23.jpg)
enum MarrialStatus { SINGLE, MARRIED, DIVORCED };
struct Person { long age; //@id(1) wstring name; MarrialStatus married; sequence<TelephoneNumber> tel; sequence<TelefoneNumber, 2> fax; double height; //@optional double weight; //@optional sequence<byte> photo; //@shared };
Copyright 2010, PrismTech / RTI
DDS Type MappingDDS Topic Type
class Person {public: std::vector<uint8_t>* photo() const; void photo(std::vector<uint8_t>* v);};
ISO C++ Mapping
![Page 24: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/24.jpg)
Copyright 2010, PrismTech / RTI
Agenda
- Status Update
- Submission Scope
- API Overview
- Resource Management
- Type Mapping Example
- Code Example
- Next Steps
![Page 25: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/25.jpg)
Copyright 2010, PrismTech / RTI
Code Example
struct RadarTrack { string id; long x; long y;};
DDS Topic Type
![Page 26: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/26.jpg)
Copyright 2010, PrismTech / RTI
Data Writer
- Create DataWriter
using dds::core; using dds::domain; using dds::pub; using dds::topic;
DomainId id = 0;
DomainParticipant dp = theParticipantFactory().create_participant(id);
Publisher pub = dp.create_publisher();
Topic<RadarTrack> topic = dp.create_topic("RadarTrackTopic");DataWriter<RadarTrack> dw = pub.create_datawriter();RadarTrack t("T101", 100, 200);dw.write(t);
![Page 27: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/27.jpg)
Copyright 2010, PrismTech / RTI
Data Reader
using dds::core; using dds::domain; using dds::pub; using dds::topic;
DomainId id = 0;DomainParticipant dp(id);
DomainParticipant dp = theParticipantFactory().create_participant();
Publisher sub = dp.create_publisher();
Topic<RadarTrack> topic = dp.create_topic("RadarTrackTopic");DataReader<RadarTrack> reader = sub.create_datareader();
![Page 28: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/28.jpg)
Copyright 2010, PrismTech / RTI
Data Reader
- User Provided Container
dr.take(t.begin(), i.begin(), maxsize);
std::vector<RadarTrack> t;std::vector<SampleInfo> i;
RadarTrack at[MSIZE];SampleInfo ai[MSIZE];
dr.take(at, ai, MSIZE);
![Page 29: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/29.jpg)
Copyright 2010, PrismTech / RTI
Data Reader
- Loaned Data
LoanedSamples<RadarTrack> dt = dr.take(); for (LoanedSamples<RadarTrack>::Iterator it = dt.begin(); it != dt.end(); ++it) { const Sample<RadarTrack>& sample = *it; if (sample.is_valid_data()) { const RadarTrack& data = sample.data(); // … } }
![Page 30: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/30.jpg)
Copyright 2010, PrismTech / RTI
Agenda
- Status Update
- Submission Scope
- API Overview
- Resource Management
- Type Mapping Example
- Code Example
- Next Steps
![Page 31: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/31.jpg)
Copyright 2010, PrismTech / RTI
Next Steps
- XTopics API Add support for the XTopics API Complete the Type Mapping to include the full
DDS-XTypes Type System
- Vote for Adoption December Meeting
![Page 32: DDS ISO C++ PSM](https://reader034.fdocuments.in/reader034/viewer/2022050805/5599f0f31a28abe01a8b47b0/html5/thumbnails/32.jpg)
THANKS
`