diff options
author | Kim van der Riet <kpvdr@apache.org> | 2006-11-21 19:44:40 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2006-11-21 19:44:40 +0000 |
commit | 03b8de17239609c9de5e18e0d59eccdd004067eb (patch) | |
tree | 4ac6b915f0983e76deda9691f7b0ac90f8b4fded | |
parent | 4ac1fb1bc85fbad989deca30410d18eefb727837 (diff) | |
download | qpid-python-03b8de17239609c9de5e18e0d59eccdd004067eb.tar.gz |
Updates and bugfixes
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@477844 13f79535-47bb-0310-9956-ffa450edef68
23 files changed, 778 insertions, 601 deletions
diff --git a/gentools/org/apache/qpid/gentools/AmqpOrdinalVersionMap.java b/gentools/org/apache/qpid/gentools/AmqpOrdinalVersionMap.java index 5e0a0dbf81..234e3452a2 100644 --- a/gentools/org/apache/qpid/gentools/AmqpOrdinalVersionMap.java +++ b/gentools/org/apache/qpid/gentools/AmqpOrdinalVersionMap.java @@ -20,6 +20,7 @@ */ package org.apache.qpid.gentools; +import java.util.Iterator; import java.util.TreeMap; @SuppressWarnings("serial") @@ -31,4 +32,18 @@ public class AmqpOrdinalVersionMap extends TreeMap<Integer, AmqpVersionSet> impl return false; return get(firstKey()).equals(globalVersionSet); } + + public int getOrdinal(AmqpVersion version) + throws AmqpTypeMappingException + { + Iterator<Integer> itr = keySet().iterator(); + while (itr.hasNext()) + { + int ordinal = itr.next(); + AmqpVersionSet versionSet = get(ordinal); + if (versionSet.contains(version)) + return ordinal; + } + throw new AmqpTypeMappingException("Unable to locate version " + version + " in ordianl version map."); + } } diff --git a/gentools/org/apache/qpid/gentools/AmqpVersionSet.java b/gentools/org/apache/qpid/gentools/AmqpVersionSet.java index fe15a59f4a..06b10cfda6 100644 --- a/gentools/org/apache/qpid/gentools/AmqpVersionSet.java +++ b/gentools/org/apache/qpid/gentools/AmqpVersionSet.java @@ -39,7 +39,7 @@ public class AmqpVersionSet extends TreeSet<AmqpVersion> implements Printable, C public void print(PrintStream out, int marginSize, int tabSize) { - out.print(Utils.createSpaces(marginSize) + "Version Set: " + toString()); + out.print(Utils.createSpaces(marginSize) + "Version Set: " + toString() + Utils.lineSeparator); } public int compareTo(AmqpVersionSet other) diff --git a/gentools/org/apache/qpid/gentools/CppGenerator.java b/gentools/org/apache/qpid/gentools/CppGenerator.java index 27db34418e..f6dea0f669 100644 --- a/gentools/org/apache/qpid/gentools/CppGenerator.java +++ b/gentools/org/apache/qpid/gentools/CppGenerator.java @@ -33,15 +33,35 @@ public class CppGenerator extends Generator protected static final String versionNamespaceEndToken = "${version_namespace_end}"; protected static final int FIELD_NAME = 0; protected static final int FIELD_DOMAIN = 1; + + /** + * A complete list of C++ reserved words. The names of varous XML elements within the AMQP + * specification file are used for C++ identifier names in the generated code. Each proposed + * name is checked against this list and is modified (by adding an '_' to the end of the + * name - see function parseForReservedWords()) if found to be present. + */ protected static final String[] cppReservedWords = {"and", "and_eq", "asm", "auto", "bitand", "bitor", "bool", "break", "case", "catch", "char", "class", "compl", "const", "const_cast", "continue", "default", "delete", "do", "DomainInfo", "double", "dynamic_cast", "else", "enum", "explicit", "extern", "false", "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "not", "not_eq", "operator", "or", "or_eq", "private", "protected", "public", "register", "reinterpret_cast", "return", "short", - "signed", "sizeof", "static", "static_cast", "string", "struct", "switch", "template", "this", + "signed", "sizeof", "static", "static_cast", "struct", "switch", "template", "this", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq"}; + + /** + * Although not reserved words, the following list of variable names that may cause compile + * problems within a C++ environment because they clash with common #includes. The names of + * varous XML elements within the AMQP specification file are used for C++ identifier names + * in the generated code. Each proposed name is checked against this list and is modified + * (by adding an '_' to the end of the name - see function parseForReservedWords()) if found + * to be present. This list is best added to on an as-needed basis. + */ + protected static final String[] cppCommonDefines = {"string"}; + + // TODO: Move this to the Generator superclass? + protected boolean quietFlag; // Supress warning messages to the console private class DomainInfo { @@ -64,6 +84,7 @@ public class CppGenerator extends Generator public CppGenerator(AmqpVersionSet versionList) { super(versionList); + quietFlag = true; // Load C++ type and size maps. // Adjust or add to these lists as new types are added/defined. // The char '#' will be replaced by the field variable name (any type). @@ -114,6 +135,16 @@ public class CppGenerator extends Generator "buffer.putLongLong(#)", // encodeExpression "buffer.getLongLong(#)")); // decodeExpression } + + public boolean isQuietFlag() + { + return quietFlag; + } + + public void setQuietFlag(boolean quietFlag) + { + this.quietFlag = quietFlag; + } // === Start of methods for Interface LanguageConverter === @@ -135,15 +166,15 @@ public class CppGenerator extends Generator public String getDomainType(String domainName, AmqpVersion version) throws AmqpTypeMappingException { + if (version == null) + version = globalVersionSet.first(); return globalDomainMap.getDomainType(domainName, version); } public String getGeneratedType(String domainName, AmqpVersion version) throws AmqpTypeMappingException { - if (version == null) - version = globalVersionSet.first(); - String domainType = globalDomainMap.getDomainType(domainName, version); + String domainType = getDomainType(domainName, version); if (domainType == null) throw new AmqpTypeMappingException("Domain type \"" + domainName + "\" not found in C++ typemap."); @@ -167,23 +198,23 @@ public class CppGenerator extends Generator } @Override - protected void processTemplate(String[] template) + protected void processTemplateA(String[] template) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException { - processTemplate(template, null, null, null); + processTemplateD(template, null, null, null); } @Override - protected void processTemplate(String[] template, AmqpClass thisClass) + protected void processTemplateB(String[] template, AmqpClass thisClass) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException { - processTemplate(template, thisClass, null, null); + processTemplateD(template, thisClass, null, null); } @Override - protected void processTemplate(String[] template, AmqpClass thisClass, + protected void processTemplateC(String[] template, AmqpClass thisClass, AmqpMethod method) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException @@ -216,6 +247,8 @@ public class CppGenerator extends Generator version); sb.insert(namespaceStartIndex, nssb); } + // Process all tokens *not* within the namespace span prior to inserting namespaces + processTemplate(sb, thisClass, method, null, template[templateFileNameIndex], null); } templateProcessedFlag = true; } @@ -243,7 +276,7 @@ public class CppGenerator extends Generator } @Override - protected void processTemplate(String[] template, AmqpClass thisClass, AmqpMethod method, + protected void processTemplateD(String[] template, AmqpClass thisClass, AmqpMethod method, AmqpField field) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException @@ -262,19 +295,19 @@ public class CppGenerator extends Generator try { processAllLists(sb, thisClass, method, version); } catch (AmqpTemplateException e) { - System.out.println("WARNING: " + templateFileName + ": " + e.getMessage()); + System.out.println("ERROR: " + templateFileName + ": " + e.getMessage()); } try { processAllTokens(sb, thisClass, method, field, version); } catch (AmqpTemplateException e) { - System.out.println("WARNING: " + templateFileName + ": " + e.getMessage()); + System.out.println("ERROR: " + templateFileName + ": " + e.getMessage()); } } @Override protected String processToken(String token, AmqpClass thisClass, AmqpMethod method, AmqpField field, AmqpVersion version) - throws AmqpTemplateException + throws AmqpTemplateException, AmqpTypeMappingException { if (token.compareTo("${GENERATOR}") == 0) return generatorInfo; @@ -300,7 +333,13 @@ public class CppGenerator extends Generator return "namespace " + version.namespace() + cr + "{"; if (token.compareTo(versionNamespaceEndToken) == 0 && version != null) return "} // namespace " + version.namespace(); - + if (token.compareTo("${mb_constructor_with_initializers}") == 0) + return generateConstructor(thisClass, method, version, 4, 4); + if (token.compareTo("${mb_server_operation_invoke}") == 0) + return generateServerOperationsInvoke(thisClass, method, version, 4, 4); + if (token.compareTo("${mb_buffer_param}") == 0) + return method.fieldMap.size() > 0 ? " buffer" : ""; + throw new AmqpTemplateException("Template token " + token + " unknown."); } @@ -361,6 +400,14 @@ public class CppGenerator extends Generator { codeSnippet = generateProxyInnerClassImpl(model, false, 0, 4); } + else if (token.compareTo("${cph_handler_pointer_defn}") == 0) + { + codeSnippet = generateHandlerPointerDefinitions(model, false, 4); + } + else if (token.compareTo("${cph_handler_pointer_get_method}") == 0) + { + codeSnippet = generateHandlerPointerGetMethods(model, false, 4); + } // SerrverProxy.h/cpp else if (token.compareTo("${sph_inner_class_instance}") == 0) @@ -387,7 +434,29 @@ public class CppGenerator extends Generator { codeSnippet = generateProxyInnerClassImpl(model, true, 0, 4); } + else if (token.compareTo("${sph_handler_pointer_defn}") == 0) + { + codeSnippet = generateHandlerPointerDefinitions(model, true, 4); + } + else if (token.compareTo("${sph_handler_pointer_get_method}") == 0) + { + codeSnippet = generateHandlerPointerGetMethods(model, true, 4); + } + // amqp_methods.h/cpp + else if (token.compareTo("${mh_method_body_class_indlude}") == 0) + { + codeSnippet = generateMethodBodyIncludeList(model, 0); + } + else if (token.compareTo("${mh_method_body_class_instance}") == 0) + { + codeSnippet = generateMethodBodyInstances(model, 0); + } + else if (token.compareTo("${mc_create_method_body_map_entry}") == 0) + { + codeSnippet = generateMethodBodyMapEntry(model, 4); + } + else // Oops! { throw new AmqpTemplateException("Template token \"" + token + "\" unknown."); @@ -400,7 +469,31 @@ public class CppGenerator extends Generator AmqpClass thisClass) throws AmqpTemplateException, AmqpTypeMappingException { -// TODO + String codeSnippet; + int lend = sb.indexOf(cr, listMarkerStartIndex) + 1; // Include cr at end of line + String tline = sb.substring(listMarkerEndIndex, lend); // Line excluding line marker, including cr + int tokxStart = tline.indexOf('$'); + String token = tline.substring(tokxStart).trim(); + sb.delete(listMarkerStartIndex, lend); + + if (token.compareTo("${cpc_method_body_include}") == 0) + { + codeSnippet = generateMethodBodyIncludes(thisClass, 0); + } + else if (token.compareTo("${spc_method_body_include}") == 0) + { + codeSnippet = generateMethodBodyIncludes(thisClass, 0); + } + else if (token.compareTo("${mc_method_body_include}") == 0) + { + codeSnippet = generateMethodBodyIncludes(thisClass, 0); + } + + else // Oops! + { + throw new AmqpTemplateException("Template token " + token + " unknown."); + } + sb.insert(listMarkerStartIndex, codeSnippet); } @Override @@ -440,18 +533,14 @@ public class CppGenerator extends Generator { codeSnippet = generateDecodeMethodContents(fieldMap, version, 8); } - else if (token.compareTo("${mb_field_list}") == 0) - { - codeSnippet = generateFieldList(fieldMap, version, false, false, 8); - } - else if (token.compareTo("${mb_field_list_initializer}") == 0) - { - codeSnippet = generateFieldList(fieldMap, version, false, true, 8); - } - else if (token.compareTo("${mb_field_list_declare}") == 0) - { - codeSnippet = generateFieldList(fieldMap, version, true, false, 8); - } +// else if (token.compareTo("${mb_field_list_initializer}") == 0) +// { +// codeSnippet = generateFieldList(fieldMap, version, false, true, 8); +// } +// else if (token.compareTo("${mb_field_list_declare}") == 0) +// { +// codeSnippet = generateFieldList(fieldMap, version, true, false, 8); +// } else // Oops! { @@ -618,7 +707,7 @@ public class CppGenerator extends Generator chassisFoundFlag = true; } if (chassisFoundFlag) - sb.append(indent + "virtual AMQP_ServerOperations::" + + sb.append(indent + "virtual AMQP_" + (serverFlag ? "Server" : "Client") + "Operations::" + thisClass.name + "Handler* get" + thisClass.name + "Handler() = 0;" + cr); } return sb.toString(); @@ -648,10 +737,12 @@ public class CppGenerator extends Generator sb.append(indent + "{" + cr); sb.append(indent + "private:" + cr); sb.append(indent + tab + "ProtocolVersion version;" + cr); - sb.append(cr); + sb.append(cr); + sb.append(indent + tab + "// Constructors and destructors" + cr); + sb.append(cr); + sb.append(indent + "protected:" + cr); + sb.append(indent + tab + className + "() {}" + cr); sb.append(indent + "public:" + cr); - sb.append(indent + tab + "// Constructors and destructors" + cr); - sb.append(cr); sb.append(indent + tab + className + "(u_int8_t major, u_int8_t minor) : version(major, minor) {}" + cr); sb.append(indent + tab + className + @@ -694,7 +785,7 @@ public class CppGenerator extends Generator if (!first) sb.append(cr); sb.append(indent + "virtual void " + methodName + "( u_int16_t channel"); - sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize), true, true)); + sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize), true, true, true)); sb.append(" )"); if (abstractMethodFlag) sb.append(" = 0"); @@ -710,7 +801,39 @@ public class CppGenerator extends Generator } // Methods used for generation of code snippets for Server/ClientProxy class generation - + + protected String generateHandlerPointerDefinitions(AmqpModel model, boolean serverFlag, + int indentSize) + { + String indent = Utils.createSpaces(indentSize); + StringBuffer sb = new StringBuffer(); + String outerClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Operations"; + Iterator<String> cItr = model.classMap.keySet().iterator(); + while (cItr.hasNext()) + { + AmqpClass thisClass = model.classMap.get(cItr.next()); + sb.append(indent + outerClassName + "::" + thisClass.name + "Handler* " + + thisClass.name + "HandlerPtr;" + cr); + } + return sb.toString(); + } + + protected String generateHandlerPointerGetMethods(AmqpModel model, boolean serverFlag, + int indentSize) + { + String indent = Utils.createSpaces(indentSize); + StringBuffer sb = new StringBuffer(); + String outerClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Operations"; + Iterator<String> cItr = model.classMap.keySet().iterator(); + while (cItr.hasNext()) + { + AmqpClass thisClass = model.classMap.get(cItr.next()); + sb.append(indent + "virtual inline " + outerClassName + "::" + thisClass.name + "Handler* get" + + thisClass.name + "Handler() { return &" + Utils.firstLower(thisClass.name) + ";}" + cr); + } + return sb.toString(); + } + protected String generateProxyInnerClassInstances(AmqpModel model, boolean serverFlag, int indentSize) { @@ -723,7 +846,7 @@ public class CppGenerator extends Generator AmqpClass thisClass = model.classMap.get(cItr.next()); String instanceName = parseForReservedWords(Utils.firstLower(thisClass.name), outerClassName); String className = parseForReservedWords(thisClass.name, null); - sb.append(indent + instanceName + " " + className + ";"); + sb.append(indent + className + " " + instanceName + ";"); if (thisClass.versionSet.size() != globalVersionSet.size()) sb.append(" // AMQP Version(s) " + thisClass.versionSet + cr); else @@ -778,8 +901,8 @@ public class CppGenerator extends Generator sb.append(cr); sb.append(indent + "{" + cr); sb.append(indent + "private:" + cr); + sb.append(indent + tab + "OutputHandler* out;" + cr); sb.append(indent + tab + "ProtocolVersion version;" + cr); - sb.append(indent + tab + "OutputHandler* out;" + cr); sb.append(cr); sb.append(indent + "public:" + cr); sb.append(indent + tab + "// Constructors and destructors" + cr); @@ -802,18 +925,18 @@ public class CppGenerator extends Generator protected String generateProxyConstructorInitializers(AmqpModel model, boolean serverFlag, int indentSize) { - String indent = Utils.createSpaces(indentSize); - StringBuffer sb = new StringBuffer(indent + "out(out)," + cr); String outerClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; - sb.append(indent + "major(major)," + cr); - sb.append(indent + "minor(minor)"); + String superclassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Operations"; + String indent = Utils.createSpaces(indentSize); + StringBuffer sb = new StringBuffer(indent + superclassName + "(major, minor)," + cr); + sb.append(indent + "out(out)"); Iterator<String> cItr = model.classMap.keySet().iterator(); while (cItr.hasNext()) { AmqpClass thisClass = model.classMap.get(cItr.next()); String instanceName = parseForReservedWords(Utils.firstLower(thisClass.name), outerClassName); sb.append("," + cr); - sb.append(indent + instanceName + "(out)"); + sb.append(indent + instanceName + "(out, major, minor)"); if (!cItr.hasNext()) sb.append(cr); } @@ -887,6 +1010,7 @@ public class CppGenerator extends Generator String methodBodyClassName = thisClass.name + Utils.firstUpper(method.name) + "Body"; boolean clientChassisFlag = method.clientMethodFlagMap.isSet(); boolean serverChassisFlag = method.serverMethodFlagMap.isSet(); + boolean versionConsistentFlag = method.isVersionConsistent(globalVersionSet); if ((serverFlag && serverChassisFlag) || (!serverFlag && clientChassisFlag)) { String methodName = parseForReservedWords(method.name, outerclassName + "." + thisClass.name); @@ -897,18 +1021,19 @@ public class CppGenerator extends Generator { AmqpOrdinalFieldMap fieldMap = ofmItr.next(); AmqpVersionSet versionSet = overloadededParameterMap.get(fieldMap); - boolean versionConsistentFlag = versionSet.size() == globalVersionSet.size(); +// boolean versionConsistentFlag = versionSet.size() == globalVersionSet.size(); if (!first) sb.append(cr); - sb.append(indent + "void " + outerclassName + "::" + methodName + "( u_int16_t channel"); - sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize), true, true)); + sb.append(indent + "void " + outerclassName + "::" + thisClass.name + "::" + + methodName + "( u_int16_t channel"); + sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize), true, true, true)); sb.append(" )"); - if (!versionConsistentFlag) + if (versionSet.size() != globalVersionSet.size()) sb.append(" // AMQP Version(s) " + versionSet); sb.append(cr); sb.append(indent + "{" + cr); sb.append(generateMethodBodyCallContext(fieldMap, outerclassName, methodBodyClassName, - versionSet, indentSize + tabSize, tabSize)); + versionConsistentFlag, versionSet, indentSize + tabSize, tabSize)); sb.append(indent + "}" + cr); sb.append(cr); first = false; @@ -919,13 +1044,14 @@ public class CppGenerator extends Generator } protected String generateMethodBodyCallContext(AmqpOrdinalFieldMap fieldMap, String outerclassName, - String methodBodyClassName, AmqpVersionSet versionSet, int indentSize, int tabSize) + String methodBodyClassName, boolean versionConsistentFlag, AmqpVersionSet versionSet, + int indentSize, int tabSize) throws AmqpTypeMappingException { String indent = Utils.createSpaces(indentSize); String tab = Utils.createSpaces(tabSize); StringBuffer sb = new StringBuffer(); - if (versionSet.size() == globalVersionSet.size()) + if (versionConsistentFlag) { sb.append(generateMethodBodyCall(fieldMap, methodBodyClassName, null, indentSize, tabSize)); } @@ -948,9 +1074,9 @@ public class CppGenerator extends Generator } sb.append(indent + "else" + cr); sb.append(indent + "{" + cr); - sb.append(indent + tab + "stringstream ss;" + cr); + sb.append(indent + tab + "std::stringstream ss;" + cr); sb.append(indent + tab + "ss << \"Call to " + outerclassName + "::" + methodBodyClassName + - "(u_int16_t" + generateMethodParameterList(fieldMap, 0, true, false) + ")\"" + cr); + "(u_int16_t" + generateMethodParameterList(fieldMap, 0, true, true, false) + ")\"" + cr); sb.append(indent + tab + tab + "<< \" is invalid for AMQP version \" << version.toString() << \".\";" + cr); sb.append(indent + tab + "throw new ProtocolVersionException(ss.str());" + cr); sb.append(indent + "}" + cr); @@ -965,13 +1091,46 @@ public class CppGenerator extends Generator String indent = Utils.createSpaces(indentSize); String tab = Utils.createSpaces(tabSize); String namespace = version != null ? version.namespace() + "::" : ""; - StringBuffer sb = new StringBuffer(indent + "out->send( new AMQP_Frame( channel," + cr); - sb.append(indent + tab + "new " + namespace + methodBodyClassName + "("); - sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize), false, true)); + StringBuffer sb = new StringBuffer(indent + "out->send( new AMQFrame( channel," + cr); + sb.append(indent + tab + "new " + namespace + methodBodyClassName + "( version"); + sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize), true, false, true)); sb.append(" )));" + cr); return sb.toString(); } - + + protected String generateMethodBodyIncludes(AmqpClass thisClass, int indentSize) + { + StringBuffer sb = new StringBuffer(); + if (thisClass != null) + { + sb.append(generateClassMethodBodyInclude(thisClass, indentSize)); + } + else + { + Iterator<String> cItr = model.classMap.keySet().iterator(); + while (cItr.hasNext()) + { + thisClass = model.classMap.get(cItr.next()); + sb.append(generateClassMethodBodyInclude(thisClass, indentSize)); + } + } + return sb.toString(); + } + + protected String generateClassMethodBodyInclude(AmqpClass thisClass, int indentSize) + { + StringBuffer sb = new StringBuffer(); + String indent = Utils.createSpaces(indentSize); + Iterator<String> mItr = thisClass.methodMap.keySet().iterator(); + while (mItr.hasNext()) + { + AmqpMethod method = thisClass.methodMap.get(mItr.next()); + sb.append(indent + "#include <qpid/framing/" + thisClass.name + + Utils.firstUpper(method.name) + "Body.h>" + cr); + } + return sb.toString(); + } + // Methods used for generation of code snippets for MethodBody class generation protected String getIndex(AmqpOrdinalVersionMap indexMap, AmqpVersion version) @@ -1003,7 +1162,7 @@ public class CppGenerator extends Generator String[] fieldDomainPair = ordinalFieldMap.get(oItr.next()); sb.append(indent + fieldDomainPair[FIELD_DOMAIN] + " " + fieldDomainPair[FIELD_NAME] + ";" + cr); } - + // TODO: Replace the pattern below with that above in the JavaGenerator and elsewhere here. // Iterator<String> fItr = fieldMap.keySet().iterator(); // while(fItr.hasNext()) // { @@ -1070,6 +1229,7 @@ public class CppGenerator extends Generator } protected String generatePrintMethodContents(AmqpFieldMap fieldMap, AmqpVersion version, int indentSize) + throws AmqpTypeMappingException { String indent = Utils.createSpaces(indentSize); StringBuffer sb = new StringBuffer(); @@ -1077,16 +1237,37 @@ public class CppGenerator extends Generator boolean firstFlag = true; while(fItr.hasNext()) { - String fieldName = fItr.next(); - AmqpField fieldDetails = fieldMap.get(fieldName); - if (version == null || fieldDetails.versionSet.contains(version)) - { - sb.append(indent + "out << \""); - if (!firstFlag) - sb.append("; "); - sb.append(fieldName + "=\" << " + fieldName + ";" + cr); - firstFlag = false; - } + AmqpField fieldDetails = fieldMap.get(fItr.next()); + if (version == null) // Version consistent - there *should* be only one domain + { + String domainName = fieldDetails.domainMap.firstKey(); + String codeType = getGeneratedType(domainName, globalVersionSet.first()); + String cast = codeType.compareTo("u_int8_t") == 0 ? "(int)" : ""; + sb.append(indent + "out << \""); + if (!firstFlag) + sb.append("; "); + sb.append(fieldDetails.name + "=\" << " + cast + fieldDetails.name + ";" + cr); + firstFlag = false; + } + else + { + Iterator<String> dItr = fieldDetails.domainMap.keySet().iterator(); + while (dItr.hasNext()) + { + String domainName = dItr.next(); + AmqpVersionSet versionSet = fieldDetails.domainMap.get(domainName); + if (versionSet.contains(version)) + { + String codeType = getGeneratedType(domainName, version); + String cast = codeType.compareTo("u_int8_t") == 0 ? "(int)" : ""; + sb.append(indent + "out << \""); + if (!firstFlag) + sb.append("; "); + sb.append(fieldDetails.name + "=\" << " + cast + fieldDetails.name + ";" + cr); + firstFlag = false; + } + } + } } return sb.toString(); } @@ -1305,7 +1486,7 @@ public class CppGenerator extends Generator } protected String generateMethodParameterList(AmqpOrdinalFieldMap fieldMap, int indentSize, - boolean leadingCommaFlag, boolean fieldNameFlag) + boolean leadingCommaFlag, boolean fieldTypeFlag, boolean fieldNameFlag) throws AmqpTypeMappingException { String indent = Utils.createSpaces(indentSize); @@ -1323,13 +1504,150 @@ public class CppGenerator extends Generator { sb.append(indent); } - sb.append(setRef(field[FIELD_DOMAIN]) + + sb.append( + (fieldTypeFlag ? setRef(field[FIELD_DOMAIN]) : "") + (fieldNameFlag ? " " + field[FIELD_NAME] : "") + (pItr.hasNext() ? "," + (fieldNameFlag ? cr : " ") : "")); first = false; } return sb.toString(); } + + protected String generateConstructor(AmqpClass thisClass, AmqpMethod method, + AmqpVersion version, int indentSize, int tabSize) + throws AmqpTypeMappingException + { + String indent = Utils.createSpaces(indentSize); + String tab = Utils.createSpaces(tabSize); + StringBuffer sb = new StringBuffer(); + if (method.fieldMap.size() > 0) + { + sb.append(indent + thisClass.name + Utils.firstUpper(method.name) + "Body(ProtocolVersion version," + cr); + sb.append(generateFieldList(method.fieldMap, version, true, false, 8)); + sb.append(indent + tab + ") :" + cr); + sb.append(indent + tab + "AMQMethodBody(version)," + cr); + sb.append(generateFieldList(method.fieldMap, version, false, true, 8)); + sb.append(indent + "{ }" + cr); + } + return sb.toString(); + } + + protected String generateServerOperationsInvoke(AmqpClass thisClass, AmqpMethod method, + AmqpVersion version, int indentSize, int tabSize) + throws AmqpTypeMappingException + { + String indent = Utils.createSpaces(indentSize); + String tab = Utils.createSpaces(tabSize); + StringBuffer sb = new StringBuffer(); + + if (method.serverMethodFlagMap.size() > 0) // At least one AMQP version defines this method as a server method + { + Iterator<Boolean> bItr = method.serverMethodFlagMap.keySet().iterator(); + while (bItr.hasNext()) + { + if (bItr.next()) // This is a server operation + { + boolean fieldMapNotEmptyFlag = method.fieldMap.size() > 0; + sb.append(indent + "inline void invoke(AMQP_ServerOperations& target, u_int16_t channel)" + cr); + sb.append(indent + "{" + cr); + sb.append(indent + tab + "target.get" + thisClass.name + "Handler()->" + + parseForReservedWords(Utils.firstLower(method.name), + thisClass.name + Utils.firstUpper(method.name) + "Body.invoke()") + "(channel"); + if (fieldMapNotEmptyFlag) + { + sb.append("," + cr); + sb.append(generateFieldList(method.fieldMap, version, false, false, indentSize + 4*tabSize)); + sb.append(indent + tab + tab + tab + tab); + } + sb.append(");" + cr); + sb.append(indent + "}" + cr); + } + } + } + return sb.toString(); + } + + // Methods for generation of code snippets for amqp_methods.h/cpp files + + protected String generateMethodBodyIncludeList(AmqpModel model, int indentSize) + { + String indent = Utils.createSpaces(indentSize); + StringBuffer sb = new StringBuffer(); + + Iterator<String> cItr = model.classMap.keySet().iterator(); + while (cItr.hasNext()) + { + AmqpClass thisClass = model.classMap.get(cItr.next()); + Iterator<String> mItr = thisClass.methodMap.keySet().iterator(); + while (mItr.hasNext()) + { + AmqpMethod method = thisClass.methodMap.get(mItr.next()); + sb.append(indent + "#include \"" + thisClass.name + Utils.firstUpper(method.name) + "Body.h\"" + cr); + } + } + + return sb.toString(); + } + + protected String generateMethodBodyInstances(AmqpModel model, int indentSize) + { + String indent = Utils.createSpaces(indentSize); + StringBuffer sb = new StringBuffer(); + + Iterator<String> cItr = model.classMap.keySet().iterator(); + while (cItr.hasNext()) + { + AmqpClass thisClass = model.classMap.get(cItr.next()); + Iterator<String> mItr = thisClass.methodMap.keySet().iterator(); + while (mItr.hasNext()) + { + AmqpMethod method = thisClass.methodMap.get(mItr.next()); + sb.append(indent + "const " + thisClass.name + Utils.firstUpper(method.name) + "Body " + + Utils.firstLower(thisClass.name) + "_" + method.name + ";" + cr); + } + } + + return sb.toString(); + } + + protected String generateMethodBodyMapEntry(AmqpModel model, int indentSize) + throws AmqpTypeMappingException + { + String indent = Utils.createSpaces(indentSize); + StringBuffer sb = new StringBuffer(); + + Iterator<AmqpVersion> vItr = globalVersionSet.iterator(); + while (vItr.hasNext()) + { + AmqpVersion version = vItr.next(); + Iterator<String> cItr = model.classMap.keySet().iterator(); + while (cItr.hasNext()) + { + AmqpClass thisClass = model.classMap.get(cItr.next()); + Iterator<String> mItr = thisClass.methodMap.keySet().iterator(); + while (mItr.hasNext()) + { + AmqpMethod method = thisClass.methodMap.get(mItr.next()); + String namespace = method.isVersionConsistent(globalVersionSet) ? "" : version.namespace() + "::"; + try + { + int classOrdinal = thisClass.indexMap.getOrdinal(version); + int methodOrdinal = method.indexMap.getOrdinal(version); + String methodModyClassName = namespace + thisClass.name + Utils.firstUpper(method.name) + "Body"; + sb.append(indent + "insert(std::make_pair(createMapKey(" + classOrdinal + ", " + + methodOrdinal + ", " + version.getMajor() + ", " + version.getMinor() + + "), &createMethodBodyFn<" + methodModyClassName + ">));" + cr); + } + catch (AmqpTypeMappingException e) {} // ignore + } + } + } + + return sb.toString(); + } + + + // Helper functions private String generateVersionCheck(AmqpVersion version) { @@ -1360,11 +1678,27 @@ public class CppGenerator extends Generator for (int i=0; i<cppReservedWords.length; i++) if (name.compareTo(cppReservedWords[i]) == 0) { - System.out.println("WARNING: " + (context == null ? "" : context + ": ") + - "Found XML method \"" + name + "\", which is a C++ reserved word. " + - "Changing generated name to \"" + name + "_\"."); + if (!quietFlag) + { + System.out.println("WARNING: " + (context == null ? "" : context + ": ") + + "Found XML method \"" + name + "\", which is a C++ reserved word. " + + "Changing generated name to \"" + name + "_\"."); + } return name + "_"; } + + for (int i=0; i<cppCommonDefines.length; i++) + if (name.compareTo(cppCommonDefines[i]) == 0) + { + if (!quietFlag) + { + System.out.println("WARNING: " + (context == null ? "" : context + ": ") + + "Found XML method \"" + name + "\", which may clash with commonly used defines within C++. " + + "Changing generated name to \"" + name + "_\"."); + } + return name + "_"; + } + return name; } diff --git a/gentools/org/apache/qpid/gentools/Generator.java b/gentools/org/apache/qpid/gentools/Generator.java index 75b980cc7b..8ed54a2387 100644 --- a/gentools/org/apache/qpid/gentools/Generator.java +++ b/gentools/org/apache/qpid/gentools/Generator.java @@ -150,7 +150,7 @@ public abstract class Generator implements LanguageConverter abstract protected String processToken(String token, AmqpClass thisClass, AmqpMethod method, AmqpField field, AmqpVersion version) - throws AmqpTemplateException; + throws AmqpTemplateException, AmqpTypeMappingException; abstract protected void processClassList(StringBuffer sb, int listMarkerStartIndex, int listMarkerEndIndex, AmqpModel model) @@ -180,7 +180,7 @@ public abstract class Generator implements LanguageConverter // Use all model-level templates for (int t = 0; t < modelTemplateList.size(); t++) { - processTemplate(modelTemplateList.get(t)); + processTemplateA(modelTemplateList.get(t)); } // Cycle through classes @@ -193,7 +193,7 @@ public abstract class Generator implements LanguageConverter // Use all class-level templates for (int c = 0; c < classTemplateList.size(); c++) { - processTemplate(classTemplateList.get(c), thisClass); + processTemplateB(classTemplateList.get(c), thisClass); } // Cycle through all methods @@ -206,7 +206,7 @@ public abstract class Generator implements LanguageConverter // Use all method-level templates for (int m = 0; m < methodTemplateList.size(); m++) { - processTemplate(methodTemplateList.get(m), thisClass, method); + processTemplateC(methodTemplateList.get(m), thisClass, method); } // Cycle through all fields @@ -219,7 +219,7 @@ public abstract class Generator implements LanguageConverter // Use all field-level templates for (int f = 0; f < fieldTemplateList.size(); f++) { - processTemplate(fieldTemplateList.get(f), thisClass, method, field); + processTemplateD(fieldTemplateList.get(f), thisClass, method, field); } } } @@ -246,23 +246,23 @@ public abstract class Generator implements LanguageConverter } // Model-level template processing - abstract protected void processTemplate(String[] template) + abstract protected void processTemplateA(String[] template) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException; // Class-level template processing - abstract protected void processTemplate(String[] template, AmqpClass thisClass) + abstract protected void processTemplateB(String[] template, AmqpClass thisClass) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException; // Method-level template processing - abstract protected void processTemplate(String[] template, AmqpClass thisClass, + abstract protected void processTemplateC(String[] template, AmqpClass thisClass, AmqpMethod method) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException; // Field-level template processing - abstract protected void processTemplate(String[] template, AmqpClass thisClass, + abstract protected void processTemplateD(String[] template, AmqpClass thisClass, AmqpMethod method, AmqpField field) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException; @@ -338,7 +338,7 @@ public abstract class Generator implements LanguageConverter protected void processAllTokens(StringBuffer sb, AmqpClass thisClass, AmqpMethod method, AmqpField field, AmqpVersion version) - throws AmqpTemplateException + throws AmqpTemplateException, AmqpTypeMappingException { int lstart = sb.indexOf("${"); while (lstart != -1) diff --git a/gentools/org/apache/qpid/gentools/JavaGenerator.java b/gentools/org/apache/qpid/gentools/JavaGenerator.java index 177c6f6546..4c168cd036 100644 --- a/gentools/org/apache/qpid/gentools/JavaGenerator.java +++ b/gentools/org/apache/qpid/gentools/JavaGenerator.java @@ -377,32 +377,32 @@ public class JavaGenerator extends Generator } @Override - protected void processTemplate(String[] template) + protected void processTemplateA(String[] template) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException { - processTemplate(template, null, null, null); + processTemplateD(template, null, null, null); } @Override - protected void processTemplate(String[] template, AmqpClass thisClass) + protected void processTemplateB(String[] template, AmqpClass thisClass) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException { - processTemplate(template, thisClass, null, null); + processTemplateD(template, thisClass, null, null); } @Override - protected void processTemplate(String[] template, AmqpClass thisClass, + protected void processTemplateC(String[] template, AmqpClass thisClass, AmqpMethod method) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException { - processTemplate(template, thisClass, method, null); + processTemplateD(template, thisClass, method, null); } @Override - protected void processTemplate(String[] template, AmqpClass thisClass, + protected void processTemplateD(String[] template, AmqpClass thisClass, AmqpMethod method, AmqpField field) throws IOException, AmqpTemplateException, AmqpTypeMappingException, IllegalAccessException, InvocationTargetException @@ -433,7 +433,7 @@ public class JavaGenerator extends Generator @Override protected String processToken(String token, AmqpClass thisClass, AmqpMethod method, AmqpField field, AmqpVersion version) - throws AmqpTemplateException + throws AmqpTemplateException, AmqpTypeMappingException { if (token.compareTo("${GENERATOR}") == 0) return generatorInfo; diff --git a/gentools/org/apache/qpid/gentools/Main.java b/gentools/org/apache/qpid/gentools/Main.java index 7c170f8337..5993a556f8 100644 --- a/gentools/org/apache/qpid/gentools/Main.java +++ b/gentools/org/apache/qpid/gentools/Main.java @@ -79,13 +79,9 @@ public class Main new File("templ.cpp/AMQP_ClientProxy.h.tmpl"), new File("templ.cpp/AMQP_ServerProxy.cpp.tmpl"), new File("templ.cpp/AMQP_ClientProxy.cpp.tmpl"), - new File("templ.cpp/AMQP_Constants.h.tmpl") -// new File("templ.cpp/AMQP_ServerHandlerImpl.h.tmpl"), -// new File("templ.cpp/AMQP_ClientHandlerImpl.h.tmpl"), -// new File("templ.cpp/AMQP_ServerHandlerImpl.cpp.tmpl"), -// new File("templ.cpp/AMQP_ClientHandlerImpl.cpp.tmpl"), -// new File("templ.cpp/amqp_methods.h.tmpl"), -// new File("templ.cpp/amqp_methods.cpp.tmpl") + new File("templ.cpp/AMQP_Constants.h.tmpl"), + new File("templ.cpp/AMQP_MethodVersionMap.h.tmpl"), + new File("templ.cpp/AMQP_MethodVersionMap.cpp.tmpl") }; methodTemplateFiles = new File[] { @@ -162,9 +158,9 @@ public class Main // System.out.println(); // System.out.println("*** Debug output ***"); // System.out.println(); +// versionSet.print(System.out, 0, 2); +// System.out.println(); // constants.print(System.out, 0, 2); -// System.out.println(); -// versionSet.print(System.out, 0, 2); // System.out.println(); // domainMap.print(System.out, 0, 2); // System.out.println(); diff --git a/gentools/templ.cpp/AMQP_ClientHandlerImpl.cpp.tmpl b/gentools/templ.cpp/AMQP_ClientHandlerImpl.cpp.tmpl deleted file mode 100644 index 19dbc24ef0..0000000000 --- a/gentools/templ.cpp/AMQP_ClientHandlerImpl.cpp.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -&{AMQP_ClientHandlerImpl.cpp} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - -/* - * This file is auto-generated by ${GENERATOR} - do not modify. - * Supported AMQP versions: -%{VLIST} * ${major}-${minor} - */ - -#include "AMQP_ClientHandlerImpl.h" - -namespace qpid { -namespace framing { - -AMQP_ClientHandlerImpl::AMQP_ClientHandlerImpl() -{CLIST} {chp_initializers} -{} - -AMQP_ClientHandlerImpl::~AMQP_ClientHandlerImpl() -{ -{CLIST} {chp_destructor} -} - -// Handler Stubs - -{CLIST} {chp_handler_stubs} - -} /* namespace framing */ -} /* namespace qpid */ - diff --git a/gentools/templ.cpp/AMQP_ClientHandlerImpl.h.tmpl b/gentools/templ.cpp/AMQP_ClientHandlerImpl.h.tmpl deleted file mode 100644 index ee52109bd6..0000000000 --- a/gentools/templ.cpp/AMQP_ClientHandlerImpl.h.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -&{AMQP_ClientHandlerImpl.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - -/* - * This file is auto-generated by ${GENERATOR} - do not modify. - * Supported AMQP versions: -%{VLIST} * ${major}-${minor} - */ - -#ifndef _AMQP_ClientHandlerImpl_ -#define _AMQP_ClientHandlerImpl_ - -#include "AMQP_ClientOperations.h" -#include "qpid/framing/FieldTable.h" - -namespace qpid { -namespace framing { - -class AMQP_ClientHandlerImpl : virtual public AMQP_ClientOperations -{ -{CLIST} {chh_handler_pointer_declarations} - - public: - AMQP_ClientHandlerImpl(); - virtual ~AMQP_ClientHandlerImpl(); - -{CLIST} {chh_handler_pointer_get_methods} - - // Inner class handler declarations - -{CLIST} {shh_class_handler_declarations} - -}; /* AMQP_ClientHandlerImpl */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif diff --git a/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl b/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl index eeed9eae5b..4a92c9c422 100644 --- a/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl +++ b/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl @@ -1,43 +1,48 @@ &{AMQP_ClientOperations.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ /* * This file is auto-generated by ${GENERATOR} - do not modify. * Supported AMQP versions: %{VLIST} * ${major}-${minor} */ + +#include <sstream> #ifndef _AMQP_ClientOperations_ #define _AMQP_ClientOperations_ -#include "qpid/framing/FieldTable.h" +#include <qpid/framing/FieldTable.h> +#include <qpid/framing/ProtocolVersion.h> +#include <qpid/framing/ProtocolVersionException.h> namespace qpid { namespace framing { class AMQP_ClientOperations { -private: +protected: ProtocolVersion version; + AMQP_ClientOperations() {} public: AMQP_ClientOperations(u_int8_t major, u_int8_t minor) : version(major, minor) {} @@ -47,25 +52,25 @@ public: inline u_int8_t getMajor() const { return version.getMajor(); } inline u_int8_t getMinor() const { return version.getMinor(); } inline const ProtocolVersion& getVersion() const { return version; } - inline isVersion(u_int8_t _major, u_int8_t _minor) const + inline bool isVersion(u_int8_t _major, u_int8_t _minor) const { return version.equals(_major, _minor); } - inline isVersion(ProtocolVersion& _version) const + inline bool isVersion(ProtocolVersion& _version) const { return version.equals(_version); } // Include framing constant declarations - #include "AMQP_Constants.h" + #include <qpid/framing/AMQP_Constants.h> - // Method handler get methods - -%{CLIST} ${coh_method_handler_get_method} - // Inner classes %{CLIST} ${coh_inner_class} + + // Method handler get methods + +%{CLIST} ${coh_method_handler_get_method} }; /* class AMQP_ClientOperations */ diff --git a/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl b/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl index 11510e588c..fe9e3b0ff1 100644 --- a/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl +++ b/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl @@ -1,24 +1,24 @@ &{AMQP_ClientProxy.cpp} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ /* * This file is auto-generated by ${GENERATOR} - do not modify. @@ -27,7 +27,10 @@ */ #include <sstream> -#include "AMQP_ClientProxy.h" + +#include <qpid/framing/AMQP_ClientProxy.h> +#include <qpid/framing/AMQFrame.h> +%{MLIST} ${cpc_method_body_include} namespace qpid { namespace framing { diff --git a/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl b/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl index 4caa53fb3f..48e2468674 100644 --- a/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl +++ b/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl @@ -1,24 +1,24 @@ &{AMQP_ClientProxy.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ /* * This file is auto-generated by ${GENERATOR} - do not modify. @@ -29,9 +29,9 @@ #ifndef _AMQP_ClientProxy_ #define _AMQP_ClientProxy_ -#include "AMQP_ClientOperations.h" -#include "qpid/framing/FieldTable.h" -#include "qpid/framing/OutputHandler.h" +#include <qpid/framing/AMQP_ClientOperations.h> +#include <qpid/framing/FieldTable.h> +#include <qpid/framing/OutputHandler.h> namespace qpid { namespace framing { @@ -40,24 +40,29 @@ class AMQP_ClientProxy : virtual public AMQP_ClientOperations { private: OutputHandler* out; - u_int8_t major; - u_int8_t minor; - - // Inner class instances - -%{CLIST} ${cph_inner_class_instance} +%{CLIST} ${cph_handler_pointer_defn} public: AMQP_ClientProxy(OutputHandler* out, u_int8_t major, u_int8_t minor); virtual ~AMQP_ClientProxy() {} - // Inner class instance get methods - -%{CLIST} ${cph_inner_class_get_method} + // Get methods for handlers + +%{CLIST} ${cph_handler_pointer_get_method} // Inner class definitions %{CLIST} ${cph_inner_class_defn} + +private: + // Inner class instances + +%{CLIST} ${cph_inner_class_instance} + +public: + // Inner class instance get methods + +%{CLIST} ${cph_inner_class_get_method} }; /* class AMQP_ClientProxy */ diff --git a/gentools/templ.cpp/AMQP_Constants.h.tmpl b/gentools/templ.cpp/AMQP_Constants.h.tmpl index c60407b014..4631bc8de6 100644 --- a/gentools/templ.cpp/AMQP_Constants.h.tmpl +++ b/gentools/templ.cpp/AMQP_Constants.h.tmpl @@ -1,24 +1,24 @@ &{AMQP_Constants.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ /* * This file is auto-generated by ${GENERATOR} - do not modify. @@ -26,7 +26,7 @@ %{VLIST} * ${major}-${minor} */ // NOTE: This file is intended to be included within the class structure of both - // the client and server operations classes. + // the client and server operations classes. These need to have <sstream> included. // Constant getValue methods diff --git a/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl b/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl new file mode 100644 index 0000000000..4741fed638 --- /dev/null +++ b/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl @@ -0,0 +1,62 @@ +&{AMQP_MethodVersionMap.cpp} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/* + * This file is auto-generated by ${GENERATOR} - do not modify. + * Supported AMQP versions: +%{VLIST} * ${major}-${minor} + */ + +#include <sstream> + +#include <qpid/framing/AMQP_MethodVersionMap.h> + +namespace qpid +{ +namespace framing +{ + +AMQP_MethodVersionMap::AMQP_MethodVersionMap(u_int8_t major, u_int8_t minor): version(major, minor) +{ +%{CLIST} ${mc_create_method_body_map_entry} +} + +AMQMethodBody* AMQP_MethodVersionMap::createMethodBody(u_int16_t classId, u_int16_t methodId, u_int8_t major, u_int8_t minor) +{ + iterator itr = find(createMapKey(classId, methodId, major, minor)); + if (itr == end()) + { + std::stringstream ss; + ss << "Unable to find MethodBody class for classId = " << classId << ", methodId = " << + methodId << ", AMQ protocol version = " << major << "-" << minor << "."; + throw ProtocolVersionException(ss.str()); + } + return (itr->second)(major, minor); +} + +u_int64_t AMQP_MethodVersionMap::createMapKey(u_int16_t classId, u_int16_t methodId, u_int8_t major, u_int8_t minor) +{ + return ((u_int64_t)classId<<48) + ((u_int64_t)methodId<<32) + ((u_int64_t)major<<16) + minor; +} + +} /* namespace framing */ +} /* namespace qpid */ diff --git a/gentools/templ.cpp/AMQP_MethodVersionMap.h.tmpl b/gentools/templ.cpp/AMQP_MethodVersionMap.h.tmpl new file mode 100644 index 0000000000..6b1418def5 --- /dev/null +++ b/gentools/templ.cpp/AMQP_MethodVersionMap.h.tmpl @@ -0,0 +1,58 @@ +&{AMQP_MethodVersionMap.h} +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +/* + * This file is auto-generated by ${GENERATOR} - do not modify. + * Supported AMQP versions: +%{VLIST} * ${major}-${minor} + */ + +#ifndef _METHOD_VERSION_MAP_H_ +#define _METHOD_VERSION_MAP_H_ + +#include <map> +#include <qpid/framing/AMQMethodBody.h> + +%{MLIST} ${mc_method_body_include} + +namespace qpid +{ +namespace framing +{ + +template <class T> AMQMethodBody* createMethodBodyFn(u_int8_t major, u_int8_t minor) { return new T(major, minor); } +typedef AMQMethodBody* (*fnPtr)(u_int8_t, u_int8_t); + +class AMQP_MethodVersionMap: public std::map<u_int64_t, fnPtr> +{ +protected: + ProtocolVersion version; + u_int64_t createMapKey(u_int16_t classId, u_int16_t methodId, u_int8_t major, u_int8_t minor); +public: + AMQP_MethodVersionMap(u_int8_t major, u_int8_t minor); + AMQMethodBody* createMethodBody(u_int16_t classId, u_int16_t methodId, u_int8_t major, u_int8_t minor); +}; + +} /* namespace framing */ +} /* namespace qpid */ + +#endif diff --git a/gentools/templ.cpp/AMQP_ServerHandlerImpl.cpp.tmpl b/gentools/templ.cpp/AMQP_ServerHandlerImpl.cpp.tmpl deleted file mode 100644 index 54468cfb49..0000000000 --- a/gentools/templ.cpp/AMQP_ServerHandlerImpl.cpp.tmpl +++ /dev/null @@ -1,49 +0,0 @@ -&{AMQP_ServerHandlerImpl.cpp} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - -/* - * This file is auto-generated by ${GENERATOR} - do not modify. - * Supported AMQP versions: -%{VLIST} * ${major}-${minor} - */ - -#include "AMQP_ServerHandlerImpl.h" - -namespace qpid { -namespace framing { - -AMQP_ServerHandlerImpl::AMQP_ServerHandlerImpl() -{CLIST} {shp_initializers} -{} - -AMQP_ServerHandlerImpl::~AMQP_ServerHandlerImpl() -{ -{CLIST} {shp_destructor} -} - -// Handler Stubs - -{CLIST} {shp_handler_stubs} - -} /* namespace framing */ -} /* namespace qpid */ - diff --git a/gentools/templ.cpp/AMQP_ServerHandlerImpl.h.tmpl b/gentools/templ.cpp/AMQP_ServerHandlerImpl.h.tmpl deleted file mode 100644 index 75d47c4f93..0000000000 --- a/gentools/templ.cpp/AMQP_ServerHandlerImpl.h.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -&{AMQP_ServerHandlerImpl.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - -/* - * This file is auto-generated by ${GENERATOR} - do not modify. - * Supported AMQP versions: -%{VLIST} * ${major}-${minor} - */ - -#ifndef _AMQP_ServerHandlerImpl_ -#define _AMQP_ServerHandlerImpl_ - -#include "AMQP_ServerOperations.h" -#include "qpid/framing/FieldTable.h" - -namespace qpid { -namespace framing { - -class AMQP_ServerHandlerImpl : virtual public AMQP_ServerOperations -{ -{CLIST} {shh_handler_pointer_declarations} - - public: - AMQP_ServerHandlerImpl(); - virtual ~AMQP_ServerHandlerImpl(); - -{CLIST} {chh_handler_pointer_get_methods} - - // Inner class handler declarations - -{CLIST} {shh_class_handler_declarations} - -}; /* AMQP_ServerHandlerImpl */ - -} /* namespace framing */ -} /* namespace qpid */ - -#endif diff --git a/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl b/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl index eed4d7960f..7953e5be21 100644 --- a/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl +++ b/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl @@ -1,24 +1,24 @@ &{AMQP_ServerOperations.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ /* * This file is auto-generated by ${GENERATOR} - do not modify. @@ -29,18 +29,20 @@ #ifndef _AMQP_ServerOperations_ #define _AMQP_ServerOperations_ -#include "qpid/framing/FieldTable.h" -#include "qpid/framing/ProtocolVersion.h" -#include "qpid/framing/ProtocolVersionException.h" #include <sstream> +#include <qpid/framing/FieldTable.h> +#include <qpid/framing/ProtocolVersion.h> +#include <qpid/framing/ProtocolVersionException.h> + namespace qpid { namespace framing { class AMQP_ServerOperations { -private: +protected: ProtocolVersion version; + AMQP_ServerOperations() {} public: AMQP_ServerOperations(u_int8_t major, u_int8_t minor) : version(major, minor) {} @@ -60,7 +62,7 @@ public: } // Include framing constant declarations - #include "AMQP_Constants.h" + #include <qpid/framing/AMQP_Constants.h> // Inner classes diff --git a/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl b/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl index 65f42f54e6..3bf043c51d 100644 --- a/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl +++ b/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl @@ -1,24 +1,24 @@ &{AMQP_ServerProxy.cpp} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ /* * This file is auto-generated by ${GENERATOR} - do not modify. @@ -27,7 +27,10 @@ */ #include <sstream> -#include "AMQP_ServerProxy.h" + +#include <qpid/framing/AMQP_ServerProxy.h> +#include <qpid/framing/AMQFrame.h> +%{MLIST} ${spc_method_body_include} namespace qpid { namespace framing { diff --git a/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl b/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl index 6de12fef2d..33773116e3 100644 --- a/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl +++ b/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl @@ -1,24 +1,24 @@ &{AMQP_ServerProxy.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ /* * This file is auto-generated by ${GENERATOR} - do not modify. @@ -29,9 +29,9 @@ #ifndef _AMQP_ServerProxy_ #define _AMQP_ServerProxy_ -#include "AMQP_ServerOperations.h" -#include "qpid/framing/FieldTable.h" -#include "qpid/framing/OutputHandler.h" +#include <qpid/framing/AMQP_ServerOperations.h> +#include <qpid/framing/FieldTable.h> +#include <qpid/framing/OutputHandler.h> namespace qpid { namespace framing { @@ -40,25 +40,30 @@ class AMQP_ServerProxy : virtual public AMQP_ServerOperations { private: OutputHandler* out; - u_int8_t major; - u_int8_t minor; - - // Inner class instances - -%{CLIST} ${sph_inner_class_instance} +%{CLIST} ${sph_handler_pointer_defn} public: AMQP_ServerProxy(OutputHandler* out, u_int8_t major, u_int8_t minor); virtual ~AMQP_ServerProxy() {} - // Inner class instance get methods - -%{CLIST} ${sph_inner_class_get_method} + // Get methods for handlers + +%{CLIST} ${sph_handler_pointer_get_method} // Inner class definitions %{CLIST} ${sph_inner_class_defn} +private: + // Inner class instances + +%{CLIST} ${sph_inner_class_instance} + +public: + // Inner class instance get methods + +%{CLIST} ${sph_inner_class_get_method} + }; /* class AMQP_ServerProxy */ } /* namespace framing */ diff --git a/gentools/templ.cpp/MethodBodyClass.h.tmpl b/gentools/templ.cpp/MethodBodyClass.h.tmpl index 5d68ac4f2d..2a562cadcf 100644 --- a/gentools/templ.cpp/MethodBodyClass.h.tmpl +++ b/gentools/templ.cpp/MethodBodyClass.h.tmpl @@ -26,15 +26,13 @@ %{VLIST} * ${major}-${minor} */ -#include <map> #include <string> #include <sstream> -#include "qpid/framing/amqp_types.h" -#include "AMQP_ServerOperations.h" -#include "qpid/framing/AMQMethodBody.h" -#include "qpid/framing/Buffer.h" -#include "qpid/framing/FieldTable.h" +#include <qpid/framing/amqp_types.h> +#include <qpid/framing/AMQMethodBody.h> +#include <qpid/framing/Buffer.h> +#include <qpid/framing/FieldTable.h> #ifndef _${CLASS}${METHOD}Body_ #define _${CLASS}${METHOD}Body_ @@ -56,15 +54,11 @@ public: typedef boost::shared_ptr<${CLASS}${METHOD}Body> shared_ptr; // Constructors and destructors - - inline ${CLASS}${METHOD}Body( -%{FLIST} ${mb_field_list_declare} - ) : -%{FLIST} ${mb_field_list_initializer} - {} - inline ${CLASS}${METHOD}Body() {} +${mb_constructor_with_initializers} + inline ${CLASS}${METHOD}Body(u_int8_t major, u_int8_t minor): AMQMethodBody(major, minor) {} + inline ${CLASS}${METHOD}Body(ProtocolVersion version): AMQMethodBody(version) {} virtual ~${CLASS}${METHOD}Body() {} // Attribute get methods @@ -96,22 +90,18 @@ public: return size; } - inline void encodeContent(Buffer& buffer) const + inline void encodeContent(Buffer&${mb_buffer_param}) const { %{FLIST} ${mb_encode} } - inline void decodeContent(Buffer& buffer) + inline void decodeContent(Buffer&${mb_buffer_param}) { %{FLIST} ${mb_decode} } - inline void invoke(AMQP_ServerOperations& target, u_int16_t channel) - { - target.getBasicHandler()->publish(channel, -%{FLIST} ${mb_field_list} - ); - } +${mb_server_operation_invoke} + }; // class ${CLASS}${METHOD}Body ${version_namespace_end} diff --git a/gentools/templ.cpp/amqp_methods.cpp.tmpl b/gentools/templ.cpp/amqp_methods.cpp.tmpl deleted file mode 100644 index 947a2fd47e..0000000000 --- a/gentools/templ.cpp/amqp_methods.cpp.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -&{amqp_methods.cpp} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - -/* - * This file is auto-generated by ${GENERATOR} - do not modify. - * Supported AMQP versions: -%{VLIST} * ${major}-${minor} - */ - -#include "amqp_methods.h" -#include "qpid/QpidError.h" - -namespace qpid { -namespace framing { - -AMQMethodBody* createAMQMethodBody(u_int16_t classId, u_int16_t methodId, u_int8_t major, u_int8_t minor) -{ - switch(classId * 1000 + methodId) - { -{MLIST} {m_create_method_body_class} - } - THROW_QPID_ERROR(FRAMING_ERROR, "Unknown method"); -} /* createAMQMethodBody() */ - -} /* namespace framing */ -} /* namespace qpid */ diff --git a/gentools/templ.cpp/amqp_methods.h.tmpl b/gentools/templ.cpp/amqp_methods.h.tmpl deleted file mode 100644 index 6668cf584c..0000000000 --- a/gentools/templ.cpp/amqp_methods.h.tmpl +++ /dev/null @@ -1,44 +0,0 @@ -&{amqp_methods.h} -/** -* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - -/* - * This file is auto-generated by ${GENERATOR} - do not modify. - * Supported AMQP versions: -%{VLIST} * ${major}-${minor} - */ - -#ifndef AMQ_METHODS_H -#define AMQ_METHODS_H - -{MLIST} {m_method_body_class_indlude} - -namespace qpid { -namespace framing { - -{MLIST} {m_method_body_class_instance} - -AMQMethodBody* createAMQMethodBody(u_int16_t classId, u_int16_t methodId); - -} /* namespace framing */ -} /* namespace qpid */ - -#endif diff --git a/gentools/xml-src/amqp-0.8.test.xml b/gentools/xml-src/amqp-0.8.test.xml index 530d40756f..b0adf31828 100644 --- a/gentools/xml-src/amqp-0.8.test.xml +++ b/gentools/xml-src/amqp-0.8.test.xml @@ -171,7 +171,7 @@ Revision history: 2006-07-03 (PH) - cosmetic clean-up of Basic.Recover comments. --> -<amqp major="0" minor="8" port="5672" comment="AMQ protocol 0.80"> +<amqp major="8" minor="0" port="5672" comment="AMQ protocol 0.80"> AMQ Protocol 0.80 <!-- |