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

Generated on Mon Nov 26 19:13:17 2007 for Qpid by  doxygen 1.5.1