RTI Connext Java API Version 7.1.0
All Classes Namespaces Functions Variables Modules Pages
HelloWorldSeq.java

Programming Language Type Description

The following programming language specific type representation is generated by rtiddsgen (see the Code Generator User's Manual for more information) for use in application code, where:

HelloWorld.java

/*
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
This file was generated from .idl
using RTI Code Generator (rtiddsgen) version 4.1.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.infrastructure.*;
import com.rti.dds.infrastructure.Copyable;
import java.io.Serializable;
import com.rti.dds.cdr.CdrHelper;
// Depending on the type represented in the IDL, we may perform some redundant
// casts, we are suppressing that warning
@SuppressWarnings("cast")
public class HelloWorld implements Copyable, Serializable{
private static final long serialVersionUID = -742582614L;
public String msg= (String)""; /* maximum length = (128) */
public HelloWorld() {
}
public HelloWorld (HelloWorld other) {
this();
copy_from(other);
}
public static java.lang.Object create() {
HelloWorld self;
self = new HelloWorld();
self.clear();
return self;
}
public void clear() {
msg = (String)"";
}
@Override
public boolean equals(java.lang.Object o) {
if (o == null) {
return false;
}
if(getClass() != o.getClass()) {
return false;
}
HelloWorld otherObj = (HelloWorld)o;
if(!this.msg.equals(otherObj.msg)) {
return false;
}
return true;
}
@Override
public int hashCode() {
final int __prime = 31;
int __result = 1;
__result = __prime * __result + msg.hashCode();
return __result;
}
public java.lang.Object copy_from(java.lang.Object src) {
HelloWorld typedSrc = (HelloWorld) src;
HelloWorld typedDst = this;
typedDst.msg = typedSrc.msg;
return this;
}
@Override
public java.lang.String toString(){
return toString("", 0);
}
public java.lang.String toString(java.lang.String desc, int indent) {
java.lang.StringBuffer strBuffer = new java.lang.StringBuffer();
if (desc != null) {
CdrHelper.printIndent(strBuffer, indent);
strBuffer.append(desc).append(":\n");
}
CdrHelper.printIndent(strBuffer, indent+1);
strBuffer.append("msg: ").append(this.msg).append("\n");
return strBuffer.toString();
}
}

HelloWorldSeq.java

/*
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
This file was generated from .idl
using RTI Code Generator (rtiddsgen) version 4.1.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 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 {
private static final long serialVersionUID = 2003772976L;
// -----------------------------------------------------------------------
// 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);
}
public HelloWorld get(int index) {
return (HelloWorld) super.get(index);
}
// --- From Copyable: ----------------------------------------------------
@Override
public java.lang.Object copy_from(java.lang.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;
}
}