RTI Connext Java API  Version 5.1.0
HelloWorldSeq.java

Programming Language Type Description

The following programming language specific type representation is generated by rtiddsgen for use in application code, where:

HelloWorld.java

[$(NDDSHOME)/example/JAVA/helloWorld/HelloWorld.java]

/*
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
This file was generated from .idl using "rtiddsgen".
The rtiddsgen tool is part of the RTI Connext distribution.
For more information, type 'rtiddsgen -help' at a command shell
or consult the RTI Connext manual.
*/
import com.rti.dds.infrastructure.*;
import com.rti.dds.infrastructure.Copyable;
import java.io.Serializable;
import com.rti.dds.cdr.CdrHelper;
public class HelloWorld implements Copyable, Serializable{
public String msg= "" ; /* maximum length = (128) */
public HelloWorld() {
}
public HelloWorld (HelloWorld other) {
this();
copy_from(other);
}
public static Object create() {
HelloWorld self;
self = new HelloWorld();
self.clear();
return self;
}
public void clear() {
msg= "";
}
public boolean equals(Object o) {
if (o == null) {
return false;
}
if(getClass() != o.getClass()) {
return false;
}
HelloWorld otherObj = (HelloWorld)o;
if(!msg.equals(otherObj.msg)) {
return false;
}
return true;
}
public int hashCode() {
int __result = 0;
__result += msg.hashCode();
return __result;
}
public Object copy_from(Object src) {
HelloWorld typedSrc = (HelloWorld) src;
HelloWorld typedDst = this;
typedDst.msg = typedSrc.msg;
return this;
}
public String toString(){
return toString("", 0);
}
public String toString(String desc, int indent) {
StringBuffer strBuffer = new StringBuffer();
if (desc != null) {
CdrHelper.printIndent(strBuffer, indent);
strBuffer.append(desc).append(":\n");
}
CdrHelper.printIndent(strBuffer, indent+1);
strBuffer.append("msg: ").append(msg).append("\n");
return strBuffer.toString();
}
}

HelloWorldSeq.java

[$(NDDSHOME)/example/JAVA/helloWorld/HelloWorldSeq.java]

/*
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
This file was generated from .idl using "rtiddsgen".
The rtiddsgen tool is part of the RTI Connext distribution.
For more information, type 'rtiddsgen -help' at a command shell
or consult the RTI Connext manual.
*/
import java.util.Collection;
import com.rti.dds.infrastructure.Copyable;
import com.rti.dds.util.Enum;
import com.rti.dds.util.Sequence;
import com.rti.dds.util.LoanableSequence;
public final class HelloWorldSeq extends LoanableSequence implements Copyable {
// -----------------------------------------------------------------------
// Package Fields
// -----------------------------------------------------------------------
/*package*/ transient Sequence _loanedInfoSequence = null;
// -----------------------------------------------------------------------
// Public Fields
// -----------------------------------------------------------------------
// --- Constructors: -----------------------------------------------------
public HelloWorldSeq() {
super(HelloWorld.class);
}
public HelloWorldSeq (int initialMaximum) {
super(HelloWorld.class, initialMaximum);
}
public HelloWorldSeq (Collection elements) {
super(HelloWorld.class, elements);
}
// --- From Copyable: ----------------------------------------------------
public Object copy_from(Object src) {
Sequence typedSrc = (Sequence) src;
final int srcSize = typedSrc.size();
final int origSize = size();
// if this object's size is less than the source, ensure we have
// enough room to store all of the objects
if (getMaximum() < srcSize) {
setMaximum(srcSize);
}
// trying to avoid clear() method here since it allocates memory
// (an Iterator)
// if the source object has fewer items than the current object,
// remove from the end until the sizes are equal
if (srcSize < origSize){
removeRange(srcSize, origSize);
}
// copy the data from source into this (into positions that already
// existed)
for(int i = 0; (i < origSize) && (i < srcSize); i++){
if (typedSrc.get(i) == null){
set(i, null);
} else {
// check to see if our entry is null, if it is, a new instance has to be allocated
if (get(i) == null){
set(i, HelloWorld.create());
}
set(i, ((Copyable) get(i)).copy_from(typedSrc.get(i)));
}
}
// copy 'new' HelloWorld objects (beyond the original size of this object)
for(int i = origSize; i < srcSize; i++){
if (typedSrc.get(i) == null) {
add(null);
} else {
// NOTE: we need to create a new object here to hold the copy
add(HelloWorld.create());
// we need to do a set here since enums aren't truely Copyable
set(i, ((Copyable) get(i)).copy_from(typedSrc.get(i)));
}
}
return this;
}
}

RTI Connext Java API Version 5.1.0 Copyright © Tue Jul 1 2014 Real-Time Innovations, Inc