/home/aconway/svn/qpid/cpp/gen/qpid/framing/MessageTransferBody.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_MessageTransferBody__
00029 #define qpid_framing_MessageTransferBody__
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 MessageTransferBody : public AMQRequestBody
00047 {
00048 
00049         // Method field declarations
00050 
00051     u_int16_t ticket;
00052     string destination;
00053     bool redelivered;
00054     bool immediate;
00055     u_int64_t ttl;
00056     u_int8_t priority;
00057     u_int64_t timestamp;
00058     u_int8_t deliveryMode;
00059     u_int64_t expiration;
00060     string exchange;
00061     string routingKey;
00062     string messageId;
00063     string correlationId;
00064     string replyTo;
00065     string contentType;
00066     string contentEncoding;
00067     string userId;
00068     string appId;
00069     string transactionId;
00070     string securityToken;
00071     FieldTable applicationHeaders;
00072     Content body;
00073     bool mandatory;
00074      
00075 
00076 public:
00077     static const ClassId CLASS_ID= 120;
00078     static const MethodId METHOD_ID = 10;
00079 
00080     typedef boost::shared_ptr<MessageTransferBody> shared_ptr;
00081 
00082         // Constructors and destructors
00083 
00084     MessageTransferBody(ProtocolVersion version,
00085         u_int16_t ticket,
00086         const string& destination,
00087         bool redelivered,
00088         bool immediate,
00089         u_int64_t ttl,
00090         u_int8_t priority,
00091         u_int64_t timestamp,
00092         u_int8_t deliveryMode,
00093         u_int64_t expiration,
00094         const string& exchange,
00095         const string& routingKey,
00096         const string& messageId,
00097         const string& correlationId,
00098         const string& replyTo,
00099         const string& contentType,
00100         const string& contentEncoding,
00101         const string& userId,
00102         const string& appId,
00103         const string& transactionId,
00104         const string& securityToken,
00105         const FieldTable& applicationHeaders,
00106         const Content& body,
00107         bool mandatory
00108         ) : AMQRequestBody(version), 
00109         ticket(ticket),
00110         destination(destination),
00111         redelivered(redelivered),
00112         immediate(immediate),
00113         ttl(ttl),
00114         priority(priority),
00115         timestamp(timestamp),
00116         deliveryMode(deliveryMode),
00117         expiration(expiration),
00118         exchange(exchange),
00119         routingKey(routingKey),
00120         messageId(messageId),
00121         correlationId(correlationId),
00122         replyTo(replyTo),
00123         contentType(contentType),
00124         contentEncoding(contentEncoding),
00125         userId(userId),
00126         appId(appId),
00127         transactionId(transactionId),
00128         securityToken(securityToken),
00129         applicationHeaders(applicationHeaders),
00130         body(body),
00131         mandatory(mandatory)
00132     { }
00133 
00134 
00135     MessageTransferBody(ProtocolVersion version): AMQRequestBody(version) {}
00136     virtual ~MessageTransferBody() {}
00137     
00138     // Attribute get methods
00139 
00140     u_int16_t getTicket() { return ticket; }
00141     const string& getDestination() { return destination; }
00142     bool getRedelivered() { return redelivered; }
00143     bool getImmediate() { return immediate; }
00144     u_int64_t getTtl() { return ttl; }
00145     u_int8_t getPriority() { return priority; }
00146     u_int64_t getTimestamp() { return timestamp; }
00147     u_int8_t getDeliveryMode() { return deliveryMode; }
00148     u_int64_t getExpiration() { return expiration; }
00149     const string& getExchange() { return exchange; }
00150     const string& getRoutingKey() { return routingKey; }
00151     const string& getMessageId() { return messageId; }
00152     const string& getCorrelationId() { return correlationId; }
00153     const string& getReplyTo() { return replyTo; }
00154     const string& getContentType() { return contentType; }
00155     const string& getContentEncoding() { return contentEncoding; }
00156     const string& getUserId() { return userId; }
00157     const string& getAppId() { return appId; }
00158     const string& getTransactionId() { return transactionId; }
00159     const string& getSecurityToken() { return securityToken; }
00160     const FieldTable& getApplicationHeaders() { return applicationHeaders; }
00161     const Content& getBody() { return body; }
00162     bool getMandatory() { return mandatory; }
00163 
00164     // Helper methods
00165     
00166     inline void print(std::ostream& out) const
00167     {
00168             printPrefix(out);
00169             out << "MessageTransfer: ";
00170         out << "ticket=" << ticket;
00171         out << "; destination=" << destination;
00172         out << "; redelivered=" << redelivered;
00173         out << "; immediate=" << immediate;
00174         out << "; ttl=" << ttl;
00175         out << "; priority=" << (int)priority;
00176         out << "; timestamp=" << timestamp;
00177         out << "; deliveryMode=" << (int)deliveryMode;
00178         out << "; expiration=" << expiration;
00179         out << "; exchange=" << exchange;
00180         out << "; routingKey=" << routingKey;
00181         out << "; messageId=" << messageId;
00182         out << "; correlationId=" << correlationId;
00183         out << "; replyTo=" << replyTo;
00184         out << "; contentType=" << contentType;
00185         out << "; contentEncoding=" << contentEncoding;
00186         out << "; userId=" << userId;
00187         out << "; appId=" << appId;
00188         out << "; transactionId=" << transactionId;
00189         out << "; securityToken=" << securityToken;
00190         out << "; applicationHeaders=" << applicationHeaders;
00191         out << "; body=" << body;
00192         out << "; mandatory=" << mandatory;
00193     }
00194 
00195     inline ClassId amqpClassId() const { return CLASS_ID; }
00196     inline MethodId amqpMethodId() const { return METHOD_ID; }
00197 
00198     u_int32_t size() const
00199     {
00200         u_int32_t sz = baseSize();
00201         sz += 2; /* ticket: short */
00202         sz += 1 + destination.length(); /* destination: shortstr */
00203         sz += 1; /* Combinded bits: [redelivered, immediate] */
00204         sz += 8; /* ttl: longlong */
00205         sz += 1; /* priority: octet */
00206         sz += 8; /* timestamp: timestamp */
00207         sz += 1; /* deliveryMode: octet */
00208         sz += 8; /* expiration: timestamp */
00209         sz += 1 + exchange.length(); /* exchange: shortstr */
00210         sz += 1 + routingKey.length(); /* routingKey: shortstr */
00211         sz += 1 + messageId.length(); /* messageId: shortstr */
00212         sz += 1 + correlationId.length(); /* correlationId: shortstr */
00213         sz += 1 + replyTo.length(); /* replyTo: shortstr */
00214         sz += 1 + contentType.length(); /* contentType: shortstr */
00215         sz += 1 + contentEncoding.length(); /* contentEncoding: shortstr */
00216         sz += 1 + userId.length(); /* userId: shortstr */
00217         sz += 1 + appId.length(); /* appId: shortstr */
00218         sz += 1 + transactionId.length(); /* transactionId: shortstr */
00219         sz += 4 + securityToken.length(); /* securityToken: longstr */
00220         sz += applicationHeaders.size(); /* applicationHeaders: table */
00221         sz += body.size(); /* body: content */
00222         sz += 1; /* mandatory: bit */
00223         return sz;
00224     }
00225 
00226     void encodeContent(Buffer&  buffer) const
00227     {
00228         buffer.putShort(ticket); /* ticket: short */
00229         buffer.putShortString(destination); /* destination: shortstr */
00230         u_int8_t flags_4[1] = {0};
00231         flags_4[0] |= redelivered << 0; /* redelivered: bit */
00232         flags_4[0] |= immediate << 1; /* immediate: bit */
00233         buffer.putOctet(flags_4[0]);
00234         buffer.putLongLong(ttl); /* ttl: longlong */
00235         buffer.putOctet(priority); /* priority: octet */
00236         buffer.putLongLong(timestamp); /* timestamp: timestamp */
00237         buffer.putOctet(deliveryMode); /* deliveryMode: octet */
00238         buffer.putLongLong(expiration); /* expiration: timestamp */
00239         buffer.putShortString(exchange); /* exchange: shortstr */
00240         buffer.putShortString(routingKey); /* routingKey: shortstr */
00241         buffer.putShortString(messageId); /* messageId: shortstr */
00242         buffer.putShortString(correlationId); /* correlationId: shortstr */
00243         buffer.putShortString(replyTo); /* replyTo: shortstr */
00244         buffer.putShortString(contentType); /* contentType: shortstr */
00245         buffer.putShortString(contentEncoding); /* contentEncoding: shortstr */
00246         buffer.putShortString(userId); /* userId: shortstr */
00247         buffer.putShortString(appId); /* appId: shortstr */
00248         buffer.putShortString(transactionId); /* transactionId: shortstr */
00249         buffer.putLongString(securityToken); /* securityToken: longstr */
00250         buffer.putFieldTable(applicationHeaders); /* applicationHeaders: table */
00251         buffer.putContent(body); /* body: content */
00252         u_int8_t flags_22[1] = {0};
00253         flags_22[0] |= mandatory << 0; /* mandatory: bit */
00254         buffer.putOctet(flags_22[0]);
00255     }
00256 
00257     inline void decodeContent(Buffer&  buffer)
00258     {
00259         ticket = buffer.getShort(); /* ticket: short */
00260         buffer.getShortString(destination); /* destination: shortstr */
00261         u_int8_t flags_4[1];
00262         flags_4[0] = buffer.getOctet();
00263         redelivered = (1 << 0) & flags_4[0]; /* redelivered: bit */
00264         immediate = (1 << 1) & flags_4[0]; /* immediate: bit */
00265         ttl = buffer.getLongLong(); /* ttl: longlong */
00266         priority = buffer.getOctet(); /* priority: octet */
00267         timestamp = buffer.getLongLong(); /* timestamp: timestamp */
00268         deliveryMode = buffer.getOctet(); /* deliveryMode: octet */
00269         expiration = buffer.getLongLong(); /* expiration: timestamp */
00270         buffer.getShortString(exchange); /* exchange: shortstr */
00271         buffer.getShortString(routingKey); /* routingKey: shortstr */
00272         buffer.getShortString(messageId); /* messageId: shortstr */
00273         buffer.getShortString(correlationId); /* correlationId: shortstr */
00274         buffer.getShortString(replyTo); /* replyTo: shortstr */
00275         buffer.getShortString(contentType); /* contentType: shortstr */
00276         buffer.getShortString(contentEncoding); /* contentEncoding: shortstr */
00277         buffer.getShortString(userId); /* userId: shortstr */
00278         buffer.getShortString(appId); /* appId: shortstr */
00279         buffer.getShortString(transactionId); /* transactionId: shortstr */
00280         buffer.getLongString(securityToken); /* securityToken: longstr */
00281         buffer.getFieldTable(applicationHeaders); /* applicationHeaders: table */
00282         buffer.getContent(body); /* body: content */
00283         u_int8_t flags_22[1];
00284         flags_22[0] = buffer.getOctet();
00285         mandatory = (1 << 0) & flags_22[0]; /* mandatory: bit */
00286     }       
00287 
00288     void invoke(AMQP_ServerOperations& target, const MethodContext& context)
00289     {
00290         target.getMessageHandler()->transfer(context,
00291                     ticket,
00292                     destination,
00293                     redelivered,
00294                     immediate,
00295                     ttl,
00296                     priority,
00297                     timestamp,
00298                     deliveryMode,
00299                     expiration,
00300                     exchange,
00301                     routingKey,
00302                     messageId,
00303                     correlationId,
00304                     replyTo,
00305                     contentType,
00306                     contentEncoding,
00307                     userId,
00308                     appId,
00309                     transactionId,
00310                     securityToken,
00311                     applicationHeaders,
00312                     body,
00313                     mandatory
00314                     );
00315     }
00316 
00317 
00318 }; // class MessageTransferBody
00319 
00320 
00321 } // namespace framing
00322 } // namespace qpid
00323 
00324 #endif
00325 

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