/home/aconway/svn/qpid/cpp/gen/qpid/framing/QueueDeclareBody.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_QueueDeclareBody__
00029 #define qpid_framing_QueueDeclareBody__
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 QueueDeclareBody : public AMQRequestBody
00047 {
00048 
00049         // Method field declarations
00050 
00051     u_int16_t ticket;
00052     string queue;
00053     bool passive;
00054     bool durable;
00055     bool exclusive;
00056     bool autoDelete;
00057     bool nowait;
00058     FieldTable arguments;
00059      
00060 
00061 public:
00062     static const ClassId CLASS_ID= 50;
00063     static const MethodId METHOD_ID = 10;
00064 
00065     typedef boost::shared_ptr<QueueDeclareBody> shared_ptr;
00066 
00067         // Constructors and destructors
00068 
00069     QueueDeclareBody(ProtocolVersion version,
00070         u_int16_t ticket,
00071         const string& queue,
00072         bool passive,
00073         bool durable,
00074         bool exclusive,
00075         bool autoDelete,
00076         bool nowait,
00077         const FieldTable& arguments
00078         ) : AMQRequestBody(version), 
00079         ticket(ticket),
00080         queue(queue),
00081         passive(passive),
00082         durable(durable),
00083         exclusive(exclusive),
00084         autoDelete(autoDelete),
00085         nowait(nowait),
00086         arguments(arguments)
00087     { }
00088 
00089 
00090     QueueDeclareBody(ProtocolVersion version): AMQRequestBody(version) {}
00091     virtual ~QueueDeclareBody() {}
00092     
00093     // Attribute get methods
00094 
00095     u_int16_t getTicket() { return ticket; }
00096     const string& getQueue() { return queue; }
00097     bool getPassive() { return passive; }
00098     bool getDurable() { return durable; }
00099     bool getExclusive() { return exclusive; }
00100     bool getAutoDelete() { return autoDelete; }
00101     bool getNowait() { return nowait; }
00102     const FieldTable& getArguments() { return arguments; }
00103 
00104     // Helper methods
00105     
00106     inline void print(std::ostream& out) const
00107     {
00108             printPrefix(out);
00109             out << "QueueDeclare: ";
00110         out << "ticket=" << ticket;
00111         out << "; queue=" << queue;
00112         out << "; passive=" << passive;
00113         out << "; durable=" << durable;
00114         out << "; exclusive=" << exclusive;
00115         out << "; autoDelete=" << autoDelete;
00116         out << "; nowait=" << nowait;
00117         out << "; arguments=" << arguments;
00118     }
00119 
00120     inline ClassId amqpClassId() const { return CLASS_ID; }
00121     inline MethodId amqpMethodId() const { return METHOD_ID; }
00122 
00123     u_int32_t size() const
00124     {
00125         u_int32_t sz = baseSize();
00126         sz += 2; /* ticket: short */
00127         sz += 1 + queue.length(); /* queue: shortstr */
00128         sz += 1; /* Combinded bits: [passive, durable, exclusive, autoDelete, nowait] */
00129         sz += arguments.size(); /* arguments: table */
00130         return sz;
00131     }
00132 
00133     void encodeContent(Buffer&  buffer) const
00134     {
00135         buffer.putShort(ticket); /* ticket: short */
00136         buffer.putShortString(queue); /* queue: shortstr */
00137         u_int8_t flags_7[1] = {0};
00138         flags_7[0] |= passive << 0; /* passive: bit */
00139         flags_7[0] |= durable << 1; /* durable: bit */
00140         flags_7[0] |= exclusive << 2; /* exclusive: bit */
00141         flags_7[0] |= autoDelete << 3; /* autoDelete: bit */
00142         flags_7[0] |= nowait << 4; /* nowait: bit */
00143         buffer.putOctet(flags_7[0]);
00144         buffer.putFieldTable(arguments); /* arguments: table */
00145     }
00146 
00147     inline void decodeContent(Buffer&  buffer)
00148     {
00149         ticket = buffer.getShort(); /* ticket: short */
00150         buffer.getShortString(queue); /* queue: shortstr */
00151         u_int8_t flags_7[1];
00152         flags_7[0] = buffer.getOctet();
00153         passive = (1 << 0) & flags_7[0]; /* passive: bit */
00154         durable = (1 << 1) & flags_7[0]; /* durable: bit */
00155         exclusive = (1 << 2) & flags_7[0]; /* exclusive: bit */
00156         autoDelete = (1 << 3) & flags_7[0]; /* autoDelete: bit */
00157         nowait = (1 << 4) & flags_7[0]; /* nowait: bit */
00158         buffer.getFieldTable(arguments); /* arguments: table */
00159     }       
00160 
00161     void invoke(AMQP_ServerOperations& target, const MethodContext& context)
00162     {
00163         target.getQueueHandler()->declare(context,
00164                     ticket,
00165                     queue,
00166                     passive,
00167                     durable,
00168                     exclusive,
00169                     autoDelete,
00170                     nowait,
00171                     arguments
00172                     );
00173     }
00174 
00175 
00176 }; // class QueueDeclareBody
00177 
00178 
00179 } // namespace framing
00180 } // namespace qpid
00181 
00182 #endif
00183 

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