/opt/workspace/qpid/tags/M2/Final/cpp/gen/FileConsumeBody.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_FileConsumeBody__
00029 #define qpid_framing_FileConsumeBody__
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 FileConsumeBody : 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      
00057 
00058 public:
00059     typedef boost::shared_ptr<FileConsumeBody> shared_ptr;
00060 
00061         // Constructors and destructors
00062 
00063     FileConsumeBody(ProtocolVersion& version,
00064         u_int16_t ticket,
00065         const string& queue,
00066         const string& consumerTag,
00067         bool noLocal,
00068         bool noAck,
00069         bool exclusive,
00070         bool nowait
00071         ) :
00072         AMQMethodBody(version),
00073         ticket(ticket),
00074         queue(queue),
00075         consumerTag(consumerTag),
00076         noLocal(noLocal),
00077         noAck(noAck),
00078         exclusive(exclusive),
00079         nowait(nowait)
00080     { }
00081 
00082 
00083     inline FileConsumeBody(u_int8_t major, u_int8_t minor): AMQMethodBody(major, minor) {}
00084     inline FileConsumeBody(ProtocolVersion& version): AMQMethodBody(version) {}
00085     virtual ~FileConsumeBody() {}
00086     
00087     // Attribute get methods
00088 
00089     inline u_int16_t getTicket() { return ticket; }
00090     inline const string& getQueue() { return queue; }
00091     inline const string& getConsumerTag() { return consumerTag; }
00092     inline bool getNoLocal() { return noLocal; }
00093     inline bool getNoAck() { return noAck; }
00094     inline bool getExclusive() { return exclusive; }
00095     inline bool getNowait() { return nowait; }
00096 
00097     // Helper methods
00098     
00099     inline void print(std::ostream& out) const
00100     {
00101             out << "FileConsume: ";
00102         out << "ticket=" << ticket;
00103         out << "; queue=" << queue;
00104         out << "; consumerTag=" << consumerTag;
00105         out << "; noLocal=" << noLocal;
00106         out << "; noAck=" << noAck;
00107         out << "; exclusive=" << exclusive;
00108         out << "; nowait=" << nowait;
00109     }
00110 
00111     inline u_int16_t amqpClassId() const
00112     {
00113         return 70;
00114     }
00115     
00116     inline u_int16_t amqpMethodId() const
00117     {
00118         return 20;
00119     }
00120 
00121     inline u_int32_t bodySize() const
00122     {
00123                 u_int32_t size = 0;        
00124         size += 2; /* ticket: short */
00125         size += 1 + queue.length(); /* queue: shortstr */
00126         size += 1 + consumerTag.length(); /* consumerTag: shortstr */
00127         size += 1; /* Combinded bits: [noLocal, noAck, exclusive, nowait] */
00128         return size;
00129     }
00130 
00131     inline void encodeContent(Buffer& buffer) const
00132     {
00133         buffer.putShort(ticket); /* ticket: short */
00134         buffer.putShortString(queue); /* queue: shortstr */
00135         buffer.putShortString(consumerTag); /* consumerTag: shortstr */
00136         u_int8_t flags_6[1] = {0};
00137         flags_6[0] |= noLocal << 0; /* noLocal: bit */
00138         flags_6[0] |= noAck << 1; /* noAck: bit */
00139         flags_6[0] |= exclusive << 2; /* exclusive: bit */
00140         flags_6[0] |= nowait << 3; /* nowait: bit */
00141         buffer.putOctet(flags_6[0]);
00142     }
00143 
00144     inline void decodeContent(Buffer& buffer)
00145     {
00146         ticket = buffer.getShort(); /* ticket: short */
00147         buffer.getShortString(queue); /* queue: shortstr */
00148         buffer.getShortString(consumerTag); /* consumerTag: shortstr */
00149         u_int8_t flags_6[1];
00150         flags_6[0] = buffer.getOctet();
00151         noLocal = (1 << 0) & flags_6[0]; /* noLocal: bit */
00152         noAck = (1 << 1) & flags_6[0]; /* noAck: bit */
00153         exclusive = (1 << 2) & flags_6[0]; /* exclusive: bit */
00154         nowait = (1 << 3) & flags_6[0]; /* nowait: bit */
00155     }       
00156 
00157     inline void invoke(AMQP_ServerOperations& target, u_int16_t channel)
00158     {
00159         target.getFileHandler()->consume(channel,
00160                     ticket,
00161                     queue,
00162                     consumerTag,
00163                     noLocal,
00164                     noAck,
00165                     exclusive,
00166                     nowait
00167                     );
00168     }
00169 
00170 
00171 }; // class FileConsumeBody
00172 
00173 
00174 } // namespace framing
00175 } // namespace qpid
00176 
00177 #endif
00178 

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