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

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