RTI Persistence Service Version 7.7.0
HelloWorldTypeSupport.java

[$(NDDSHOME)/example/JAVA/helloWorldPersistence/HelloWorldTypeSupport.java]

/*
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
This file was generated from .idl
using RTI Code Generator (rtiddsgen) version 4.7.0.
The rtiddsgen tool is part of the RTI Connext DDS distribution.
For more information, type 'rtiddsgen -help' at a command shell
or consult the Code Generator User's Manual.
*/
import com.rti.dds.cdr.CdrEncapsulation;
import com.rti.dds.cdr.CdrInputStream;
import com.rti.dds.cdr.CdrOutputStream;
import com.rti.dds.cdr.CdrPrimitiveType;
import com.rti.dds.cdr.CdrBuffer;
import com.rti.dds.cdr.CdrHeader;
import com.rti.dds.dynamicdata.DynamicData;
import com.rti.dds.cdr.IllegalCdrStateException;
import com.rti.dds.publication.DataWriter;
import com.rti.dds.publication.DataWriterListener;
import com.rti.dds.subscription.DataReader;
import com.rti.dds.subscription.DataReaderListener;
import com.rti.dds.topic.DefaultEndpointData;
import com.rti.dds.topic.TypeSupportImpl;
import com.rti.dds.topic.TypeSupportType;
import com.rti.dds.infrastructure.*;
import com.rti.dds.infrastructure.RETCODE_ERROR;
import com.rti.dds.topic.PrintFormatProperty;
import com.rti.dds.topic.PrintFormatKind;
import com.rti.dds.typecode.TypeCode;
import com.rti.dds.typecode.ExtensibilityKind;
import com.rti.dds.topic.TypeSupportParticipantInfo;
import com.rti.dds.topic.TypeSupportEndpointInfo;
import com.rti.dds.domain.DomainParticipant;
public class HelloWorldTypeSupport extends TypeSupportImpl {
// -----------------------------------------------------------------------
// Private Fields
// -----------------------------------------------------------------------
private static final java.lang.String TYPE_NAME = "HelloWorld";
private static final char[] PLUGIN_VERSION = {2, 0, 0, 0};
private static final HelloWorldTypeSupport _singleton
= new HelloWorldTypeSupport();
// -----------------------------------------------------------------------
// Public Methods
// -----------------------------------------------------------------------
// --- External methods: -------------------------------------------------
/* The methods in this section are for use by users of RTI Connext
*/
public static java.lang.String get_type_name() {
return _singleton.get_type_nameI();
}
public static void register_type(DomainParticipant participant,
java.lang.String type_name) {
_singleton.register_typeI(participant, type_name);
}
public static void unregister_type(DomainParticipant participant,
java.lang.String type_name) {
_singleton.unregister_typeI(participant, type_name);
}
/* The methods in this section are for use by RTI Connext
* itself and by the code generated by rtiddsgen for other types.
* They should be used directly or modified only by advanced users and are
* subject to change in future versions of RTI Connext.
*/
public static HelloWorldTypeSupport get_instance() {
return _singleton;
}
public static HelloWorldTypeSupport getInstance() {
return get_instance();
}
public static TypeCode getTypeCode(){
return HelloWorldTypeCode.VALUE;
}
@Override
public java.lang.Object create_data() {
return HelloWorld.create();
}
@Override
public java.lang.Object _create_data_internal() {
HelloWorld data = new HelloWorld();
this._initialize_data_internal(data);
return data;
}
public void _initialize_data_internal(HelloWorld data) {
}
public java.lang.Object _create_data_internal_seq(int size) {
HelloWorldSeq data = new HelloWorldSeq(size);
data.setObjectReuseMemoryManagement(size);
for (int i = 0; i < size; ++i) {
data.incrementSize();
data.set(i, HelloWorldTypeSupport.get_instance()._create_data_internal());
}
data.clear();
return data;
}
@Override
public void destroy_data(java.lang.Object data) {
return;
}
@Override
public java.lang.Object create_key() {
return new HelloWorld();
}
@Override
public void destroy_key(java.lang.Object key) {
return;
}
@Override
public java.lang.Class<?> get_type() {
return HelloWorld.class;
}
@Override
public java.lang.Object copy_data(java.lang.Object destination, java.lang.Object source) {
HelloWorld typedDst = (HelloWorld) destination;
HelloWorld typedSrc = (HelloWorld) source;
return typedDst.copy_from(typedSrc);
}
@Override
public long get_serialized_sample_max_size(java.lang.Object endpoint_data,boolean include_encapsulation,short final_encapsulation_id,long currentAlignment) {
CdrPrimitiveType _cdrPrimitiveType = CdrPrimitiveType.getInstance(final_encapsulation_id);
short encapsulation_id = CdrEncapsulation.getEncapsulationFromFinal(
final_encapsulation_id,
ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE);
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
long origAlignment = currentAlignment;
long encapsulation_size = currentAlignment;
if(include_encapsulation) {
if (!CdrEncapsulation.isValidEncapsulationKind(encapsulation_id)) {
throw new RETCODE_ERROR("Unsupported encapsulation");
}
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size -= currentAlignment;
currentAlignment = 0;
origAlignment = 0;
if(xcdr1){
epd.setBaseAlignment(currentAlignment);
}
}
if (!xcdr1) {
currentAlignment += _cdrPrimitiveType.getIntMaxSizeSerialized(currentAlignment);
}
currentAlignment += _cdrPrimitiveType.getIntMaxSizeSerialized(epd.getAlignment(currentAlignment));
if (include_encapsulation) {
currentAlignment += encapsulation_size;
}
return currentAlignment - origAlignment;
}
@Override
public long get_serialized_sample_min_size(java.lang.Object endpoint_data,boolean include_encapsulation,short final_encapsulation_id,long currentAlignment) {
CdrPrimitiveType _cdrPrimitiveType = CdrPrimitiveType.getInstance(final_encapsulation_id);
short encapsulation_id = CdrEncapsulation.getEncapsulationFromFinal(
final_encapsulation_id,
ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE);
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
long origAlignment = currentAlignment;
long encapsulation_size = currentAlignment;
if(include_encapsulation) {
if (!CdrEncapsulation.isValidEncapsulationKind(encapsulation_id)) {
throw new RETCODE_ERROR("Unsupported encapsulation");
}
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size -= currentAlignment;
currentAlignment = 0;
origAlignment = 0;
if(xcdr1){
epd.setBaseAlignment(currentAlignment);
}
}
if (!xcdr1) {
currentAlignment += _cdrPrimitiveType.getIntMaxSizeSerialized(currentAlignment);
}
currentAlignment += _cdrPrimitiveType.getIntMaxSizeSerialized(epd.getAlignment(currentAlignment));
if (include_encapsulation) {
currentAlignment += encapsulation_size;
}
return currentAlignment - origAlignment;
}
@Override
public long get_serialized_sample_size(
java.lang.Object endpoint_data, boolean include_encapsulation,
short final_encapsulation_id, long currentAlignment,
java.lang.Object sample)
{
CdrPrimitiveType _cdrPrimitiveType = CdrPrimitiveType.getInstance(final_encapsulation_id);
short encapsulation_id = CdrEncapsulation.getEncapsulationFromFinal(
final_encapsulation_id,
ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE);
HelloWorld typedSrc = (HelloWorld) sample;
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
long origAlignment = currentAlignment;
long encapsulation_size = currentAlignment;
if(include_encapsulation) {
if (!CdrEncapsulation.isValidEncapsulationKind(encapsulation_id)) {
throw new RETCODE_ERROR("Unsupported encapsulation");
}
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size -= currentAlignment;
currentAlignment = 0;
origAlignment = 0;
if(xcdr1){
epd.setBaseAlignment(currentAlignment);
}
}
if (!xcdr1) {
currentAlignment += _cdrPrimitiveType.getIntMaxSizeSerialized(currentAlignment);
}
currentAlignment += _cdrPrimitiveType.getIntMaxSizeSerialized(epd.getAlignment(currentAlignment));
if (include_encapsulation) {
currentAlignment += encapsulation_size;
}
return currentAlignment - origAlignment;
}
@Override
public long get_serialized_key_max_size(
java.lang.Object endpoint_data,
boolean include_encapsulation,
short final_encapsulation_id,
long currentAlignment)
{
CdrPrimitiveType _cdrPrimitiveType = CdrPrimitiveType.getInstance(final_encapsulation_id);
short encapsulation_id = CdrEncapsulation.getEncapsulationFromFinal(
final_encapsulation_id,
ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE);
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
long origAlignment = currentAlignment;
long encapsulation_size = currentAlignment;
if(include_encapsulation) {
if (!CdrEncapsulation.isValidEncapsulationKind(encapsulation_id)) {
throw new RETCODE_ERROR("Unsupported encapsulation");
}
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size -= currentAlignment;
currentAlignment = 0;
origAlignment = 0;
if(xcdr1){
epd.setBaseAlignment(currentAlignment);
}
}
currentAlignment += get_serialized_sample_max_size(
epd,false,final_encapsulation_id,currentAlignment);
if (include_encapsulation) {
currentAlignment += encapsulation_size;
}
return currentAlignment - origAlignment;
}
@Override
public long get_serialized_key_for_keyhash_max_size(
java.lang.Object endpoint_data,
boolean include_encapsulation,
short final_encapsulation_id,
long currentAlignment)
{
CdrPrimitiveType _cdrPrimitiveType = CdrPrimitiveType.getInstance(final_encapsulation_id);
short encapsulation_id = CdrEncapsulation.getEncapsulationFromFinal(
final_encapsulation_id,
ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE);
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
if (xcdr1){
return get_serialized_key_max_size(epd, include_encapsulation, final_encapsulation_id, currentAlignment) ;
}
long origAlignment = currentAlignment;
long encapsulation_size = currentAlignment;
if(include_encapsulation) {
if (!CdrEncapsulation.isValidEncapsulationKind(encapsulation_id)) {
throw new RETCODE_ERROR("Unsupported encapsulation");
}
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size += _cdrPrimitiveType.getShortMaxSizeSerialized(encapsulation_size);
encapsulation_size -= currentAlignment;
currentAlignment = 0;
origAlignment = 0;
}
currentAlignment += _cdrPrimitiveType.getIntMaxSizeSerialized(epd.getAlignment(currentAlignment));
if (include_encapsulation) {
currentAlignment += encapsulation_size;
}
return currentAlignment - origAlignment;
}
@Override
public void serialize(java.lang.Object endpoint_data,java.lang.Object src,
CdrOutputStream dst, boolean serialize_encapsulation, short final_encapsulation_id,
boolean serialize_sample, java.lang.Object endpoint_plugin_qos) {
int position = 0;
int dheaderArrPosition = -1;
int dheaderSeqPosition = -1;
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
int dheaderPosition = -1;
boolean inBaseClass_tmp = false;
inBaseClass_tmp = dst.inBaseClass;
dst.inBaseClass = false;
if(serialize_encapsulation) {
dst.serializeAndSetCdrEncapsulation(final_encapsulation_id, ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
position = dst.resetAlignment();
}
if(serialize_sample) {
boolean xcdr1 = (final_encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE)? true: false;
if (!inBaseClass_tmp && !xcdr1) {
dheaderPosition=dst.writeDHeader();
}
HelloWorld typedSrc = (HelloWorld) src;
dst.writeInt(typedSrc.data);
if (!xcdr1 && dheaderPosition != -1) {
dst.setDHeader(dheaderPosition);
dheaderPosition = -1;
}
}
if (serialize_encapsulation) {
dst.restoreAlignment(position);
}
}
public long serialize_to_cdr_buffer(
byte[] buffer,
long length,
HelloWorld src)
{
return super.serialize_to_cdr_buffer(buffer,length,src);
}
public long serialize_to_cdr_buffer(
byte[] buffer,
long length,
HelloWorld src,
short representation)
{
return super.serialize_to_cdr_buffer(
buffer,
length,
src,
representation);
}
@Override
public void serialize_key(
java.lang.Object endpoint_data,
java.lang.Object src,
CdrOutputStream dst,
boolean serialize_encapsulation,
short final_encapsulation_id,
boolean serialize_key,
java.lang.Object endpoint_plugin_qos)
{
int dheaderArrPosition = -1;
int dheaderSeqPosition = -1;
int position = 0;
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
boolean inBaseClass_tmp = false;
inBaseClass_tmp = dst.inBaseClass;
dst.inBaseClass = false;
if (serialize_encapsulation) {
dst.serializeAndSetCdrEncapsulation(final_encapsulation_id, ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
position = dst.resetAlignment();
} else {
dst.setEncapsulationKind(final_encapsulation_id);
}
if (serialize_key) {
boolean xcdr1 = (final_encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE)? true: false;
HelloWorld typedSrc = (HelloWorld) src;
dst.inBaseClass = false;
serialize(epd, src, dst, false, final_encapsulation_id, true, endpoint_plugin_qos);
}
if (serialize_encapsulation) {
dst.restoreAlignment(position);
}
}
@Override
public void serialize_key_for_keyhash(
java.lang.Object endpoint_data,
java.lang.Object src,
CdrOutputStream dst,
boolean serialize_encapsulation,
short final_encapsulation_id,
boolean serialize_key,
java.lang.Object endpoint_plugin_qos)
{
int position = 0;
int dheaderArrPosition = -1;
int dheaderSeqPosition = -1;
CdrPrimitiveType _cdrPrimitiveType = CdrPrimitiveType.getInstance(final_encapsulation_id);
short encapsulation_id = CdrEncapsulation.getEncapsulationFromFinal(
final_encapsulation_id,
ExtensibilityKind.EXTENSIBLE_EXTENSIBILITY);
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE);
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
if (xcdr1){
serialize_key (
epd,
src,
dst,
serialize_encapsulation,
final_encapsulation_id,
serialize_key,
endpoint_plugin_qos);
} else {
if (serialize_encapsulation) {
dst.serializeAndSetCdrEncapsulation(encapsulation_id);
position = dst.resetAlignment();
} else {
/* We do this to prepare the stream to serialize using xcdr2 if needed
* as in md5Stream we pass serialize_encapsulation ton false.
*/
dst.setEncapsulationKind(final_encapsulation_id);
}
if (serialize_key) {
HelloWorld typedSrc = (HelloWorld) src;
dst.inBaseClass = false;
dst.writeInt(typedSrc.data);
}
if (serialize_encapsulation) {
dst.restoreAlignment(position);
}
}
}
// Depending on the type represented in the IDL, we may perform some redundant
// casts, we are suppressing that warning
@SuppressWarnings("cast")
@Override
public java.lang.Object deserialize_sample(
java.lang.Object endpoint_data,
java.lang.Object dst,
CdrInputStream src, boolean deserialize_encapsulation,
boolean deserialize_sample,
java.lang.Object endpoint_plugin_qos)
{
int position = 0;
int tmpPosition = 0, tmpSize = 0;
long tmpLength = 0;
CdrBuffer buffer = null;
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
boolean inBaseClass_tmp = false;
inBaseClass_tmp = src.inBaseClass;
src.inBaseClass = false;
if(deserialize_encapsulation) {
src.deserializeAndSetCdrEncapsulation();
position = src.resetAlignment();
}
if(deserialize_sample) {
short encapsulation_id = src.getEncapsulationKind();
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE)? true: false;
if(!xcdr1){
buffer = src.getBuffer();
}
HelloWorld typedDst = (HelloWorld) dst;
typedDst.clear();
int DHtmpPosition = 0;
int DHtmpSize = 0;
long DHtmpLength = 0;
if (!xcdr1 && !inBaseClass_tmp) {
DHtmpLength = src.readInt();
DHtmpPosition = buffer.currentPosition();
DHtmpSize = buffer.getDesBufferSize();
buffer.setDesBufferSize((int)(DHtmpPosition + DHtmpLength));
}
try{
typedDst.data = src.readInt();
} catch (IllegalCdrStateException stateEx) {
if (src.available() >= CdrEncapsulation.CDR_ENCAPSULATION_PARAMETER_ID_ALIGNMENT) {
throw new RETCODE_ERROR("Error deserializing sample! Remainder: " + src.available() + "\n" +
"Exception caused by: " + stateEx.getMessage());
}
} catch (java.lang.Exception ex) {
throw new RETCODE_ERROR(ex.getMessage());
}
if (!xcdr1 && !inBaseClass_tmp ) {
buffer.restore(DHtmpSize, (int) (DHtmpPosition + DHtmpLength));
}
}
if (deserialize_encapsulation) {
src.restoreAlignment(position);
}
return dst;
}
public void deserialize_from_cdr_buffer(
HelloWorld dst,
byte[] buffer,
long length)
{
super.deserialize_from_cdr_buffer(dst,buffer,length);
}
public java.lang.String data_to_string(
HelloWorld sample,
PrintFormatProperty property)
{
return super.data_to_string(sample, property);
}
public java.lang.String data_to_string(
HelloWorld sample)
{
return super.data_to_string(sample);
}
@java.lang.Override
public HelloWorld data_from_string(
java.lang.String string,
PrintFormatKind kind)
{
return (HelloWorld) super.data_from_string(string, kind);
}
@java.lang.Override
public HelloWorld data_from_string(
java.lang.String string)
{
return (HelloWorld) super.data_from_string(string);
}
@java.lang.Override
public HelloWorld data_from_dynamicdata(
DynamicData dynamicData)
{
return (HelloWorld) super.data_from_dynamicdata(dynamicData);
}
@Override
public java.lang.Object deserialize_key_sample(
java.lang.Object endpoint_data,
java.lang.Object dst,
CdrInputStream src,
boolean deserialize_encapsulation,
boolean deserialize_key,
java.lang.Object endpoint_plugin_qos)
{
int position = 0;
int tmpPosition = 0, tmpSize = 0;
long tmpLength = 0;
CdrBuffer buffer = null;
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
boolean inBaseClass_tmp = false;
inBaseClass_tmp = src.inBaseClass;
src.inBaseClass = false;
if(deserialize_encapsulation) {
src.deserializeAndSetCdrEncapsulation();
position = src.resetAlignment();
}
if(deserialize_key) {
short encapsulation_id = src.getEncapsulationKind();
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE)? true: false;
if(!xcdr1){
buffer = src.getBuffer();
}
HelloWorld typedDst = (HelloWorld) dst;
deserialize_sample(epd, dst, src, false, true, endpoint_plugin_qos);
}
if (deserialize_encapsulation) {
src.restoreAlignment(position);
}
return dst;
}
@Override
public void skip(java.lang.Object endpoint_data,
CdrInputStream src,
boolean skip_encapsulation,
boolean skip_sample,
java.lang.Object endpoint_plugin_qos)
{
int position = 0;
int tmpPosition = 0, tmpSize = 0;
long tmpLength = 0;
CdrBuffer buffer = null;
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
boolean inBaseClass_tmp = false;
inBaseClass_tmp = src.inBaseClass;
src.inBaseClass = false;
if (skip_encapsulation) {
src.skipEncapsulation();
position = src.resetAlignment();
}
if (skip_sample) {
short encapsulation_id = src.getEncapsulationKind();
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE)? true: false;
if(!xcdr1){
buffer = src.getBuffer();
}
int DHtmpPosition = 0;
long DHtmpLength = 0;
if (!xcdr1 && !inBaseClass_tmp) {
DHtmpLength = src.readInt();
DHtmpPosition = buffer.currentPosition();
buffer.setCurrentPosition((int) (DHtmpPosition + DHtmpLength));
if (skip_encapsulation) {
src.restoreAlignment(position);
}
return;
}
try {
src.skipInt();
} catch (IllegalCdrStateException stateEx) {
if (src.available() >=
CdrEncapsulation.CDR_ENCAPSULATION_PARAMETER_ID_ALIGNMENT) {
throw new IllegalCdrStateException(
"Error skipping sample! Remainder:" + src.available()
+ "\nException caused by: " + stateEx.getMessage());
}
}
}
if (skip_encapsulation) {
src.restoreAlignment(position);
}
}
@Override
public java.lang.Object serialized_sample_to_key(
java.lang.Object endpoint_data,
java.lang.Object sample,
CdrInputStream src,
boolean deserialize_encapsulation,
boolean deserialize_key,
java.lang.Object endpoint_plugin_qos)
{
int position = 0;
int tmpPosition = 0, tmpSize = 0;
long tmpLength = 0;
CdrBuffer buffer = null;
DefaultEndpointData epd = (DefaultEndpointData) endpoint_data;
if (epd == null) {
/* Coverity reports that epd store a object that might not
be used later. It is true that it might not be used,
depending on the type complexity. This is intentional
because it doesn't affect generated code and fixing it
would make generated code more difficult to maintain */
/* coverity[defect] */
epd = new DefaultEndpointData();
}
boolean inBaseClass_tmp = false;
inBaseClass_tmp = src.inBaseClass;
src.inBaseClass = false;
if(deserialize_encapsulation) {
src.deserializeAndSetCdrEncapsulation();
position = src.resetAlignment();
}
if (deserialize_key) {
short encapsulation_id = src.getEncapsulationKind();
boolean xcdr1 = (encapsulation_id <= CdrEncapsulation.CDR_ENCAPSULATION_ID_PL_CDR_LE)? true: false;
if(!xcdr1){
buffer = src.getBuffer();
}
HelloWorld typedDst = (HelloWorld) sample;
deserialize_sample(
epd, sample, src, false,
true, endpoint_plugin_qos);
}
if (deserialize_encapsulation) {
src.restoreAlignment(position);
}
return sample;
}
// -----------------------------------------------------------------------
// Callbacks
// -----------------------------------------------------------------------
@Override
public Object on_participant_attached(java.lang.Object registration_data,
TypeSupportParticipantInfo participant_info,
boolean top_level_registration,
java.lang.Object container_plugin_context,
TypeCode type_code) {
participant_info.xtypes_compliance_mask.set(com.rti.ndds.config.Compliance.get_xtypes_mask().get());
return super.on_participant_attached(
registration_data, participant_info, top_level_registration,
container_plugin_context, type_code);
}
@Override
public void on_participant_detached(java.lang.Object participant_data) {
super.on_participant_detached(participant_data);
}
@Override
public java.lang.Object on_endpoint_attached(java.lang.Object participantData,
TypeSupportEndpointInfo endpoint_info,
boolean top_level_registration,
java.lang.Object container_plugin_context) {
return super.on_endpoint_attached(
participantData, endpoint_info,
top_level_registration, container_plugin_context);
}
@Override
public void on_endpoint_detached(java.lang.Object endpoint_data) {
super.on_endpoint_detached(endpoint_data);
}
// -----------------------------------------------------------------------
// Protected Methods
// -----------------------------------------------------------------------
@Override
protected DataWriter create_datawriter(long native_writer,
DataWriterListener listener,
int mask) {
return new HelloWorldDataWriter (native_writer, listener, mask, this);
}
@Override
protected DataReader create_datareader(long native_reader,
DataReaderListener listener,
int mask) {
return new HelloWorldDataReader(native_reader, listener, mask, this);
}
// -----------------------------------------------------------------------
// Constructor
// -----------------------------------------------------------------------
protected HelloWorldTypeSupport() {
/* If the user data type supports keys, then the second argument
to the constructor below should be true. Otherwise it should
be false. */
super(TYPE_NAME, false, HelloWorldTypeCode.VALUE, HelloWorld.class,TypeSupportType.TST_STRUCT, PLUGIN_VERSION);
}
protected HelloWorldTypeSupport (boolean enableKeySupport) {
super(TYPE_NAME, enableKeySupport, HelloWorldTypeCode.VALUE, HelloWorld.class,TypeSupportType.TST_STRUCT, PLUGIN_VERSION);
}
}