/opt/workspace/qpid/tags/M2/Final/cpp/lib/common/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     enum delivery_mode {TRANSIENT = 1, PERSISTENT = 2};
00032 
00033     //TODO: This could be easily generated from the spec
00034     class BasicHeaderProperties : public HeaderProperties
00035     {
00036         string contentType;
00037         string contentEncoding;
00038         FieldTable headers;
00039         u_int8_t deliveryMode;
00040         u_int8_t priority;
00041         string correlationId;
00042         string replyTo;
00043         string expiration;
00044         string messageId;
00045         u_int64_t timestamp;
00046         string type;
00047         string userId;
00048         string appId;
00049         string clusterId;
00050         
00051         u_int16_t getFlags() const;
00052 
00053     public:
00054         BasicHeaderProperties();
00055         virtual ~BasicHeaderProperties();
00056         virtual u_int32_t size() const;
00057         virtual void encode(Buffer& buffer) const;
00058         virtual void decode(Buffer& buffer, u_int32_t size);
00059 
00060         inline virtual u_int8_t classId() { return BASIC; }
00061 
00062         inline const string& getContentType() const { return contentType; }
00063         inline const string& getContentEncoding() const { return contentEncoding; }
00064         inline FieldTable& getHeaders() { return headers; }
00065         inline u_int8_t getDeliveryMode() const { return deliveryMode; }
00066         inline u_int8_t getPriority() const { return priority; }
00067         inline const string& getCorrelationId() const {return correlationId; }
00068         inline const string& getReplyTo() const { return replyTo; }
00069         inline const string& getExpiration() const { return expiration; }
00070         inline const string& getMessageId() const {return messageId; }
00071         inline u_int64_t getTimestamp() const { return timestamp; }
00072         inline const string& getType() const { return type; }
00073         inline const string& getUserId() const { return userId; }
00074         inline const string& getAppId() const { return appId; }
00075         inline const string& getClusterId() const { return clusterId; }
00076 
00077         void inline setContentType(const string& _type){ contentType = _type; }
00078         void inline setContentEncoding(const string& encoding){ contentEncoding = encoding; }
00079         void inline setHeaders(const FieldTable& _headers){ headers = _headers; }
00080         void inline setDeliveryMode(u_int8_t mode){ deliveryMode = mode; }
00081         void inline setPriority(u_int8_t _priority){ priority = _priority; }
00082         void inline setCorrelationId(const string& _correlationId){ correlationId = _correlationId; }
00083         void inline setReplyTo(const string& _replyTo){ replyTo = _replyTo;}
00084         void inline setExpiration(const string&  _expiration){ expiration = _expiration; }
00085         void inline setMessageId(const string& _messageId){ messageId = _messageId; }
00086         void inline setTimestamp(u_int64_t _timestamp){ timestamp = _timestamp; }
00087         void inline setType(const string& _type){ type = _type; }
00088         void inline setUserId(const string& _userId){ userId = _userId; }
00089         void inline setAppId(const string& _appId){appId = _appId; }
00090         void inline setClusterId(const string& _clusterId){ clusterId = _clusterId; }
00091     };
00092 
00093 }
00094 }
00095 
00096 
00097 #endif

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