out.println("");
out.println("#include <activemq/connector/openwire/commands/"+baseClass+".h>");
List properties = getProperties();
for (Iterator iter = properties.iterator(); iter.hasNext();) {
JProperty property = (JProperty) iter.next();
if( !property.getType().isPrimitiveType() &&
!property.getType().getSimpleName().equals("String") &&
!property.getType().getSimpleName().equals("ByteSequence") )
{
String includeName = toCppType(property.getType());
if( property.getType().isArrayType() )
{
JClass arrayType = property.getType().getArrayComponentType();
if( arrayType.isPrimitiveType() )
continue;
}
if( includeName.startsWith("std::vector") ) {
includeName = includeName.substring(12, includeName.length()-2);
}
out.println("#include <activemq/connector/openwire/commands/"+includeName+".h>");
}
}
out.println("#include <vector>");
out.println("#include <string>");
out.println("");
out.println("namespace activemq{");
out.println("namespace connector{");
out.println("namespace openwire{");
out.println("namespace commands{");
out.println("");
out.println(" /*");
out.println(" *");
out.println(" * Command and marshaling code for OpenWire format for "+className );
out.println(" *");
out.println(" *");
out.println(" * NOTE!: This file is autogenerated - do not modify!");
out.println(" * if you need to make a change, please see the Java Classes");
out.println(" * in the activemq-openwire-generator module");
out.println(" *");
out.println(" */");
out.println(" class "+className+" : public "+getProperBaseClassName( className, baseClass ) );
out.println(" {");
out.println(" protected:");
out.println("");
for (Iterator iter = properties.iterator(); iter.hasNext();) {
JProperty property = (JProperty) iter.next();
String type = toCppType(property.getType());
String name = decapitalize(property.getSimpleName());
if( !property.getType().isPrimitiveType() &&
!property.getType().getSimpleName().equals("ByteSequence") &&
!property.getType().getSimpleName().equals("String") &&
!type.startsWith("std::vector") ) {
type = type + "*";
}
out.println(" "+type+" "+name+";");
}
String typeName = className.toUpperCase();
out.println("");
out.println(" public:");
out.println("");
out.println(" const static unsigned char ID_"+typeName+" = "+getOpenWireOpCode(jclass)+";");
out.println("");
out.println(" public:");
out.println("");
out.println(" "+className+"();");
out.println(" virtual ~"+className+"();");
out.println("");
out.println(" /**");
out.println(" * Get the unique identifier that this object and its own");
out.println(" * Marshaller share.");
out.println(" * @returns new DataStructure type copy.");
out.println(" */");
out.println(" virtual unsigned char getDataStructureType() const;");
out.println("");
out.println(" /**");
out.println(" * Clone this object and return a new instance that the");
out.println(" * caller now owns, this will be an exact copy of this one");
out.println(" * @returns new copy of this object.");
out.println(" */");
out.println(" virtual DataStructure* cloneDataStructure() const;");
out.println("");
out.println(" /**");
out.println(" * Copy the contents of the passed object into this object's");
out.println(" * members, overwriting any existing data.");
out.println(" * @param src - Source Object");
out.println(" */");
out.println(" virtual void copyDataStructure( const DataStructure* src );");
out.println("");
out.println(" /**");
out.println(" * Returns a string containing the information for this DataStructure");
out.println(" * such as its type and value of its elements.");
out.println(" * @return formatted string useful for debugging.");
out.println(" */");
out.println(" virtual std::string toString() const;");
out.println("");
out.println(" /**" );
out.println(" * Compares the DataStructure passed in to this one, and returns if" );
out.println(" * they are equivalent. Equivalent here means that they are of the" );
out.println(" * same type, and that each element of the objects are the same." );
out.println(" * @returns true if DataStructure's are Equal." );
out.println(" */" );
out.println(" virtual bool equals( const DataStructure* value ) const;" );
out.println("");
for( Iterator iter = properties.iterator(); iter.hasNext(); ) {
JProperty property = (JProperty) iter.next();
String type = toCppType(property.getType());
String propertyName = property.getSimpleName();
String parameterName = decapitalize(propertyName);
String constness = "";
if( !property.getType().isPrimitiveType() &&
!property.getType().getSimpleName().equals("ByteSequence") &&
!property.getType().getSimpleName().equals("String") &&
!type.startsWith("std::vector") ) {
type = type + "*";
} else if( property.getType().getSimpleName().equals("String") ||
type.startsWith("std::vector") ) {
type = type + "&";
constness = "const ";
}
if( property.getType().isPrimitiveType() ) {
out.println(" virtual "+type+" "+property.getGetter().getSimpleName()+"() const;");
} else {
out.println(" virtual const "+type+" "+property.getGetter().getSimpleName()+"() const;");
out.println(" virtual "+type+" "+property.getGetter().getSimpleName()+"();");
}
out.println(" virtual void "+property.getSetter().getSimpleName()+"( "+constness+type+" "+parameterName+" );");
out.println("");
}
out.println(" };");
out.println("");