/home/aconway/svn/qpid/cpp/src/qpid/framing/BasicHeaderProperties.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 #include "amqp_types.h"
00022 #include "Buffer.h"
00023 #include "FieldTable.h"
00024 #include "HeaderProperties.h"
00025 
00026 #ifndef _BasicHeaderProperties_
00027 #define _BasicHeaderProperties_
00028 
00029 namespace qpid {
00030 namespace framing {
00031 
00032 enum DeliveryMode { TRANSIENT = 1, PERSISTENT = 2};
00033 
00034 class BasicHeaderProperties : public HeaderProperties
00035 {
00036     string contentType;
00037     string contentEncoding;
00038     FieldTable headers;
00039     DeliveryMode deliveryMode;
00040     uint8_t priority;
00041     string correlationId;
00042     string replyTo;
00043     string expiration;
00044     string messageId;
00045     uint64_t timestamp;
00046     string type;
00047     string userId;
00048     string appId;
00049     string clusterId;
00050         
00051     uint16_t getFlags() const;
00052 
00053   public:
00054     BasicHeaderProperties();
00055     virtual ~BasicHeaderProperties();
00056     virtual uint32_t size() const;
00057     virtual void encode(Buffer& buffer) const;
00058     virtual void decode(Buffer& buffer, uint32_t size);
00059 
00060     virtual uint8_t classId() { return BASIC; }
00061 
00062     string getContentType() const { return contentType; }
00063     string getContentEncoding() const { return contentEncoding; }
00064     FieldTable& getHeaders() { return headers; }
00065     const FieldTable& getHeaders() const { return headers; }
00066     DeliveryMode getDeliveryMode() const { return deliveryMode; }
00067     uint8_t getPriority() const { return priority; }
00068     string getCorrelationId() const {return correlationId; }
00069     string getReplyTo() const { return replyTo; }
00070     string getExpiration() const { return expiration; }
00071     string getMessageId() const {return messageId; }
00072     uint64_t getTimestamp() const { return timestamp; }
00073     string getType() const { return type; }
00074     string getUserId() const { return userId; }
00075     string getAppId() const { return appId; }
00076     string getClusterId() const { return clusterId; }
00077 
00078     void setContentType(const string& _type){ contentType = _type; }
00079     void setContentEncoding(const string& encoding){ contentEncoding = encoding; }
00080     void setHeaders(const FieldTable& _headers){ headers = _headers; }
00081     void setDeliveryMode(DeliveryMode mode){ deliveryMode = mode; }
00082     void setPriority(uint8_t _priority){ priority = _priority; }
00083     void setCorrelationId(const string& _correlationId){ correlationId = _correlationId; }
00084     void setReplyTo(const string& _replyTo){ replyTo = _replyTo;}
00085     void setExpiration(const string&  _expiration){ expiration = _expiration; }
00086     void setMessageId(const string& _messageId){ messageId = _messageId; }
00087     void setTimestamp(uint64_t _timestamp){ timestamp = _timestamp; }
00088     void setType(const string& _type){ type = _type; }
00089     void setUserId(const string& _userId){ userId = _userId; }
00090     void setAppId(const string& _appId){appId = _appId; }
00091     void setClusterId(const string& _clusterId){ clusterId = _clusterId; }
00092 
00096     template <class T, class U>
00097     static void copy(T& to, const U& from) {
00098         to.setContentType(from.getContentType());
00099         to.setContentEncoding(from.getContentEncoding());
00100         to.setHeaders(from.getHeaders());
00101         to.setDeliveryMode(from.getDeliveryMode());
00102         to.setPriority(from.getPriority());
00103         to.setCorrelationId(from.getCorrelationId());
00104         to.setReplyTo(from.getReplyTo());
00105         to.setExpiration(from.getExpiration());
00106         to.setMessageId(from.getMessageId());
00107         to.setTimestamp(from.getTimestamp());
00108         to.setType(from.getType());
00109         to.setUserId(from.getUserId());
00110         to.setAppId(from.getAppId());
00111         to.setClusterId(from.getClusterId());
00112     }
00113 };
00114 }}
00115 #endif

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