/home/aconway/svn/qpid/cpp/gen/qpid/framing/ExchangeDeclareBody.h

00001 /*
00002  *
00003  * Licensed to the Apache Software Foundation (ASF) under one
00004  * or more contributor license agreements.  See the NOTICE file
00005  * distributed with this work for additional information
00006  * regarding copyright ownership.  The ASF licenses this file
00007  * to you under the Apache License, Version 2.0 (the
00008  * "License"); you may not use this file except in compliance
00009  * with the License.  You may obtain a copy of the License at
00010  * 
00011  *   http://www.apache.org/licenses/LICENSE-2.0
00012  * 
00013  * Unless required by applicable law or agreed to in writing,
00014  * software distributed under the License is distributed on an
00015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00016  * KIND, either express or implied.  See the License for the
00017  * specific language governing permissions and limitations
00018  * under the License.
00019  *
00020  */
00021 
00022 /*
00023  * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
00024  * Supported AMQP versions:
00025  *   0-9
00026  */
00027 
00028 #ifndef qpid_framing_ExchangeDeclareBody__
00029 #define qpid_framing_ExchangeDeclareBody__
00030 
00031 #include <string>
00032 #include <sstream>
00033 
00034 #include "qpid/framing/amqp_types.h"
00035 #include "qpid/framing/AMQRequestBody.h"
00036 #include "qpid/framing/Buffer.h"
00037 #include "qpid/framing/FieldTable.h"
00038 #include "qpid/framing/FramingContent.h"
00039 
00040 namespace qpid
00041 {
00042 namespace framing
00043 {
00044 
00045  
00046 class ExchangeDeclareBody : public AMQRequestBody
00047 {
00048 
00049         // Method field declarations
00050 
00051     u_int16_t ticket;
00052     string exchange;
00053     string type;
00054     bool passive;
00055     bool durable;
00056     bool autoDelete;
00057     bool internal;
00058     bool nowait;
00059     FieldTable arguments;
00060      
00061 
00062 public:
00063     static const ClassId CLASS_ID= 40;
00064     static const MethodId METHOD_ID = 10;
00065 
00066     typedef boost::shared_ptr<ExchangeDeclareBody> shared_ptr;
00067 
00068         // Constructors and destructors
00069 
00070     ExchangeDeclareBody(ProtocolVersion version,
00071         u_int16_t ticket,
00072         const string& exchange,
00073         const string& type,
00074         bool passive,
00075         bool durable,
00076         bool autoDelete,
00077         bool internal,
00078         bool nowait,
00079         const FieldTable& arguments
00080         ) : AMQRequestBody(version), 
00081         ticket(ticket),
00082         exchange(exchange),
00083         type(type),
00084         passive(passive),
00085         durable(durable),
00086         autoDelete(autoDelete),
00087         internal(internal),
00088         nowait(nowait),
00089         arguments(arguments)
00090     { }
00091 
00092 
00093     ExchangeDeclareBody(ProtocolVersion version): AMQRequestBody(version) {}
00094     virtual ~ExchangeDeclareBody() {}
00095     
00096     // Attribute get methods
00097 
00098     u_int16_t getTicket() { return ticket; }
00099     const string& getExchange() { return exchange; }
00100     const string& getType() { return type; }
00101     bool getPassive() { return passive; }
00102     bool getDurable() { return durable; }
00103     bool getAutoDelete() { return autoDelete; }
00104     bool getInternal() { return internal; }
00105     bool getNowait() { return nowait; }
00106     const FieldTable& getArguments() { return arguments; }
00107 
00108     // Helper methods
00109     
00110     inline void print(std::ostream& out) const
00111     {
00112             printPrefix(out);
00113             out << "ExchangeDeclare: ";
00114         out << "ticket=" << ticket;
00115         out << "; exchange=" << exchange;
00116         out << "; type=" << type;
00117         out << "; passive=" << passive;
00118         out << "; durable=" << durable;
00119         out << "; autoDelete=" << autoDelete;
00120         out << "; internal=" << internal;
00121         out << "; nowait=" << nowait;
00122         out << "; arguments=" << arguments;
00123     }
00124 
00125     inline ClassId amqpClassId() const { return CLASS_ID; }
00126     inline MethodId amqpMethodId() const { return METHOD_ID; }
00127 
00128     u_int32_t size() const
00129     {
00130         u_int32_t sz = baseSize();
00131         sz += 2; /* ticket: short */
00132         sz += 1 + exchange.length(); /* exchange: shortstr */
00133         sz += 1 + type.length(); /* type: shortstr */
00134         sz += 1; /* Combinded bits: [passive, durable, autoDelete, internal, nowait] */
00135         sz += arguments.size(); /* arguments: table */
00136         return sz;
00137     }
00138 
00139     void encodeContent(Buffer&  buffer) const
00140     {
00141         buffer.putShort(ticket); /* ticket: short */
00142         buffer.putShortString(exchange); /* exchange: shortstr */
00143         buffer.putShortString(type); /* type: shortstr */
00144         u_int8_t flags_8[1] = {0};
00145         flags_8[0] |= passive << 0; /* passive: bit */
00146         flags_8[0] |= durable << 1; /* durable: bit */
00147         flags_8[0] |= autoDelete << 2; /* autoDelete: bit */
00148         flags_8[0] |= internal << 3; /* internal: bit */
00149         flags_8[0] |= nowait << 4; /* nowait: bit */
00150         buffer.putOctet(flags_8[0]);
00151         buffer.putFieldTable(arguments); /* arguments: table */
00152     }
00153 
00154     inline void decodeContent(Buffer&  buffer)
00155     {
00156         ticket = buffer.getShort(); /* ticket: short */
00157         buffer.getShortString(exchange); /* exchange: shortstr */
00158         buffer.getShortString(type); /* type: shortstr */
00159         u_int8_t flags_8[1];
00160         flags_8[0] = buffer.getOctet();
00161         passive = (1 << 0) & flags_8[0]; /* passive: bit */
00162         durable = (1 << 1) & flags_8[0]; /* durable: bit */
00163         autoDelete = (1 << 2) & flags_8[0]; /* autoDelete: bit */
00164         internal = (1 << 3) & flags_8[0]; /* internal: bit */
00165         nowait = (1 << 4) & flags_8[0]; /* nowait: bit */
00166         buffer.getFieldTable(arguments); /* arguments: table */
00167     }       
00168 
00169     void invoke(AMQP_ServerOperations& target, const MethodContext& context)
00170     {
00171         target.getExchangeHandler()->declare(context,
00172                     ticket,
00173                     exchange,
00174                     type,
00175                     passive,
00176                     durable,
00177                     autoDelete,
00178                     internal,
00179                     nowait,
00180                     arguments
00181                     );
00182     }
00183 
00184 
00185 }; // class ExchangeDeclareBody
00186 
00187 
00188 } // namespace framing
00189 } // namespace qpid
00190 
00191 #endif
00192 

Generated on Tue Apr 17 14:22:03 2007 for Qpid by  doxygen 1.4.7