Apache Qpid C++ API
Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation

qpid/framing/SequenceNumber.h

Go to the documentation of this file.
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 #ifndef _framing_SequenceNumber_h
00022 #define _framing_SequenceNumber_h
00023 
00024 #include "amqp_types.h"
00025 #include <iosfwd>
00026 
00027 namespace qpid {
00028 namespace framing {
00029 
00030 class Buffer;
00031 
00035 class SequenceNumber
00036 {
00037     int32_t value;
00038 
00039  public:
00040     SequenceNumber();
00041     SequenceNumber(uint32_t v);
00042 
00043     SequenceNumber& operator++();//prefix ++
00044     const SequenceNumber operator++(int);//postfix ++
00045     SequenceNumber& operator--();//prefix ++
00046     bool operator==(const SequenceNumber& other) const;
00047     bool operator!=(const SequenceNumber& other) const;
00048     bool operator<(const SequenceNumber& other) const;
00049     bool operator>(const SequenceNumber& other) const;
00050     bool operator<=(const SequenceNumber& other) const;
00051     bool operator>=(const SequenceNumber& other) const;
00052     uint32_t getValue() const { return (uint32_t) value; }
00053     operator uint32_t() const { return (uint32_t) value; }
00054 
00055     friend int32_t operator-(const SequenceNumber& a, const SequenceNumber& b);
00056 
00057     void encode(Buffer& buffer) const;
00058     void decode(Buffer& buffer);
00059     uint32_t encodedSize() const;   
00060 
00061     template <class S> void serialize(S& s) { s(value); }
00062 };    
00063 
00064 struct Window 
00065 {
00066     SequenceNumber hwm;
00067     SequenceNumber lwm;
00068 };
00069 
00070 std::ostream& operator<<(std::ostream& o, const SequenceNumber& n);
00071 
00072 }} // namespace qpid::framing
00073 
00074 
00075 #endif

Qpid C++ API Reference
Generated on Tue Dec 8 15:39:48 2009 for Qpid C++ Client API by doxygen 1.4.7