/home/aconway/svn/qpid/cpp/gen/BasicConsumeBody.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_BasicConsumeBody__
00029 #define qpid_framing_BasicConsumeBody__
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 BasicConsumeBody : public AMQMethodBody
00046 {
00047         // Method field declarations
00048 
00049     u_int16_t ticket;
00050     string queue;
00051     string consumerTag;
00052     bool noLocal;
00053     bool noAck;
00054     bool exclusive;
00055     bool nowait;
00056     FieldTable arguments;
00057      
00058 
00059 public:
00060     typedef boost::shared_ptr<BasicConsumeBody> shared_ptr;
00061 
00062         // Constructors and destructors
00063 
00064     BasicConsumeBody(ProtocolVersion& version,
00065         u_int16_t ticket,
00066         const string& queue,
00067         const string& consumerTag,
00068         bool noLocal,
00069         bool noAck,
00070         bool exclusive,
00071         bool nowait,
00072         const FieldTable& arguments
00073         ) :
00074         AMQMethodBody(version),
00075         ticket(ticket),
00076         queue(queue),
00077         consumerTag(consumerTag),
00078         noLocal(noLocal),
00079         noAck(noAck),
00080         exclusive(exclusive),
00081         nowait(nowait),
00082         arguments(arguments)
00083     { }
00084 
00085 
00086     inline BasicConsumeBody(u_int8_t major, u_int8_t minor): AMQMethodBody(major, minor) {}
00087     inline BasicConsumeBody(ProtocolVersion& version): AMQMethodBody(version) {}
00088     virtual ~BasicConsumeBody() {}
00089     
00090     // Attribute get methods
00091 
00092     inline u_int16_t getTicket() { return ticket; }
00093     inline const string& getQueue() { return queue; }
00094     inline const string& getConsumerTag() { return consumerTag; }
00095     inline bool getNoLocal() { return noLocal; }
00096     inline bool getNoAck() { return noAck; }
00097     inline bool getExclusive() { return exclusive; }
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 << "BasicConsume: ";
00106         out << "ticket=" << ticket;
00107         out << "; queue=" << queue;
00108         out << "; consumerTag=" << consumerTag;
00109         out << "; noLocal=" << noLocal;
00110         out << "; noAck=" << noAck;
00111         out << "; exclusive=" << exclusive;
00112         out << "; nowait=" << nowait;
00113         out << "; arguments=" << arguments;
00114     }
00115 
00116     inline u_int16_t amqpClassId() const
00117     {
00118         return 60;
00119     }
00120     
00121     inline u_int16_t amqpMethodId() const
00122     {
00123         return 20;
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 + consumerTag.length(); /* consumerTag: shortstr */
00132         size += 1; /* Combinded bits: [noLocal, noAck, exclusive, nowait] */
00133         size += arguments.size(); /* arguments: table */
00134         return size;
00135     }
00136 
00137     inline void encodeContent(Buffer& buffer) const
00138     {
00139         buffer.putShort(ticket); /* ticket: short */
00140         buffer.putShortString(queue); /* queue: shortstr */
00141         buffer.putShortString(consumerTag); /* consumerTag: shortstr */
00142         u_int8_t flags_7[1] = {0};
00143         flags_7[0] |= noLocal << 0; /* noLocal: bit */
00144         flags_7[0] |= noAck << 1; /* noAck: bit */
00145         flags_7[0] |= exclusive << 2; /* exclusive: bit */
00146         flags_7[0] |= nowait << 3; /* nowait: bit */
00147         buffer.putOctet(flags_7[0]);
00148         buffer.putFieldTable(arguments); /* arguments: table */
00149     }
00150 
00151     inline void decodeContent(Buffer& buffer)
00152     {
00153         ticket = buffer.getShort(); /* ticket: short */
00154         buffer.getShortString(queue); /* queue: shortstr */
00155         buffer.getShortString(consumerTag); /* consumerTag: shortstr */
00156         u_int8_t flags_7[1];
00157         flags_7[0] = buffer.getOctet();
00158         noLocal = (1 << 0) & flags_7[0]; /* noLocal: bit */
00159         noAck = (1 << 1) & flags_7[0]; /* noAck: bit */
00160         exclusive = (1 << 2) & flags_7[0]; /* exclusive: bit */
00161         nowait = (1 << 3) & flags_7[0]; /* nowait: bit */
00162         buffer.getFieldTable(arguments); /* arguments: table */
00163     }       
00164 
00165     inline void invoke(AMQP_ServerOperations& target, u_int16_t channel)
00166     {
00167         target.getBasicHandler()->consume(channel,
00168                     ticket,
00169                     queue,
00170                     consumerTag,
00171                     noLocal,
00172                     noAck,
00173                     exclusive,
00174                     nowait,
00175                     arguments
00176                     );
00177     }
00178 
00179 
00180 }; // class BasicConsumeBody
00181 
00182 
00183 } // namespace framing
00184 } // namespace qpid
00185 
00186 #endif
00187 

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