/home/aconway/svn/qpid/cpp/gen/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  *   8-0
00026  */
00027 
00028 #ifndef qpid_framing_ExchangeDeclareBody__
00029 #define qpid_framing_ExchangeDeclareBody__
00030 
00031 #include <string>
00032 #include <sstream>
00033 
00034 #include <amqp_types.h>
00035 #include <AMQMethodBody.h>
00036 #include <Buffer.h>
00037 #include <FieldTable.h>
00038 
00039 namespace qpid
00040 {
00041 namespace framing
00042 {
00043 
00044  
00045 class ExchangeDeclareBody : public AMQMethodBody
00046 {
00047         // Method field declarations
00048 
00049     u_int16_t ticket;
00050     string exchange;
00051     string type;
00052     bool passive;
00053     bool durable;
00054     bool autoDelete;
00055     bool internal;
00056     bool nowait;
00057     FieldTable arguments;
00058      
00059 
00060 public:
00061     typedef boost::shared_ptr<ExchangeDeclareBody> shared_ptr;
00062 
00063         // Constructors and destructors
00064 
00065     ExchangeDeclareBody(ProtocolVersion& version,
00066         u_int16_t ticket,
00067         const string& exchange,
00068         const string& type,
00069         bool passive,
00070         bool durable,
00071         bool autoDelete,
00072         bool internal,
00073         bool nowait,
00074         const FieldTable& arguments
00075         ) :
00076         AMQMethodBody(version),
00077         ticket(ticket),
00078         exchange(exchange),
00079         type(type),
00080         passive(passive),
00081         durable(durable),
00082         autoDelete(autoDelete),
00083         internal(internal),
00084         nowait(nowait),
00085         arguments(arguments)
00086     { }
00087 
00088 
00089     inline ExchangeDeclareBody(u_int8_t major, u_int8_t minor): AMQMethodBody(major, minor) {}
00090     inline ExchangeDeclareBody(ProtocolVersion& version): AMQMethodBody(version) {}
00091     virtual ~ExchangeDeclareBody() {}
00092     
00093     // Attribute get methods
00094 
00095     inline u_int16_t getTicket() { return ticket; }
00096     inline const string& getExchange() { return exchange; }
00097     inline const string& getType() { return type; }
00098     inline bool getPassive() { return passive; }
00099     inline bool getDurable() { return durable; }
00100     inline bool getAutoDelete() { return autoDelete; }
00101     inline bool getInternal() { return internal; }
00102     inline bool getNowait() { return nowait; }
00103     inline const FieldTable& getArguments() { return arguments; }
00104 
00105     // Helper methods
00106     
00107     inline void print(std::ostream& out) const
00108     {
00109             out << "ExchangeDeclare: ";
00110         out << "ticket=" << ticket;
00111         out << "; exchange=" << exchange;
00112         out << "; type=" << type;
00113         out << "; passive=" << passive;
00114         out << "; durable=" << durable;
00115         out << "; autoDelete=" << autoDelete;
00116         out << "; internal=" << internal;
00117         out << "; nowait=" << nowait;
00118         out << "; arguments=" << arguments;
00119     }
00120 
00121     inline u_int16_t amqpClassId() const
00122     {
00123         return 40;
00124     }
00125     
00126     inline u_int16_t amqpMethodId() const
00127     {
00128         return 10;
00129     }
00130 
00131     inline u_int32_t bodySize() const
00132     {
00133                 u_int32_t size = 0;        
00134         size += 2; /* ticket: short */
00135         size += 1 + exchange.length(); /* exchange: shortstr */
00136         size += 1 + type.length(); /* type: shortstr */
00137         size += 1; /* Combinded bits: [passive, durable, autoDelete, internal, nowait] */
00138         size += arguments.size(); /* arguments: table */
00139         return size;
00140     }
00141 
00142     inline void encodeContent(Buffer& buffer) const
00143     {
00144         buffer.putShort(ticket); /* ticket: short */
00145         buffer.putShortString(exchange); /* exchange: shortstr */
00146         buffer.putShortString(type); /* type: shortstr */
00147         u_int8_t flags_8[1] = {0};
00148         flags_8[0] |= passive << 0; /* passive: bit */
00149         flags_8[0] |= durable << 1; /* durable: bit */
00150         flags_8[0] |= autoDelete << 2; /* autoDelete: bit */
00151         flags_8[0] |= internal << 3; /* internal: bit */
00152         flags_8[0] |= nowait << 4; /* nowait: bit */
00153         buffer.putOctet(flags_8[0]);
00154         buffer.putFieldTable(arguments); /* arguments: table */
00155     }
00156 
00157     inline void decodeContent(Buffer& buffer)
00158     {
00159         ticket = buffer.getShort(); /* ticket: short */
00160         buffer.getShortString(exchange); /* exchange: shortstr */
00161         buffer.getShortString(type); /* type: shortstr */
00162         u_int8_t flags_8[1];
00163         flags_8[0] = buffer.getOctet();
00164         passive = (1 << 0) & flags_8[0]; /* passive: bit */
00165         durable = (1 << 1) & flags_8[0]; /* durable: bit */
00166         autoDelete = (1 << 2) & flags_8[0]; /* autoDelete: bit */
00167         internal = (1 << 3) & flags_8[0]; /* internal: bit */
00168         nowait = (1 << 4) & flags_8[0]; /* nowait: bit */
00169         buffer.getFieldTable(arguments); /* arguments: table */
00170     }       
00171 
00172     inline void invoke(AMQP_ServerOperations& target, u_int16_t channel)
00173     {
00174         target.getExchangeHandler()->declare(channel,
00175                     ticket,
00176                     exchange,
00177                     type,
00178                     passive,
00179                     durable,
00180                     autoDelete,
00181                     internal,
00182                     nowait,
00183                     arguments
00184                     );
00185     }
00186 
00187 
00188 }; // class ExchangeDeclareBody
00189 
00190 
00191 } // namespace framing
00192 } // namespace qpid
00193 
00194 #endif
00195 

Generated on Thu Jan 25 11:48:13 2007 for Qpid by  doxygen 1.5.1