Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
StreamProperties.h
Go to the documentation of this file.
1 #ifndef QPID_FRAMING_STREAMPROPERTIES_H
2 #define QPID_FRAMING_STREAMPROPERTIES_H
3 /*
4  *
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements. See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership. The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the
10  * "License"); you may not use this file except in compliance
11  * with the License. You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing,
16  * software distributed under the License is distributed on an
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  * KIND, either express or implied. See the License for the
19  * specific language governing permissions and limitations
20  * under the License.
21  *
22  */
23 
28 
29 
30 
31 #include <ostream>
32 #include "qpid/framing/amqp_types_full.h"
34 #include "qpid/CommonImportExport.h"
35 
36 namespace qpid {
37 namespace framing {
38 
39 class QPID_COMMON_CLASS_EXTERN StreamProperties {
40  std::string contentType;
41  std::string contentEncoding;
42  FieldTable headers;
43  uint8_t priority;
44  uint64_t timestamp;
45  uint16_t flags;
46 public:
47  static const uint16_t TYPE = 2561;
49  const std::string& _contentType,
50  const std::string& _contentEncoding,
51  const FieldTable& _headers,
52  uint8_t _priority,
53  uint64_t _timestamp) :
54  contentType(_contentType),
55  contentEncoding(_contentEncoding),
56  headers(_headers),
57  priority(_priority),
58  timestamp(_timestamp),
59  flags(0){
60  flags |= (1 << 8);
61  flags |= (1 << 9);
62  flags |= (1 << 10);
63  flags |= (1 << 11);
64  flags |= (1 << 12);
65  if (contentType.size() >= 256) throw IllegalArgumentException("Value for contentType is too large");
66  if (contentEncoding.size() >= 256) throw IllegalArgumentException("Value for contentEncoding is too large");
67  }
68  StreamProperties() : priority(0), timestamp(0), flags(0) {}
69 
70  QPID_COMMON_EXTERN void setContentType(const std::string& _contentType);
71  QPID_COMMON_EXTERN const std::string& getContentType() const;
72  QPID_COMMON_EXTERN bool hasContentType() const;
73  QPID_COMMON_EXTERN void clearContentTypeFlag();
74  QPID_COMMON_EXTERN void setContentEncoding(const std::string& _contentEncoding);
75  QPID_COMMON_EXTERN const std::string& getContentEncoding() const;
76  QPID_COMMON_EXTERN bool hasContentEncoding() const;
77  QPID_COMMON_EXTERN void clearContentEncodingFlag();
78  QPID_COMMON_EXTERN void setHeaders(const FieldTable& _headers);
79  QPID_COMMON_EXTERN const FieldTable& getHeaders() const;
80  QPID_COMMON_EXTERN FieldTable& getHeaders();
81  QPID_COMMON_EXTERN bool hasHeaders() const;
82  QPID_COMMON_EXTERN void clearHeadersFlag();
83  QPID_COMMON_EXTERN void setPriority(uint8_t _priority);
84  QPID_COMMON_EXTERN uint8_t getPriority() const;
85  QPID_COMMON_EXTERN bool hasPriority() const;
86  QPID_COMMON_EXTERN void clearPriorityFlag();
87  QPID_COMMON_EXTERN void setTimestamp(uint64_t _timestamp);
88  QPID_COMMON_EXTERN uint64_t getTimestamp() const;
89  QPID_COMMON_EXTERN bool hasTimestamp() const;
90  QPID_COMMON_EXTERN void clearTimestampFlag();
91  QPID_COMMON_EXTERN friend std::ostream& operator<<(std::ostream&, const StreamProperties&);
92  QPID_COMMON_EXTERN void encode(Buffer&) const;
93  QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0);
94  QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const;
95  QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0);
96  QPID_COMMON_EXTERN uint32_t encodedSize() const;
97  QPID_COMMON_EXTERN uint32_t bodySize() const;
98  QPID_COMMON_EXTERN void print(std::ostream& out) const;
99 }; /* class StreamProperties */
100 
101 }}
102 #endif
unsigned char uint8_t
Definition: IntegerTypes.h:24
StreamProperties(const std::string &_contentType, const std::string &_contentEncoding, const FieldTable &_headers, uint8_t _priority, uint64_t _timestamp)
std::ostream & operator<<(std::ostream &, TypeCode)
void decode(const Message &message, qpid::types::Variant::Map &map, const std::string &encoding=std::string())
Decodes message content into a Variant::Map.
unsigned int uint32_t
Definition: IntegerTypes.h:27
unsigned short uint16_t
Definition: IntegerTypes.h:25
void encode(const qpid::types::Variant::Map &map, Message &message, const std::string &encoding=std::string())
Encodes a Variant::Map into a message.

Qpid C++ API Reference
Generated on Tue Oct 28 2014 for Qpid C++ Client API by doxygen 1.8.5