Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersion.h URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersion.h?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersion.h (original) +++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersion.h Mon Feb 12 18:41:14 2007 @@ -35,19 +35,19 @@ u_int8_t minor_; public: - ProtocolVersion(); - ProtocolVersion(u_int8_t _major, u_int8_t _minor); - ProtocolVersion(const ProtocolVersion& p); - virtual ~ProtocolVersion(); + ProtocolVersion(u_int8_t _major=0, u_int8_t _minor=0) + : major_(_major), minor_(_minor) {} - inline u_int8_t getMajor() const { return major_; } - inline void setMajor(u_int8_t major) { major_ = major; } - inline u_int8_t getMinor() const { return minor_; } - inline void setMinor(u_int8_t minor) { minor_ = minor; } - virtual bool equals(u_int8_t _major, u_int8_t _minor) const; - virtual bool equals(const ProtocolVersion& p) const; - virtual const std::string toString() const; - ProtocolVersion operator=(const ProtocolVersion& p); + u_int8_t getMajor() const { return major_; } + void setMajor(u_int8_t major) { major_ = major; } + u_int8_t getMinor() const { return minor_; } + void setMinor(u_int8_t minor) { minor_ = minor; } + const std::string toString() const; + + ProtocolVersion& operator=(ProtocolVersion p); + + bool operator==(ProtocolVersion p) const; + bool operator!=(ProtocolVersion p) const { return ! (*this == p); } }; } // namespace framing
Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersionException.h URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersionException.h?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersionException.h (original) +++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/ProtocolVersionException.h Mon Feb 12 18:41:14 2007 @@ -40,7 +40,7 @@ template <class T> ProtocolVersionException( - const ProtocolVersion& ver, const T& msg) throw () : versionFound(ver) + ProtocolVersion ver, const T& msg) throw () : versionFound(ver) { init(boost::lexical_cast<std::string>(msg)); } template <class T> Added: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.cpp?view=auto&rev=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.cpp (added) +++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.cpp Mon Feb 12 18:41:14 2007 @@ -0,0 +1,32 @@ +/* + * + * Copyright (c) 2006 The Apache Software Foundation + * + * Licensed 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. + * + */ + +#include "Proxy.h" +#include "ChannelAdapter.h" +#include "ProtocolVersion.h" + +namespace qpid { +namespace framing { + +Proxy::~Proxy() {} + +ProtocolVersion Proxy::getProtocolVersion() const { + return channel.getVersion(); +} + +}} // namespace qpid::framing Propchange: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.cpp ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.cpp ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.h URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.h?view=auto&rev=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.h (added) +++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.h Mon Feb 12 18:41:14 2007 @@ -0,0 +1,51 @@ +#ifndef _framing_Proxy_h +#define _framing_Proxy_h + +/* + * + * Copyright (c) 2006 The Apache Software Foundation + * + * Licensed 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. + * + */ + +#include "ProtocolVersion.h" + +namespace qpid { +namespace framing { + +class ChannelAdapter; +class FieldTable; +class Content; + +/** + * Base class for proxies. + */ +class Proxy +{ + + public: + Proxy(ChannelAdapter& ch) : channel(ch) {} + virtual ~Proxy(); + + ProtocolVersion getProtocolVersion() const; + + protected: + ChannelAdapter& channel; +}; + +}} // namespace qpid::framing + + + +#endif /*!_framing_Proxy_h*/ Propchange: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/Proxy.h ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types.h URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types.h?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types.h (original) +++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types.h Mon Feb 12 18:41:14 2007 @@ -20,6 +20,12 @@ * under the License. * */ + +/** \file + * Type definitions and forward declarations of all types used to + * in AMQP messages. + */ + #include <string> #ifdef _WINDOWS #include "windows.h" @@ -44,5 +50,8 @@ typedef u_int16_t MethodId; typedef u_int16_t ReplyCode; +// Types represented by classes. +class Content; +class FieldTable; }} // namespace qpid::framing #endif Added: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types_full.h URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types_full.h?view=auto&rev=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types_full.h (added) +++ incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types_full.h Mon Feb 12 18:41:14 2007 @@ -0,0 +1,36 @@ +#ifndef _framing_amqp_types_decl_h +#define _framing_amqp_types_decl_h + +/* + * + * Copyright (c) 2006 The Apache Software Foundation + * + * Licensed 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. + * + */ + +/** \file + * Type definitions and full declarations of all types used to + * in AMQP messages. + * + * Its better to include amqp_types.h in another header instead of this file + * unless the header actually needs the full declarations. Including + * full declarations when forward declarations would do increases compile + * times. + */ + +#include "amqp_types.h" +#include "FramingContent.h" +#include "FieldTable.h" + +#endif /*!_framing_amqp_types_decl_h*/ Propchange: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types_full.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/qpid/branches/qpid.0-9/cpp/lib/common/framing/amqp_types_full.h ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: incubator/qpid/branches/qpid.0-9/cpp/tests/MessageTest.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/cpp/tests/MessageTest.cpp?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/cpp/tests/MessageTest.cpp (original) +++ incubator/qpid/branches/qpid.0-9/cpp/tests/MessageTest.cpp Mon Feb 12 18:41:14 2007 @@ -74,7 +74,7 @@ CPPUNIT_ASSERT_EQUAL((u_int64_t) 14, msg->contentSize()); MockChannel channel(1); - // FIXME aconway 2007-02-02: deliver should take const ProtocolVersion& + // FIXME aconway 2007-02-02: deliver should take ProtocolVersion msg->deliver(channel, "ignore", 0, 100); CPPUNIT_ASSERT_EQUAL((size_t) 3, channel.out.frames.size()); AMQContentBody::shared_ptr contentBody(dynamic_pointer_cast<AMQContentBody, AMQBody>(channel.out.frames[2]->getBody())); Modified: incubator/qpid/branches/qpid.0-9/gentools/src/org/apache/qpid/gentools/CppGenerator.java URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/src/org/apache/qpid/gentools/CppGenerator.java?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/src/org/apache/qpid/gentools/CppGenerator.java (original) +++ incubator/qpid/branches/qpid.0-9/gentools/src/org/apache/qpid/gentools/CppGenerator.java Mon Feb 12 18:41:14 2007 @@ -408,7 +408,7 @@ } else if (token.compareTo("${cph_inner_class_defn}") == 0) { - codeSnippet = generateProxyInnerClassDefinitions(model, false, 4, 4); + codeSnippet = generateProxyInnerClassDeclarations(model, false, 4, 4); } else if (token.compareTo("${cpc_constructor_initializer}") == 0) { @@ -442,7 +442,7 @@ } else if (token.compareTo("${sph_inner_class_defn}") == 0) { - codeSnippet = generateProxyInnerClassDefinitions(model, true, 4, 4); + codeSnippet = generateProxyInnerClassDeclarations(model, true, 4, 4); } else if (token.compareTo("${spc_constructor_initializer}") == 0) { @@ -707,7 +707,6 @@ throws AmqpTypeMappingException { - String proxyClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; String indent = Utils.createSpaces(indentSize); String tab = Utils.createSpaces(tabSize); StringBuffer sb = new StringBuffer(); @@ -726,16 +725,9 @@ else sb.append(cr); sb.append(indent + "{" + cr); - sb.append(indent + "private:" + cr); - sb.append(indent + tab + proxyClassName+ "* parent;" + cr); - sb.append(cr); sb.append(indent + tab + "// Constructors and destructors" + cr); - sb.append(cr); - sb.append(indent + "protected:" + cr); - sb.append(indent + tab + handlerClassName + "() {}" + cr); sb.append(indent + "public:" + cr); - sb.append(indent + tab + handlerClassName + - "(" + proxyClassName + "* _parent) {parent = _parent;}" + cr); + sb.append(indent + tab + handlerClassName + "(){};\n"); sb.append(indent + tab + "virtual ~" + handlerClassName + "() {}" + cr); sb.append(cr); sb.append(indent + tab + "// Protocol methods" + cr); @@ -758,6 +750,7 @@ for (String thisMethodName : thisClass.methodMap.keySet()) { AmqpMethod method = thisClass.methodMap.get(thisMethodName); + String returnType = (abstractMethodFlag || method.isResponse(null))? "void" : "RequestId"; boolean clientChassisFlag = method.clientMethodFlagMap.isSet(); boolean serverChassisFlag = method.serverMethodFlagMap.isSet(); if ((serverFlag && serverChassisFlag) || (!serverFlag && clientChassisFlag)) @@ -768,10 +761,16 @@ for (AmqpOrdinalFieldMap thisFieldMap : overloadededParameterMap.keySet()) { AmqpVersionSet versionSet = overloadededParameterMap.get(thisFieldMap); - if (!first) - sb.append(cr); - sb.append(indent + "virtual void " + methodName + "(const MethodContext& context"); - sb.append(generateMethodParameterList(thisFieldMap, indentSize + (5*tabSize), true, true, true)); + if (!first) sb.append(cr); + sb.append(indent + "virtual "+returnType+" "+ methodName + "("); + if (abstractMethodFlag) sb.append("const MethodContext& context"); + boolean leadingComma = abstractMethodFlag; + int paramIndent = indentSize + (5*tabSize); + sb.append(generateMethodParameterList(thisFieldMap, paramIndent, leadingComma, true, true)); + if (!abstractMethodFlag && method.isResponse(null)) { + if (!thisFieldMap.isEmpty()) sb.append(", \n"+Utils.createSpaces(paramIndent)); + sb.append(" RequestId responseTo"); + } sb.append(" )"); if (abstractMethodFlag) sb.append(" = 0"); @@ -818,18 +817,23 @@ return sb.toString(); } + public String proxyInstanceName(AmqpClass inner, String outer) { + return parseForReservedWords(Utils.firstLower(inner.name), outer) + + "Proxy"; + } + protected String generateProxyInnerClassInstances(AmqpModel model, boolean serverFlag, int indentSize) { String indent = Utils.createSpaces(indentSize); StringBuffer sb = new StringBuffer(); - String outerClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; + String outerClassName = proxyOuterClassName(serverFlag); for (String thisClassName : model.classMap.keySet()) { AmqpClass thisClass = model.classMap.get(thisClassName); - String instanceName = parseForReservedWords(Utils.firstLower(thisClass.name), outerClassName); String className = parseForReservedWords(thisClass.name, null); - sb.append(indent + className + " " + instanceName + ";"); + sb.append(indent + className + " " + + proxyInstanceName(thisClass, outerClassName) + ";"); if (thisClass.versionSet.size() != globalVersionSet.size()) sb.append(" // AMQP Version(s) " + thisClass.versionSet + cr); else @@ -843,11 +847,10 @@ { String indent = Utils.createSpaces(indentSize); StringBuffer sb = new StringBuffer(); - String outerClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; for (String thisClassName : model.classMap.keySet()) { AmqpClass thisClass = model.classMap.get(thisClassName); - String className = parseForReservedWords(thisClass.name, outerClassName); + String className = parseForReservedWords(thisClass.name, proxyOuterClassName(serverFlag)); sb.append(indent + className + "& get" + className + "();"); if (thisClass.versionSet.size() != globalVersionSet.size()) sb.append(" // AMQP Version(s) " + thisClass.versionSet + cr); @@ -856,12 +859,15 @@ } return sb.toString(); } + + private String proxyOuterClassName(boolean serverFlag) { + return "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; + } - protected String generateProxyInnerClassDefinitions(AmqpModel model, boolean serverFlag, + protected String generateProxyInnerClassDeclarations(AmqpModel model, boolean serverFlag, int indentSize, int tabSize) throws AmqpTypeMappingException { - String proxyClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; String indent = Utils.createSpaces(indentSize); String tab = Utils.createSpaces(tabSize); StringBuffer sb = new StringBuffer(); @@ -870,29 +876,27 @@ { AmqpClass thisClass = model.classMap.get(thisClassName); String className = thisClass.name; - String superclassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Operations::" + - thisClass.name + "Handler"; if (!first) sb.append(cr); sb.append(indent + "// ==================== class " + className + " ====================" + cr); - sb.append(indent + "class " + className + " : virtual public " + superclassName); + sb.append(indent + "class " + className); if (thisClass.versionSet.size() != globalVersionSet.size()) sb.append(" // AMQP Version(s) " + thisClass.versionSet + cr); else sb.append(cr); sb.append(indent + "{" + cr); sb.append(indent + "private:" + cr); - sb.append(indent + tab + "OutputHandler* out;" + cr); - sb.append(indent + tab + proxyClassName + "* parent;" + cr); + sb.append(indent + tab + "ChannelAdapter& channel;" + cr); sb.append(cr); sb.append(indent + "public:" + cr); sb.append(indent + tab + "// Constructors and destructors" + cr); sb.append(cr); - sb.append(indent + tab + className + "(OutputHandler* out, " + proxyClassName + "* _parent) : " + cr); - sb.append(indent + tab + tab + "out(out) {parent = _parent;}" + cr); + sb.append(indent + tab + className + "(ChannelAdapter& ch) : " + cr); + sb.append(indent + tab + tab + "channel(ch) {}" + cr); sb.append(indent + tab + "virtual ~" + className + "() {}" + cr); sb.append(cr); + sb.append(indent + tab + "static "+className+"& get(" + proxyOuterClassName(serverFlag)+"& proxy) { return proxy.get"+className+"();}\n\n"); sb.append(indent + tab + "// Protocol methods" + cr); sb.append(cr); sb.append(generateInnerClassMethods(thisClass, serverFlag, false, indentSize + tabSize, tabSize)); @@ -905,22 +909,17 @@ protected String generateProxyConstructorInitializers(AmqpModel model, boolean serverFlag, int indentSize) { - String outerClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; - String superclassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Operations"; String indent = Utils.createSpaces(indentSize); - StringBuffer sb = new StringBuffer(indent + superclassName + "(major, minor)," + cr); - sb.append(indent + "version(major, minor)," + cr); - sb.append(indent + "out(out)"); + StringBuffer sb = new StringBuffer(); 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, this)"); - if (!cItr.hasNext()) - sb.append(cr); + sb.append(",\n"); + sb.append(indent + proxyInstanceName(thisClass, proxyOuterClassName(serverFlag)) + + "(channel)"); } + sb.append("\n"); return sb.toString(); } @@ -931,13 +930,12 @@ String indent = Utils.createSpaces(indentSize); String tab = Utils.createSpaces(tabSize); StringBuffer sb = new StringBuffer(); - String outerClassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; + String outerClassName = proxyOuterClassName(serverFlag); Iterator<String> cItr = model.classMap.keySet().iterator(); while (cItr.hasNext()) { AmqpClass thisClass = model.classMap.get(cItr.next()); String className = thisClass.name; - String instanceName = parseForReservedWords(Utils.firstLower(thisClass.name), outerClassName); sb.append(indent + outerClassName + "::" + className + "& " + outerClassName + "::get" + className + "()" + cr); sb.append(indent + "{" + cr); @@ -946,7 +944,8 @@ sb.append(indent + tab + "if (!" + generateVersionCheck(thisClass.versionSet) + ")" + cr); sb.append(indent + tab + tab + "throw new ProtocolVersionException();" + cr); } - sb.append(indent + tab + "return " + instanceName + ";" + cr); + sb.append(indent + tab + "return " + + proxyInstanceName(thisClass, outerClassName) + ";" + cr); sb.append(indent + "}" + cr); if (cItr.hasNext()) sb.append(cr); @@ -981,7 +980,7 @@ { String indent = Utils.createSpaces(indentSize); StringBuffer sb = new StringBuffer(); - String outerclassName = "AMQP_" + (serverFlag ? "Server" : "Client") + "Proxy"; + String outerclassName = proxyOuterClassName(serverFlag); boolean first = true; for (String thisMethodName : thisClass.methodMap.keySet()) { @@ -1000,10 +999,15 @@ AmqpVersionSet versionSet = overloadededParameterMap.get(thisFieldMap); if (!first) sb.append(cr); - sb.append(indent + "void " + outerclassName + "::" + thisClass.name + "::" + - methodName + "(const MethodContext& context"); - sb.append(generateMethodParameterList(thisFieldMap, indentSize + (5*tabSize), true, true, true)); - sb.append(" )"); + String returnType = method.isResponse(null) ? "void" : "RequestId"; + sb.append(indent + returnType + " " + outerclassName + "::" + thisClass.name + "::" + + methodName + "("); + sb.append(generateMethodParameterList(thisFieldMap, indentSize + (5*tabSize), false, true, true)); + if (method.isResponse(null)) { + if (!thisFieldMap.isEmpty()) sb.append(", "); + sb.append("RequestId responseTo"); + } + sb.append(")"); if (versionSet.size() != globalVersionSet.size()) sb.append(" // AMQP Version(s) " + versionSet); sb.append(cr); @@ -1029,7 +1033,7 @@ StringBuffer sb = new StringBuffer(); if (versionConsistentFlag) { - sb.append(generateMethodBodyCall(method, fieldMap, methodBodyClassName, null, indentSize, tabSize)); + sb.append(generateProxyMethodBody(method, fieldMap, methodBodyClassName, null, indentSize, tabSize)); } else { @@ -1041,7 +1045,7 @@ sb.append("else "); sb.append("if (" + generateVersionCheck(thisVersion) + ")" + cr); sb.append(indent + "{" + cr); - sb.append(generateMethodBodyCall(method, fieldMap, methodBodyClassName, thisVersion, + sb.append(generateProxyMethodBody(method, fieldMap, methodBodyClassName, thisVersion, indentSize + tabSize, tabSize)); sb.append(indent + "}" + cr); firstOverloadedMethodFlag = false; @@ -1058,7 +1062,7 @@ return sb.toString(); } - protected String generateMethodBodyCall(AmqpMethod method, AmqpOrdinalFieldMap fieldMap, String methodBodyClassName, + protected String generateProxyMethodBody(AmqpMethod method, AmqpOrdinalFieldMap fieldMap, String methodBodyClassName, AmqpVersion version, int indentSize, int tabSize) throws AmqpTypeMappingException { @@ -1066,10 +1070,9 @@ String tab = Utils.createSpaces(tabSize); String namespace = version != null ? version.namespace() + "::" : ""; StringBuffer sb = new StringBuffer(); - sb.append(indent+tab+"context.channel->send(new "); - sb.append(namespace + methodBodyClassName + "( parent->getProtocolVersion()"); - if (method.isResponse(version)) - sb.append(", context.methodBody->getRequestId()"); + sb.append(indent+tab+(method.isResponse(version) ? "" : "return ")+"channel.send(new "); + sb.append(namespace + methodBodyClassName + "( channel.getVersion()"); + if (method.isResponse(version)) sb.append(", responseTo"); sb.append(generateMethodParameterList(fieldMap, indentSize + (5*tabSize), true, false, true)); sb.append("));\n"); return sb.toString(); @@ -1429,7 +1432,7 @@ StringBuffer sb = new StringBuffer(); if (method.fieldMap.size() > 0 || method.isResponse(version)) { - sb.append(indent + thisClass.name + Utils.firstUpper(method.name) + "Body(const ProtocolVersion& version," + cr); + sb.append(indent + thisClass.name + Utils.firstUpper(method.name) + "Body(ProtocolVersion version," + cr); if (method.isResponse(version)) { sb.append(indent+tab+"RequestId toRequest"); if (method.fieldMap.size() >0) @@ -1609,8 +1612,9 @@ private String setRef(String codeType) { - if (codeType.compareTo("string") == 0 || - codeType.compareTo("FieldTable") == 0) + if (codeType.equals("string") || + codeType.equals("FieldTable") || + codeType.equals("Content")) return "const " + codeType + "&"; return codeType; } Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientOperations.h.tmpl Mon Feb 12 18:41:14 2007 @@ -26,48 +26,26 @@ %{VLIST} * ${major}-${minor} */ -#include <sstream> - #ifndef _AMQP_ClientOperations_ #define _AMQP_ClientOperations_ -#include <FieldTable.h> -#include <FramingContent.h> -#include <ProtocolVersion.h> -#include <ProtocolVersionException.h> -#include "MethodContext.h" +#include "ProtocolVersion.h" namespace qpid { namespace framing { -class AMQP_ClientProxy; +class MethodContext; class AMQP_ClientOperations { -protected: - ProtocolVersion version; - AMQP_ClientOperations() {} - public: - AMQP_ClientOperations(u_int8_t major, u_int8_t minor) : version(major, minor) {} - AMQP_ClientOperations(const ProtocolVersion& version) : version(version) {} virtual ~AMQP_ClientOperations() {} - 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 bool isVersion(u_int8_t _major, u_int8_t _minor) const - { - return version.equals(_major, _minor); - } - inline bool isVersion(const ProtocolVersion& _version) const - { - return version.equals(_version); - } - - // Include framing constant declarations - #include <AMQP_Constants.h> - + virtual ProtocolVersion getVersion() const = 0; + + // Include framing constant declarations + #include <AMQP_Constants.h> + // Inner classes %{CLIST} ${coh_inner_class} Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.cpp.tmpl Mon Feb 12 18:41:14 2007 @@ -25,30 +25,28 @@ * Supported AMQP versions: %{VLIST} * ${major}-${minor} */ - #include <sstream> - -#include <AMQP_ClientProxy.h> -#include <AMQFrame.h> +#include "AMQP_ClientProxy.h" #include "framing/ChannelAdapter.h" +#include "framing/amqp_types_full.h" %{MLIST} ${cpc_method_body_include} namespace qpid { namespace framing { -AMQP_ClientProxy::AMQP_ClientProxy(OutputHandler* out, u_int8_t major, u_int8_t minor) : -%{CLIST} ${cpc_constructor_initializer} - -{} - // Inner class instance get methods +AMQP_ClientProxy::AMQP_ClientProxy(ChannelAdapter& ch) : + Proxy(ch)%{CLIST} ${cpc_constructor_initializer} + {} + + // Inner class instance get methods %{CLIST} ${cpc_inner_class_get_method} - // Inner class implementation + // Inner class implementation %{CLIST} ${cpc_inner_class_impl} -} /* namespace framing */ -} /* namespace qpid */ +}} // namespae qpid::framing + Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ClientProxy.h.tmpl Mon Feb 12 18:41:14 2007 @@ -29,45 +29,28 @@ #ifndef _AMQP_ClientProxy_ #define _AMQP_ClientProxy_ -#include <AMQP_ClientOperations.h> -#include <FieldTable.h> -#include <FramingContent.h> -#include <OutputHandler.h> +#include "framing/Proxy.h" namespace qpid { namespace framing { -class AMQP_ClientProxy : public AMQP_ClientOperations +class AMQP_ClientProxy : public Proxy { -private: - - ProtocolVersion version; - OutputHandler* out; -%{CLIST} ${cph_handler_pointer_defn} - public: - AMQP_ClientProxy(OutputHandler* out, u_int8_t major, u_int8_t minor); - const ProtocolVersion& getProtocolVersion() {return version;} - virtual ~AMQP_ClientProxy() {} - - // Get methods for handlers + AMQP_ClientProxy(ChannelAdapter& ch); -%{CLIST} ${cph_handler_pointer_get_method} - - // Inner class definitions + // Inner class definitions %{CLIST} ${cph_inner_class_defn} -private: - // Inner class instances - -%{CLIST} ${cph_inner_class_instance} - -public: - // Inner class instance get methods + // Inner class instance get methods %{CLIST} ${cph_inner_class_get_method} +private: + // Inner class instances + +%{CLIST} ${cph_inner_class_instance} }; /* class AMQP_ClientProxy */ } /* namespace framing */ Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_MethodVersionMap.cpp.tmpl Mon Feb 12 18:41:14 2007 @@ -27,8 +27,8 @@ */ #include <sstream> - -#include <AMQP_MethodVersionMap.h> +#include "framing/ProtocolVersionException.h" +#include "AMQP_MethodVersionMap.h" namespace qpid { Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerOperations.h.tmpl Mon Feb 12 18:41:14 2007 @@ -29,43 +29,25 @@ #ifndef _AMQP_ServerOperations_ #define _AMQP_ServerOperations_ -#include <FieldTable.h> -#include <FramingContent.h> -#include <ProtocolVersion.h> -#include <ProtocolVersionException.h> -#include "MethodContext.h" +#include "ProtocolVersion.h" namespace qpid { namespace framing { -class AMQP_ServerProxy; -class AMQP_ClientProxy; +class MethodContext; class AMQP_ServerOperations { protected: ProtocolVersion version; - AMQP_ServerOperations() {} public: - AMQP_ServerOperations(u_int8_t major, u_int8_t minor) : version(major, minor) {} - AMQP_ServerOperations(const ProtocolVersion& version) : version(version) {} virtual ~AMQP_ServerOperations() {} - 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 bool isVersion(u_int8_t _major, u_int8_t _minor) const - { - return version.equals(_major, _minor); - } - inline bool isVersion(const ProtocolVersion& _version) const - { - return version.equals(_version); - } + virtual ProtocolVersion getVersion() const = 0; - // Include framing constant declarations - #include <AMQP_Constants.h> + // Include framing constant declarations + #include "AMQP_Constants.h" // Inner classes Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.cpp.tmpl Mon Feb 12 18:41:14 2007 @@ -27,27 +27,25 @@ */ #include <sstream> - -#include <AMQP_ServerProxy.h> -#include <AMQFrame.h> +#include "AMQP_ServerProxy.h" #include "framing/ChannelAdapter.h" +#include "framing/amqp_types_full.h" %{MLIST} ${spc_method_body_include} namespace qpid { namespace framing { -AMQP_ServerProxy::AMQP_ServerProxy(OutputHandler* out, u_int8_t major, u_int8_t minor) : -%{CLIST} ${spc_constructor_initializer} -{} +AMQP_ServerProxy::AMQP_ServerProxy(ChannelAdapter& ch) : + Proxy(ch)%{CLIST} ${spc_constructor_initializer} + {} - // Inner class instance get methods + // Inner class instance get methods %{CLIST} ${spc_inner_class_get_method} - // Inner class implementation + // Inner class implementation %{CLIST} ${spc_inner_class_impl} -} /* namespace framing */ -} /* namespace qpid */ +}} // namespae qpid::framing Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/AMQP_ServerProxy.h.tmpl Mon Feb 12 18:41:14 2007 @@ -29,44 +29,28 @@ #ifndef _AMQP_ServerProxy_ #define _AMQP_ServerProxy_ -#include <AMQP_ServerOperations.h> -#include <FieldTable.h> -#include <FramingContent.h> -#include <OutputHandler.h> +#include "framing/Proxy.h" namespace qpid { namespace framing { -class AMQP_ServerProxy : public AMQP_ServerOperations +class AMQP_ServerProxy : public Proxy { -private: - ProtocolVersion version; - OutputHandler* out; -%{CLIST} ${sph_handler_pointer_defn} - public: - AMQP_ServerProxy(OutputHandler* out, u_int8_t major, u_int8_t minor); - const ProtocolVersion& getProtocolVersion() {return version;} - virtual ~AMQP_ServerProxy() {} - - // Get methods for handlers + AMQP_ServerProxy(ChannelAdapter& ch); -%{CLIST} ${sph_handler_pointer_get_method} - - // Inner class definitions + // Inner class definitions %{CLIST} ${sph_inner_class_defn} + // Inner class instance get methods + +%{CLIST} ${sph_inner_class_get_method} + private: - // Inner class instances + // 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 */ Modified: incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/MethodBodyClass.h.tmpl URL: http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/MethodBodyClass.h.tmpl?view=diff&rev=506823&r1=506822&r2=506823 ============================================================================== --- incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/MethodBodyClass.h.tmpl (original) +++ incubator/qpid/branches/qpid.0-9/gentools/templ.cpp/MethodBodyClass.h.tmpl Mon Feb 12 18:41:14 2007 @@ -62,7 +62,7 @@ ${mb_constructor_with_initializers} - ${CLASS}${METHOD}Body(const ProtocolVersion& version): ${mb_base_class}(version) {} + ${CLASS}${METHOD}Body(ProtocolVersion version): ${mb_base_class}(version) {} virtual ~${CLASS}${METHOD}Body() {} // Attribute get methods
