/home/aconway/svn/qpid/cpp/gen/qpid/framing/FilePublishBody.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_FilePublishBody__
00029 #define qpid_framing_FilePublishBody__
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 FilePublishBody : public AMQRequestBody
00047 {
00048 
00049         // Method field declarations
00050 
00051     u_int16_t ticket;
00052     string exchange;
00053     string routingKey;
00054     bool mandatory;
00055     bool immediate;
00056     string identifier;
00057      
00058 
00059 public:
00060     static const ClassId CLASS_ID= 70;
00061     static const MethodId METHOD_ID = 60;
00062 
00063     typedef boost::shared_ptr<FilePublishBody> shared_ptr;
00064 
00065         // Constructors and destructors
00066 
00067     FilePublishBody(ProtocolVersion version,
00068         u_int16_t ticket,
00069         const string& exchange,
00070         const string& routingKey,
00071         bool mandatory,
00072         bool immediate,
00073         const string& identifier
00074         ) : AMQRequestBody(version), 
00075         ticket(ticket),
00076         exchange(exchange),
00077         routingKey(routingKey),
00078         mandatory(mandatory),
00079         immediate(immediate),
00080         identifier(identifier)
00081     { }
00082 
00083 
00084     FilePublishBody(ProtocolVersion version): AMQRequestBody(version) {}
00085     virtual ~FilePublishBody() {}
00086     
00087     // Attribute get methods
00088 
00089     u_int16_t getTicket() { return ticket; }
00090     const string& getExchange() { return exchange; }
00091     const string& getRoutingKey() { return routingKey; }
00092     bool getMandatory() { return mandatory; }
00093     bool getImmediate() { return immediate; }
00094     const string& getIdentifier() { return identifier; }
00095 
00096     // Helper methods
00097     
00098     inline void print(std::ostream& out) const
00099     {
00100             printPrefix(out);
00101             out << "FilePublish: ";
00102         out << "ticket=" << ticket;
00103         out << "; exchange=" << exchange;
00104         out << "; routingKey=" << routingKey;
00105         out << "; mandatory=" << mandatory;
00106         out << "; immediate=" << immediate;
00107         out << "; identifier=" << identifier;
00108     }
00109 
00110     inline ClassId amqpClassId() const { return CLASS_ID; }
00111     inline MethodId amqpMethodId() const { return METHOD_ID; }
00112 
00113     u_int32_t size() const
00114     {
00115         u_int32_t sz = baseSize();
00116         sz += 2; /* ticket: short */
00117         sz += 1 + exchange.length(); /* exchange: shortstr */
00118         sz += 1 + routingKey.length(); /* routingKey: shortstr */
00119         sz += 1; /* Combinded bits: [mandatory, immediate] */
00120         sz += 1 + identifier.length(); /* identifier: shortstr */
00121         return sz;
00122     }
00123 
00124     void encodeContent(Buffer&  buffer) const
00125     {
00126         buffer.putShort(ticket); /* ticket: short */
00127         buffer.putShortString(exchange); /* exchange: shortstr */
00128         buffer.putShortString(routingKey); /* routingKey: shortstr */
00129         u_int8_t flags_5[1] = {0};
00130         flags_5[0] |= mandatory << 0; /* mandatory: bit */
00131         flags_5[0] |= immediate << 1; /* immediate: bit */
00132         buffer.putOctet(flags_5[0]);
00133         buffer.putShortString(identifier); /* identifier: shortstr */
00134     }
00135 
00136     inline void decodeContent(Buffer&  buffer)
00137     {
00138         ticket = buffer.getShort(); /* ticket: short */
00139         buffer.getShortString(exchange); /* exchange: shortstr */
00140         buffer.getShortString(routingKey); /* routingKey: shortstr */
00141         u_int8_t flags_5[1];
00142         flags_5[0] = buffer.getOctet();
00143         mandatory = (1 << 0) & flags_5[0]; /* mandatory: bit */
00144         immediate = (1 << 1) & flags_5[0]; /* immediate: bit */
00145         buffer.getShortString(identifier); /* identifier: shortstr */
00146     }       
00147 
00148     void invoke(AMQP_ServerOperations& target, const MethodContext& context)
00149     {
00150         target.getFileHandler()->publish(context,
00151                     ticket,
00152                     exchange,
00153                     routingKey,
00154                     mandatory,
00155                     immediate,
00156                     identifier
00157                     );
00158     }
00159 
00160 
00161 }; // class FilePublishBody
00162 
00163 
00164 } // namespace framing
00165 } // namespace qpid
00166 
00167 #endif
00168 

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