21 package org.opensplice.dds.type;
23 import java.lang.reflect.Constructor;
24 import java.lang.reflect.InvocationTargetException;
25 import java.util.Collection;
48 import DDS.TypeSupport;
55 private final byte[] metaData;
56 private final byte[] typeHash;
57 private final byte[] extentions = null;
60 Class<PROTOBUF_TYPE> dataType,
62 final byte[] metaData,
63 final byte[] metaHash) {
66 this.metaData = metaData;
67 this.typeHash = metaHash;
71 oldTypeSupport.set_data_representation_id(DDS.GPB_REPRESENTATION.value);
72 oldTypeSupport.set_meta_data(this.metaData);
73 oldTypeSupport.set_type_hash(this.typeHash);
76 @SuppressWarnings(
"unchecked")
79 String registeredName) {
80 String typeSupportName = dataType.getName().replaceAll(
"\\$",
"")
81 +
"TypeSupportProtobuf";
84 Class<?> typeSupportClass = Class.forName(typeSupportName);
85 Constructor<?> c = typeSupportClass.getConstructor(
89 environment, registeredName);
91 }
catch (ClassNotFoundException e) {
93 "Allocating new TypeSupport failed (" + typeSupportName
94 +
"); " + e.getMessage());
95 }
catch (InstantiationException e) {
97 "Allocating new TypeSupport failed. " + e.getMessage());
98 }
catch (IllegalAccessException e) {
100 "Allocating new TypeSupport failed. " + e.getMessage());
101 }
catch (IllegalArgumentException e) {
103 "Allocating new TypeSupport failed. " + e.getMessage());
104 }
catch (InvocationTargetException e) {
106 "Allocating new TypeSupport failed. " + e.getMessage());
107 }
catch (NoSuchMethodException e) {
109 "Allocating new TypeSupport failed. " + e.getMessage());
110 }
catch (SecurityException e) {
112 "Allocating new TypeSupport failed. " + e.getMessage());
130 }
catch (InstantiationException e) {
132 "Unable to instantiate data; " + e.getMessage());
133 }
catch (IllegalAccessException e) {
135 "Unable to instantiate data; " + e.getMessage());
157 Collection<Class<? extends Status>> statuses) {
159 topicName,
this, qos, listener, statuses);
166 Collection<Class<? extends Status>> statuses) {
177 Collection<Class<? extends Status>> statuses){
179 this.
environment, subscriber, topicDescription, qos, listener,
184 return this.metaData.clone();
188 return this.typeHash.clone();
192 return this.extentions.clone();
196 int len = s.length();
197 byte[] data =
new byte[len / 2];
198 for (
int i = 0; i < len; i += 2) {
199 data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
200 + Character.digit(s.charAt(i+1), 16));
205 public abstract PROTOBUF_TYPE
ddsToProtobuf(DDS_TYPE ddsData);
207 public abstract DDS_TYPE
protobufToDds(PROTOBUF_TYPE protobufData);
Since a org.omg.dds.sub.DataReader is a kind of org.omg.dds.core.Entity, it has the ability to have a...
ServiceEnvironment getEnvironment()
static< SOME_TYPE > org.omg.dds.type.TypeSupport< SOME_TYPE > getInstance(OsplServiceEnvironment environment, Class< SOME_TYPE > dataType, String registeredName)
Class< PROTOBUF_TYPE > getType()
static byte [] hexStringToByteArray(String s)
AbstractDataWriter< PROTOBUF_TYPE > createDataWriter(PublisherImpl publisher, AbstractTopic< PROTOBUF_TYPE > topic, DataWriterQos qos, DataWriterListener< PROTOBUF_TYPE > listener, Collection< Class<? extends Status >> statuses)
AbstractDataReader< PROTOBUF_TYPE > createDataReader(SubscriberImpl subscriber, TopicDescriptionExt< PROTOBUF_TYPE > topicDescription, DataReaderQos qos, DataReaderListener< PROTOBUF_TYPE > listener, Collection< Class<? extends Status >> statuses)
abstract PROTOBUF_TYPE ddsToProtobuf(DDS_TYPE ddsData)
TypeSupportImpl< DDS_TYPE > getTypeSupportStandard()
DDS.TypeSupport getOldTypeSupport()
TypeSupportProtobuf(OsplServiceEnvironment environment, Class< PROTOBUF_TYPE > dataType, TypeSupportImpl< DDS_TYPE > ddsTypeSupport, final byte[] metaData, final byte[] metaHash)
final TypeSupportImpl< DDS_TYPE > ddsTypeSupport
TypeSupport getOldTypeSupport()
AbstractTopic< PROTOBUF_TYPE > createTopic(DomainParticipantImpl participant, String topicName, TopicQos qos, TopicListener< PROTOBUF_TYPE > listener, Collection< Class<? extends Status >> statuses)
Since org.omg.dds.topic.Topic is a kind of org.omg.dds.core.Entity, it has the ability to have an ass...
Since a org.omg.dds.pub.DataWriter is a kind of org.omg.dds.core.Entity, it has the ability to have a...
abstract PROTOBUF_TYPE ddsKeyToProtobuf(DDS_TYPE ddsData)
abstract DDS_TYPE protobufToDds(PROTOBUF_TYPE protobufData)
byte [] getMetaDescriptor()
TypeSupport is an abstract interface that has to be specialized for each concrete type that will be u...
DDS implementations are rooted in this class, a concrete subclass of which can be instantiated based ...
final Class< PROTOBUF_TYPE > dataType
final OsplServiceEnvironment environment
Status is the abstract root class for all communication status objects.