summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentools/org/apache/qpid/gentools/AmqpDomain.java8
-rw-r--r--gentools/org/apache/qpid/gentools/AmqpDomainMap.java16
-rw-r--r--gentools/org/apache/qpid/gentools/AmqpField.java4
-rw-r--r--gentools/org/apache/qpid/gentools/AmqpFieldMap.java20
-rw-r--r--gentools/org/apache/qpid/gentools/AmqpMethod.java29
-rw-r--r--gentools/org/apache/qpid/gentools/AmqpOrdinalFieldMap.java16
-rw-r--r--gentools/org/apache/qpid/gentools/CppGenerator.java191
-rw-r--r--gentools/templ.cpp/AMQP_ClientOperations.h.tmpl28
-rw-r--r--gentools/templ.cpp/AMQP_ServerOperations.h.tmpl37
9 files changed, 176 insertions, 173 deletions
diff --git a/gentools/org/apache/qpid/gentools/AmqpDomain.java b/gentools/org/apache/qpid/gentools/AmqpDomain.java
index e313772a83..c0bec8b7b1 100644
--- a/gentools/org/apache/qpid/gentools/AmqpDomain.java
+++ b/gentools/org/apache/qpid/gentools/AmqpDomain.java
@@ -42,17 +42,17 @@ public class AmqpDomain extends TreeMap<String, AmqpVersionSet> implements Print
versionSet.add(version);
}
- public String getDomainType(AmqpVersion v)
+ public String getDomainType(AmqpVersion version)
throws AmqpTypeMappingException
{
Iterator<String> i = keySet().iterator();
while (i.hasNext())
{
String type = i.next();
- AmqpVersionSet vs = get(type);
- if (vs.contains(v))
+ AmqpVersionSet versionSet = get(type);
+ if (versionSet.contains(version))
return type;
- } throw new AmqpTypeMappingException("Unable to find version " + v + ".");
+ } throw new AmqpTypeMappingException("Unable to find version " + version + ".");
}
public boolean hasVersion(String type, AmqpVersion v)
diff --git a/gentools/org/apache/qpid/gentools/AmqpDomainMap.java b/gentools/org/apache/qpid/gentools/AmqpDomainMap.java
index 88cc9a17b3..656239a626 100644
--- a/gentools/org/apache/qpid/gentools/AmqpDomainMap.java
+++ b/gentools/org/apache/qpid/gentools/AmqpDomainMap.java
@@ -82,22 +82,26 @@ public class AmqpDomainMap extends TreeMap<String, AmqpDomain> implements Printa
}
}
- public String getDomainType(String domainName, AmqpVersion v)
+ public String getDomainType(String domainName, AmqpVersion version)
throws AmqpTypeMappingException
{
- AmqpDomain domain = get(domainName);
+ AmqpDomain domainType = get(domainName);
// For AMQP 8.0, primitive types were not described as domains, so
// return itself as the type.
- if (domain == null)
- return converter.getDomainType(domainName, v);
+ if (domainType == null)
+ {
+// return converter.getDomainType(domainName, version);
+System.out.println("@DEBUG Unable to find domain " + domainName);
+ return domainName;
+ }
try
{
- return domain.getDomainType(v);
+ return domainType.getDomainType(version);
}
catch (AmqpTypeMappingException e)
{
throw new AmqpTypeMappingException("Unable to find domain type for domain \"" + domainName +
- "\" version " + v + ".");
+ "\" version " + version + ".");
}
}
diff --git a/gentools/org/apache/qpid/gentools/AmqpField.java b/gentools/org/apache/qpid/gentools/AmqpField.java
index e2d3f63281..e062250e90 100644
--- a/gentools/org/apache/qpid/gentools/AmqpField.java
+++ b/gentools/org/apache/qpid/gentools/AmqpField.java
@@ -70,7 +70,7 @@ public class AmqpField implements Printable, NodeAware, VersionConsistencyCheck
thisVersionList.add(version);
}
- public boolean isCodeTypeConsistent(Generator generator)
+ public boolean isCodeTypeConsistent(LanguageConverter converter)
throws AmqpTypeMappingException
{
if (domainMap.size() == 1)
@@ -81,7 +81,7 @@ public class AmqpField implements Printable, NodeAware, VersionConsistencyCheck
{
String domainName = itr.next();
AmqpVersionSet versionSet = domainMap.get(domainName);
- String codeType = generator.getGeneratedType(domainName, versionSet.first());
+ String codeType = converter.getGeneratedType(domainName, versionSet.first());
if (!codeTypeList.contains(codeType))
codeTypeList.add(codeType);
}
diff --git a/gentools/org/apache/qpid/gentools/AmqpFieldMap.java b/gentools/org/apache/qpid/gentools/AmqpFieldMap.java
index e4fb686f0e..1cc956cf05 100644
--- a/gentools/org/apache/qpid/gentools/AmqpFieldMap.java
+++ b/gentools/org/apache/qpid/gentools/AmqpFieldMap.java
@@ -41,7 +41,9 @@ public class AmqpFieldMap extends TreeMap<String, AmqpField> implements VersionC
return newMap;
}
- public AmqpOrdinalFieldMap getMapForVersion(AmqpVersion version)
+ public AmqpOrdinalFieldMap getMapForVersion(AmqpVersion version, boolean codeTypeFlag,
+ LanguageConverter converter)
+ throws AmqpTypeMappingException
{
AmqpOrdinalFieldMap ordinalFieldMap = new AmqpOrdinalFieldMap();
Iterator<String> fItr = keySet().iterator();
@@ -58,7 +60,11 @@ public class AmqpFieldMap extends TreeMap<String, AmqpField> implements VersionC
domain = dItr.next();
AmqpVersionSet versionSet = field.domainMap.get(domain);
if (version == null || versionSet.contains(version))
+ {
+ if (codeTypeFlag)
+ domain = converter.getGeneratedType(domain, version);
dFound = true;
+ }
}
int ordinal = -1;
@@ -81,7 +87,7 @@ public class AmqpFieldMap extends TreeMap<String, AmqpField> implements VersionC
}
return ordinalFieldMap;
}
-
+
public boolean isDomainConsistent(Generator generator, AmqpVersionSet versionSet)
throws AmqpTypeMappingException
{
@@ -104,7 +110,7 @@ public class AmqpFieldMap extends TreeMap<String, AmqpField> implements VersionC
}
public String parseFieldMap(Method commonGenerateMethod, Method mangledGenerateMethod,
- int indentSize, int tabSize, Generator codeGenerator)
+ int indentSize, int tabSize, LanguageConverter converter)
throws AmqpTypeMappingException, IllegalAccessException, InvocationTargetException
{
String indent = Utils.createSpaces(indentSize);
@@ -126,19 +132,19 @@ public class AmqpFieldMap extends TreeMap<String, AmqpField> implements VersionC
{
String fieldName = itr.next();
AmqpField field = get(fieldName);
- if (field.isCodeTypeConsistent(codeGenerator))
+ if (field.isCodeTypeConsistent(converter))
{
// All versions identical - Common declaration
String domainName = field.domainMap.firstKey();
AmqpVersionSet versionSet = field.domainMap.get(domainName);
- String codeType = codeGenerator.getGeneratedType(domainName, versionSet.first());
+ String codeType = converter.getGeneratedType(domainName, versionSet.first());
if (commonGenerateMethod != null)
- sb.append(commonGenerateMethod.invoke(codeGenerator, codeType, field, versionSet,
+ sb.append(commonGenerateMethod.invoke(converter, codeType, field, versionSet,
indentSize, tabSize, itr.hasNext()));
}
else if (mangledGenerateMethod != null) // Version-mangled
{
- sb.append(mangledGenerateMethod.invoke(codeGenerator, field, indentSize, tabSize,
+ sb.append(mangledGenerateMethod.invoke(converter, field, indentSize, tabSize,
itr.hasNext()));
}
}
diff --git a/gentools/org/apache/qpid/gentools/AmqpMethod.java b/gentools/org/apache/qpid/gentools/AmqpMethod.java
index 7ecb97530d..aad5889346 100644
--- a/gentools/org/apache/qpid/gentools/AmqpMethod.java
+++ b/gentools/org/apache/qpid/gentools/AmqpMethod.java
@@ -135,32 +135,31 @@ public class AmqpMethod implements Printable, NodeAware, VersionConsistencyCheck
}
}
- public AmqpOverloadedParameterMap getOverloadedParameterLists(AmqpVersionSet globalVersionSet)
+ public AmqpOverloadedParameterMap getOverloadedParameterLists(AmqpVersionSet globalVersionSet,
+ Generator generator)
+ throws AmqpTypeMappingException
{
AmqpOverloadedParameterMap parameterVersionMap = new AmqpOverloadedParameterMap();
Iterator<AmqpVersion> vItr = globalVersionSet.iterator();
while (vItr.hasNext())
{
AmqpVersion version = vItr.next();
- AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version);
- if (ordinalFieldMap.size() > 0)
+ AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version, true, generator);
+ AmqpVersionSet methodVersionSet = parameterVersionMap.get(ordinalFieldMap);
+ if (methodVersionSet == null)
{
- AmqpVersionSet methodVersionSet = parameterVersionMap.get(ordinalFieldMap);
- if (methodVersionSet == null)
- {
- methodVersionSet = new AmqpVersionSet();
- methodVersionSet.add(version);
- parameterVersionMap.put(ordinalFieldMap, methodVersionSet);
- }
- else
- {
- methodVersionSet.add(version);
- }
+ methodVersionSet = new AmqpVersionSet();
+ methodVersionSet.add(version);
+ parameterVersionMap.put(ordinalFieldMap, methodVersionSet);
+ }
+ else
+ {
+ methodVersionSet.add(version);
}
}
return parameterVersionMap;
}
-
+
public boolean isVersionConsistent(AmqpVersionSet globalVersionSet)
{
if (!versionSet.equals(globalVersionSet))
diff --git a/gentools/org/apache/qpid/gentools/AmqpOrdinalFieldMap.java b/gentools/org/apache/qpid/gentools/AmqpOrdinalFieldMap.java
index fd7ac239e7..f8251492b2 100644
--- a/gentools/org/apache/qpid/gentools/AmqpOrdinalFieldMap.java
+++ b/gentools/org/apache/qpid/gentools/AmqpOrdinalFieldMap.java
@@ -7,6 +7,9 @@ import java.util.TreeMap;
@SuppressWarnings("serial")
public class AmqpOrdinalFieldMap extends TreeMap<Integer, String[]> implements Comparable
{
+ protected static final int FIELD_DOMAIN = 1;
+ protected boolean codeTypeFlag = false;
+
public int compareTo(Object obj)
{
AmqpOrdinalFieldMap o = (AmqpOrdinalFieldMap)obj;
@@ -52,4 +55,17 @@ public class AmqpOrdinalFieldMap extends TreeMap<Integer, String[]> implements C
}
return 0;
}
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ Iterator<Integer> itr = keySet().iterator();
+ while (itr.hasNext())
+ {
+ int ordinal = itr.next();
+ String[] pair = get(ordinal);
+ sb.append("[" + ordinal + "] " + pair[0] + " : " + pair[1] + Utils.lineSeparator);
+ }
+ return sb.toString();
+ }
}
diff --git a/gentools/org/apache/qpid/gentools/CppGenerator.java b/gentools/org/apache/qpid/gentools/CppGenerator.java
index d15d1b2d06..b89173ae6d 100644
--- a/gentools/org/apache/qpid/gentools/CppGenerator.java
+++ b/gentools/org/apache/qpid/gentools/CppGenerator.java
@@ -139,6 +139,8 @@ public class CppGenerator extends Generator
public String getGeneratedType(String domainName, AmqpVersion version)
throws AmqpTypeMappingException
{
+ if (version == null)
+ version = globalVersionSet.first();
String domainType = globalDomainMap.getDomainType(domainName, version);
if (domainType == null)
throw new AmqpTypeMappingException("Domain type \"" + domainName +
@@ -312,13 +314,24 @@ public class CppGenerator extends Generator
String token = tline.substring(tokxStart).trim();
sb.delete(listMarkerStartIndex, lend);
- if (token.compareTo("${co_method_handler_get_method}") == 0)
+ // ClientOperations.h
+ if (token.compareTo("${coh_method_handler_get_method}") == 0)
{
- codeSnippet = generateMethodHandlerGetMethods(model, 8);
+ codeSnippet = generateMethodHandlerGetMethods(model, false, 4);
}
- else if (token.compareTo("${co_server_method_inner_class}") == 0)
+ else if (token.compareTo("${coh_inner_class}") == 0)
{
- codeSnippet = generateInnerClasses(model, 8, 4);
+ codeSnippet = generateInnerClasses(model, false, 4, 4);
+ }
+
+ // ServerOperations.h
+ else if (token.compareTo("${soh_method_handler_get_method}") == 0)
+ {
+ codeSnippet = generateMethodHandlerGetMethods(model, true, 4);
+ }
+ else if (token.compareTo("${soh_inner_class}") == 0)
+ {
+ codeSnippet = generateInnerClasses(model, true, 4, 4);
}
else // Oops!
@@ -397,7 +410,7 @@ public class CppGenerator extends Generator
// Methods used for generation of code snippets for ServerOperations class generation
- protected String generateMethodHandlerGetMethods(AmqpModel model, int indentSize)
+ protected String generateMethodHandlerGetMethods(AmqpModel model, boolean serverFlag, int indentSize)
{
String indent = Utils.createSpaces(indentSize);
StringBuffer sb = new StringBuffer();
@@ -405,13 +418,26 @@ public class CppGenerator extends Generator
while (cItr.hasNext())
{
AmqpClass thisClass = model.classMap.get(cItr.next());
- sb.append(indent + "virtual AMQP_ServerOperations::" +
- thisClass.name + "Handler* get" + thisClass.name + "Handler() = 0;" + cr);
+ // Only generate for this class if there is at least one method of the
+ // required chassis (server/client flag).
+ boolean chassisFoundFlag = false;
+ Iterator<String> mItr = thisClass.methodMap.keySet().iterator();
+ while (mItr.hasNext() && !chassisFoundFlag)
+ {
+ AmqpMethod method = thisClass.methodMap.get(mItr.next());
+ boolean clientChassisFlag = method.clientMethodFlagMap.isSet();
+ boolean serverChassisFlag = method.serverMethodFlagMap.isSet();
+ if ((serverFlag && serverChassisFlag) || (!serverFlag && clientChassisFlag))
+ chassisFoundFlag = true;
+ }
+ if (chassisFoundFlag)
+ sb.append(indent + "virtual AMQP_ServerOperations::" +
+ thisClass.name + "Handler* get" + thisClass.name + "Handler() = 0;" + cr);
}
return sb.toString();
}
- protected String generateInnerClasses(AmqpModel model, int indentSize, int tabSize)
+ protected String generateInnerClasses(AmqpModel model, boolean serverFlag, int indentSize, int tabSize)
throws AmqpTypeMappingException
{
String indent = Utils.createSpaces(indentSize);
@@ -425,6 +451,8 @@ public class CppGenerator extends Generator
String className = thisClass.name + "Handler";
if (!first)
sb.append(cr);
+ sb.append(indent + "// ==================== class " + className +
+ " ====================" + cr);
sb.append(indent + "class " + className);
if (thisClass.versionSet.size() != globalVersionSet.size())
sb.append(" // AMQP Version(s) " + thisClass.versionSet + cr);
@@ -444,14 +472,14 @@ public class CppGenerator extends Generator
sb.append(cr);
sb.append(indent + tab + "// Protocol methods" + cr);
sb.append(cr);
- sb.append(generateInnerClassMethods(thisClass, indentSize + tabSize, tabSize));
+ sb.append(generateInnerClassMethods(thisClass, serverFlag, indentSize + tabSize, tabSize));
sb.append(indent + "}; // class " + className + cr);
first = false;
}
return sb.toString();
}
- protected String generateInnerClassMethods(AmqpClass thisClass, int indentSize, int tabSize)
+ protected String generateInnerClassMethods(AmqpClass thisClass, boolean serverFlag, int indentSize, int tabSize)
throws AmqpTypeMappingException
{
String indent = Utils.createSpaces(indentSize);
@@ -461,22 +489,28 @@ public class CppGenerator extends Generator
while (mItr.hasNext())
{
AmqpMethod method = thisClass.methodMap.get(mItr.next());
- AmqpOverloadedParameterMap overloadededParameterMap = method.getOverloadedParameterLists(globalVersionSet);
- Iterator<AmqpOrdinalFieldMap> ofmItr = overloadededParameterMap.keySet().iterator();
- String methodName = parseForReservedWords(method.name, thisClass.name);
- while (ofmItr.hasNext())
+ boolean clientChassisFlag = method.clientMethodFlagMap.isSet();
+ boolean serverChassisFlag = method.serverMethodFlagMap.isSet();
+ if ((serverFlag && serverChassisFlag) || (!serverFlag && clientChassisFlag))
{
- AmqpOrdinalFieldMap fieldMap = ofmItr.next();
- AmqpVersionSet versionSet = overloadededParameterMap.get(fieldMap);
- if (!first)
- sb.append(cr);
- sb.append(indent + "virtual void " + methodName + "(");
- sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize)));
- if (versionSet.size() != globalVersionSet.size())
- sb.append(") = 0; // AMQP Version(s) " + versionSet + cr);
- else
- sb.append(") = 0;" + cr);
- first = false;
+ String methodName = parseForReservedWords(method.name, thisClass.name);
+ AmqpOverloadedParameterMap overloadededParameterMap =
+ method.getOverloadedParameterLists(thisClass.versionSet, this);
+ Iterator<AmqpOrdinalFieldMap> ofmItr = overloadededParameterMap.keySet().iterator();
+ while (ofmItr.hasNext())
+ {
+ AmqpOrdinalFieldMap fieldMap = ofmItr.next();
+ AmqpVersionSet versionSet = overloadededParameterMap.get(fieldMap);
+ if (!first)
+ sb.append(cr);
+ sb.append(indent + "virtual void " + methodName + "( u_int16_t channel");
+ sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize)));
+ if (versionSet.size() != globalVersionSet.size())
+ sb.append(" ) = 0; // AMQP Version(s) " + versionSet + cr);
+ else
+ sb.append(" ) = 0;" + cr);
+ first = false;
+ }
}
}
return sb.toString();
@@ -492,10 +526,10 @@ public class CppGenerator extends Generator
while(pItr.hasNext())
{
String[] field = fieldMap.get(pItr.next());
- String codeType = getGeneratedType(field[FIELD_DOMAIN], globalVersionSet.first());
- if (!first)
- sb.append(indent);
- sb.append(setRef(codeType) + " " + field[FIELD_NAME] + (pItr.hasNext() ? "," + cr : ""));
+ if (first)
+ sb.append("," + cr);
+ sb.append(indent + setRef(field[FIELD_DOMAIN]) + " " + field[FIELD_NAME] +
+ (pItr.hasNext() ? "," + cr : ""));
first = false;
}
return sb.toString();
@@ -616,7 +650,7 @@ public class CppGenerator extends Generator
String indent = Utils.createSpaces(indentSize);
StringBuffer sb = new StringBuffer();
ArrayList<String> bitFieldList = new ArrayList<String>();
- AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version);
+ AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version, false, this);
Iterator<Integer> oItr = ordinalFieldMap.keySet().iterator();
int ordinal = 0;
while (oItr.hasNext())
@@ -626,9 +660,9 @@ public class CppGenerator extends Generator
AmqpVersion thisVersion = version == null ? globalVersionSet.first() : version;
String domainType = getDomainType(fieldDomainPair[FIELD_DOMAIN], thisVersion);
- // Defer bit types by adding them to an array. When the first non-bit type is
- // encountered, then handle the bits. This allows consecutive bits to be placed
- // into the same byte(s) - 8 bits to the byte.
+ // Defer bit types by adding them to an array. When the first subsequent non-bit
+ // type is encountered, then handle the bits. This allows consecutive bits to be
+ // placed into the same byte(s) - 8 bits to the byte.
if (domainType.compareTo("bit") == 0)
{
bitFieldList.add(fieldDomainPair[FIELD_NAME]);
@@ -675,7 +709,7 @@ public class CppGenerator extends Generator
String indent = Utils.createSpaces(indentSize);
StringBuffer sb = new StringBuffer();
ArrayList<String> bitFieldList = new ArrayList<String>();
- AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version);
+ AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version, false, this);
Iterator<Integer> oItr = ordinalFieldMap.keySet().iterator();
int ordinal = 0;
while (oItr.hasNext())
@@ -685,9 +719,9 @@ public class CppGenerator extends Generator
AmqpVersion thisVersion = version == null ? globalVersionSet.first() : version;
String domainType = getDomainType(fieldDomainPair[FIELD_DOMAIN], thisVersion);
- // Defer bit types by adding them to an array. When the first non-bit type is
- // encountered, then handle the bits. This allows consecutive bits to be placed
- // into the same byte(s) - 8 bits to the byte.
+ // Defer bit types by adding them to an array. When the first subsequent non-bit
+ // type is encountered, then handle the bits. This allows consecutive bits to be
+ // placed into the same byte(s) - 8 bits to the byte.
if (domainType.compareTo("bit") == 0)
{
bitFieldList.add(fieldDomainPair[FIELD_NAME]);
@@ -743,7 +777,7 @@ public class CppGenerator extends Generator
String indent = Utils.createSpaces(indentSize);
StringBuffer sb = new StringBuffer();
ArrayList<String> bitFieldList = new ArrayList<String>();
- AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version);
+ AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version, false, this);
Iterator<Integer> oItr = ordinalFieldMap.keySet().iterator();
int ordinal = 0;
while (oItr.hasNext())
@@ -753,9 +787,9 @@ public class CppGenerator extends Generator
AmqpVersion thisVersion = version == null ? globalVersionSet.first() : version;
String domainType = getDomainType(fieldDomainPair[FIELD_DOMAIN], thisVersion);
- // Defer bit types by adding them to an array. When the first non-bit type is
- // encountered, then handle the bits. This allows consecutive bits to be placed
- // into the same byte(s) - 8 bits to the byte.
+ // Defer bit types by adding them to an array. When the first subsequent non-bit
+ // type is encountered, then handle the bits. This allows consecutive bits to be
+ // placed into the same byte(s) - 8 bits to the byte.
if (domainType.compareTo("bit") == 0)
{
bitFieldList.add(fieldDomainPair[FIELD_NAME]);
@@ -809,95 +843,26 @@ public class CppGenerator extends Generator
{
String indent = Utils.createSpaces(indentSize);
StringBuffer sb = new StringBuffer();
- AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version);
+ AmqpOrdinalFieldMap ordinalFieldMap = fieldMap.getMapForVersion(version, true, this);
Iterator<Integer> oItr = ordinalFieldMap.keySet().iterator();
int ordinal = 0;
while (oItr.hasNext())
{
ordinal = oItr.next();
String[] fieldDomainPair = ordinalFieldMap.get(ordinal);
- AmqpVersion thisVersion = version == null ? globalVersionSet.first() : version;
- String codeType = getGeneratedType(fieldDomainPair[FIELD_DOMAIN], thisVersion);
- sb.append(indent + (defineFlag ? codeType + " " : "") +
+ sb.append(indent + (defineFlag ? fieldDomainPair[FIELD_DOMAIN] + " " : "") +
fieldDomainPair[FIELD_NAME] + (initializerFlag ? "(" + fieldDomainPair[FIELD_NAME] + ")" : "") +
(oItr.hasNext() ? "," : "") + cr);
}
return sb.toString();
}
-// protected String generateMbParamList(String codeType, AmqpField field,
-// AmqpVersionSet versionSet, int indentSize, int tabSize, boolean nextFlag)
-// {
-// return mbParamList(codeType, field, versionSet, indentSize, nextFlag, false, false);
-// }
-//
-// protected String generateMbMangledParamList(AmqpField field, int indentSize,
-// int tabSize, boolean nextFlag)
-// throws AmqpTypeMappingException
-// {
-// return mbMangledParamList(field, indentSize, nextFlag, false, false);
-// }
-//
-// protected String generateMbParamDeclareList(String codeType, AmqpField field,
-// AmqpVersionSet versionSet, int indentSize, int tabSize, boolean nextFlag)
-// {
-// return mbParamList(codeType, field, versionSet, indentSize, nextFlag, true, false);
-// }
-//
-// protected String generateMbMangledParamDeclareList(AmqpField field, int indentSize,
-// int tabSize, boolean nextFlag)
-// throws AmqpTypeMappingException
-// {
-// return mbMangledParamList(field, indentSize, nextFlag, true, false);
-// }
-//
-// protected String generateMbParamInitList(String codeType, AmqpField field,
-// AmqpVersionSet versionSet, int indentSize, int tabSize, boolean nextFlag)
-// {
-// return mbParamList(codeType, field, versionSet, indentSize, nextFlag, false, true);
-// }
-//
-// protected String generateMbMangledParamInitList(AmqpField field, int indentSize,
-// int tabSize, boolean nextFlag)
-// throws AmqpTypeMappingException
-// {
-// return mbMangledParamList(field, indentSize, nextFlag, false, true);
-// }
-//
-// protected String mbParamList(String codeType, AmqpField field, AmqpVersionSet versionSet,
-// int indentSize, boolean nextFlag, boolean defineFlag, boolean initializerFlag)
-// {
-// return Utils.createSpaces(indentSize) + (defineFlag ? codeType + " " : "") +
-// field.name + (initializerFlag ? "(" + field.name + ")" : "") +
-// (nextFlag ? "," : "") + " /* AMQP version(s): " + versionSet + " */" + cr;
-// }
-//
-// protected String mbMangledParamList(AmqpField field, int indentSize,
-// boolean nextFlag, boolean defineFlag, boolean initializerFlag)
-// throws AmqpTypeMappingException
-// {
-// StringBuffer sb = new StringBuffer();
-// Iterator<String> dItr = field.domainMap.keySet().iterator();
-// int domainCntr = 0;
-// while (dItr.hasNext())
-// {
-// String domainName = dItr.next();
-// AmqpVersionSet versionSet = field.domainMap.get(domainName);
-// String codeType = getGeneratedType(domainName, versionSet.first());
-// sb.append(Utils.createSpaces(indentSize) + (defineFlag ? codeType + " " : "") +
-// field.name + "_" + domainCntr +
-// (initializerFlag ? "(" + field.name + "_" + domainCntr + ")" : "") +
-// (nextFlag ? "," : "") + " /* AMQP version(s): " + versionSet + " */" + cr);
-// domainCntr++;
-// }
-// return sb.toString();
-// }
private String parseForReservedWords(String methodName, String className)
{
for (int i=0; i<cppReservedWords.length; i++)
if (methodName.compareTo(cppReservedWords[i]) == 0)
{
- System.err.println("WARNING: Found method \"" + methodName +
+ System.out.println("WARNING: Found method \"" + methodName +
"\" in class \"" + className +
"\", which is a C/C++ reserved word. " +
"Changing generated method name to \"" + methodName + "_\".");
diff --git a/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl b/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl
index bdc3d6c694..b8010896a7 100644
--- a/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl
+++ b/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl
@@ -34,16 +34,28 @@ namespace framing {
class AMQP_ClientOperations
{
- public:
- AMQP_ClientOperations() {}
- virtual ~AMQP_ClientOperations() {}
-{so_get_amqp_major}
-{so_get_amqp_minor}
+private:
+ u_int8_t major;
+ u_int8_t minor;
- // Method handler get methods
-{CLIST} {co_method_handler_get_method}
+public:
+ AMQP_ClientOperations(u_int8_t major, u_int8_t minor) : major(major), minor(minor) {}
+ virtual ~AMQP_ClientOperations() {}
-{CLIST} {co_cleint method_inner_class}
+ inline u_int8_t getMajor() { return major; }
+ inline u_int8_t getMinor() { return minor; }
+ inline isVersion(u_int8_t _major, u_int8_t _minor)
+ {
+ return major == _major && minor == _minor;
+ }
+
+ // Method handler get methods
+
+%{CLIST} ${coh_method_handler_get_method}
+
+ // Inner classes
+
+%{CLIST} ${coh_inner_class}
}; /* class AMQP_ClientOperations */
diff --git a/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl b/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl
index 80c6c0f5ab..b1d1c98b25 100644
--- a/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl
+++ b/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl
@@ -34,27 +34,28 @@ namespace framing {
class AMQP_ServerOperations
{
- private:
- u_int8_t major;
- u_int8_t minor;
- public:
- AMQP_ServerOperations(u_int8_t major, u_int8_t minor) : major(major), minor(minor) {}
- virtual ~AMQP_ServerOperations() {}
-
- inline u_int8_t getMajor() { return major; }
- inline u_int8_t getMinor() { return minor; }
- inline isVersion(u_int8_t _major, u_int8_t _minor)
- {
- return major == _major && minor == _minor;
- }
+private:
+ u_int8_t major;
+ u_int8_t minor;
- // Method handler get methods
-
-%{CLIST} ${co_method_handler_get_method}
+public:
+ AMQP_ServerOperations(u_int8_t major, u_int8_t minor) : major(major), minor(minor) {}
+ virtual ~AMQP_ServerOperations() {}
- // Inner classes
+ inline u_int8_t getMajor() { return major; }
+ inline u_int8_t getMinor() { return minor; }
+ inline isVersion(u_int8_t _major, u_int8_t _minor)
+ {
+ return major == _major && minor == _minor;
+ }
-%{CLIST} ${co_server_method_inner_class}
+ // Method handler get methods
+
+%{CLIST} ${soh_method_handler_get_method}
+
+ // Inner classes
+
+%{CLIST} ${soh_inner_class}
}; /* class AMQP_ServerOperations */