Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
SequenceSet.h
Go to the documentation of this file.
1 /*
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements. See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership. The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License. You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied. See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 #ifndef _framing_SequenceSet_h
22 #define _framing_SequenceSet_h
23 
25 #include "qpid/RangeSet.h"
27 
28 namespace qpid {
29 namespace framing {
30 class Buffer;
31 
32 class QPID_COMMON_CLASS_EXTERN SequenceSet : public RangeSet<SequenceNumber> {
33  public:
36  : RangeSet<SequenceNumber>(r) {}
37  SequenceSet(const SequenceNumber& s) { add(s); }
38  SequenceSet(const SequenceNumber& start, const SequenceNumber finish) { add(start,finish); }
39 
40 
41  QPID_COMMON_EXTERN void encode(Buffer& buffer) const;
42  QPID_COMMON_EXTERN void decode(Buffer& buffer);
43  QPID_COMMON_EXTERN uint32_t encodedSize() const;
44 
45  QPID_COMMON_EXTERN bool contains(const SequenceNumber& s) const;
46  QPID_COMMON_EXTERN void add(const SequenceNumber& s);
47  QPID_COMMON_EXTERN void add(const SequenceNumber& start, const SequenceNumber& finish); // Closed range
48  QPID_COMMON_EXTERN void add(const SequenceSet& set);
49  QPID_COMMON_EXTERN void remove(const SequenceNumber& s);
50  QPID_COMMON_EXTERN void remove(const SequenceNumber& start, const SequenceNumber& finish); // Closed range
51  QPID_COMMON_EXTERN void remove(const SequenceSet& set);
52 
53  template <class T> void for_each(T& t) const {
54  for (RangeIterator i = rangesBegin(); i != rangesEnd(); i++)
55  t(i->first(), i->last());
56  }
57 
58  template <class T> void for_each(const T& t) const {
59  for (RangeIterator i = rangesBegin(); i != rangesEnd(); i++)
60  t(i->first(), i->last());
61  }
62 
63  friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream&, const SequenceSet&);
64 };
65 
66 }} // namespace qpid::framing
67 
68 
69 #endif

Qpid C++ API Reference
Generated on Tue Jul 2 2013 for Qpid C++ Client API by doxygen 1.8.3.1