This document discusses the DDS-PSM-Cxx standard for implementing the Data Distribution Service (DDS) in C++. It provides an overview of the key concepts in DDS including domains, topics, publishers, subscribers, datawriters and datareaders. It also describes content filtering, queries, instances and state-based selection. The document notes that simd-cxx influenced DDS-PSM-Cxx and that simd-cxx v1.0 implements this standard. It provides references to related DDS implementations and APIs.
6. Anatomy of a DDS Application
[DDS C++ API 2010]
Domain
Domain
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
auto dp = DomainParticipant(domainId);
Participant
Session
// Create a Topic
auto topic = Topic<ShapeType>(dp, “Circle”); Publisher
Topic
Subscriber
OpenSplice DDS
// Create a Publisher / Subscriber
auto pub = Publisher(dp);
auto sub = Subscriber(dp);
Reader/Writers for User Defined for Types DataWriter
DataReader
// Create a DataWriter/DataWriter
auto writer = DataWriter<ShapeType>(pub, topic); Reader/Writer for
auto reader = DataReader<ShapeType>(sub, topic);
application defined
Topic Types
7. Anatomy of a DDS Application
[DDS C++ API 2010]
Domain
Domain
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
auto dp = DomainParticipant(domainId);
Participant
Session
// Create a Topic
auto topic = Topic<ShapeType>(dp, “Circle”); Publisher
Topic
Subscriber
OpenSplice DDS
// Create a Publisher / Subscriber
auto pub = Publisher(dp);
auto sub = Subscriber(dp);
Reader/Writers for User Defined for Types DataWriter
DataReader
// Write data
writer.write(ShapeType(“RED”, 131, 107, 89)); Reader/Writer for
// But you can also write like this...
writer << ShapeType(“RED”, 131, 107, 89);
application defined
Topic Types
// Read new data (loaned)
auto data = reader.read();
9. Filters and Queries Application
☐ DDS Filters allow to control what gets
into a DataReader cache
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Query
☐ DDS Queries allow to control what gets
out of a DataReader cache DataReader
Filters are defined by means of
OpenSplice DDS
☐
...
ContentFilteredTopics
...
...
...
☐ Queries operate in conjunction with DataReader Cache
read operations
Filter
☐ Filters and Queries are expressed as SQL
where clauses
10. struct ShapeType {
Filters
@Key
string color;
long x;
long y;
[C++ API] };
long shapesize;
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
/**
* NOTE: The Scala API if not provided with DP/Sub/Pub assumes
* default domains and default partition.
**/
// Create a Topic
auto topic = Topic<ShapeType>(dp, “Circle”);
OpenSplice DDS
// Define filter expression and parameters
auto filter = Filter(“x < 100 AND y < 200”);
// Define content filtered topic
auto cftopic =
ContentFilteredTopic<ShapeType>(“CFCircle”, topic, filter)
// Create a DataReader for the content-filtered Topic
auto dr = DataReader<ShapeType>(sub,cftopic)
11. struct ShapeType {
Query
@Key
string color;
long x;
long y;
[C++ API] };
long shapesize;
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
// Define filter expression and parameters
auto dr = DataReader<ShapeType>(sub, topic)
val query = Query(dr, “x < 100 AND y < 200”);
OpenSplice DDS
dr.select()
.content(query)
.read();
12. Instances
☐ DDS provides a very efficient way of reading data belonging to a
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
specific Topic Instance
☐ Obviously, one could use queries to match the key’s value, but this
is not as efficient as the special purpose instance selector
OpenSplice DDS
auto handle =
dr.lookup_instance(ShapeType(“RED”, 0, 0, 0));
auto data =
dr.select()
.instance(handle)
.read();
14. Sample, Instance, and View State
☐ The samples included in the DataReader cache have associated
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
some meta-information which, among other things, describes the
status of the sample and its associated stream/instance
☐ The Sample State (READ, NOT_READ) allows to distinguish between
OpenSplice DDS
new samples and samples that have already been read
☐ The View State (NEW, NOT_NEW) allows to distinguish a new
instance from an existing one
☐ The Intance State (ALIVE, NOT_ALIVE_DISPOSED,
NOT_ALIVE_NO_WRITERS) allows to track the life-cycle transitions of
the instance to which a sample belongs
15. State Selector in Action
[C++ API]
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
// Read only new samples
auto data = dr.read()
// Read any samples from live instances
auto data =
dr.select()
OpenSplice DDS
.state(DataState::any_data())
.read();
16. Putting all Together
[C++ API]
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ Selectors can be composed in a flexible and expressive manner
OpenSplice DDS
auto data =
dr.select()
.content(query)
.state(data_state)
.instance(handle)
.read();
17. QoS Provider
☐ The new C++ and Java APIs introduce the concept of a QoS
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
Provider
☐ This class allows to externally define policies and decouples the
mechanism used to define and access policy definition with policy
OpenSplice DDS
creation
//
QosProvider...
QosProvider
qos_provider(
"http://www.opensplice.org/demo/config/qos.xml",
"ishapes-‐profile");
DataReader<ShapeType>
dr(sub,
topic,
qos_provider.datareader_qos());
18. In Summary
Copyright
2011,
PrismTech
–
All
Rights
Reserved.
☐ simd-cxx v0.x available at http://code.google.com/p/simd-cxx
was the major influencer of the new DDS-PSM-Cxx standard. Yet
simd-cxx v0.x does not comply with the DDS-PSM-Cxx
OpenSplice DDS
☐ simd-cxx v1.0 available at http://github.com/kydos/simd-cxx is an
alpha implementation of the DDS-PSM-Cxx