Programming Language Type Description
The following programming language specific type representation is generated by rtiddsgen for use in application code, where:
- Foo = HelloWorld
- FooSeq = HelloWorldSeq
HelloWorld.java
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= "" ;
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
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 {
transient Sequence _loanedInfoSequence = null;
public HelloWorldSeq() {
super(HelloWorld.class);
}
public HelloWorldSeq (int initialMaximum) {
super(HelloWorld.class, initialMaximum);
}
public HelloWorldSeq (Collection elements) {
super(HelloWorld.class, elements);
}
public HelloWorld get(int index) {
return (HelloWorld) super.get(index);
}
public Object copy_from(Object src) {
Sequence typedSrc = (Sequence) src;
final int srcSize = typedSrc.size();
final int origSize = size();
if (getMaximum() < srcSize) {
setMaximum(srcSize);
}
if (srcSize < origSize){
removeRange(srcSize, origSize);
}
for(int i = 0; (i < origSize) && (i < srcSize); i++){
if (typedSrc.get(i) == null){
set(i, null);
} else {
if (get(i) == null){
set(i, HelloWorld.create());
}
set(i, ((Copyable) get(i)).copy_from(typedSrc.get(i)));
}
}
for(int i = origSize; i < srcSize; i++){
if (typedSrc.get(i) == null) {
add(null);
} else {
add(HelloWorld.create());
set(i, ((Copyable) get(i)).copy_from(typedSrc.get(i)));
}
}
return this;
}
}