/usr/share/cruisecontrol-bin-2.6.1/projects/qpid-trunk/cpp/src/qpid/framing/SequenceNumber.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 #ifndef _framing_SequenceNumber_h
00022 #define _framing_SequenceNumber_h
00023 
00024 #include "amqp_types.h"
00025 
00026 namespace qpid {
00027 namespace framing {
00028 
00032 class SequenceNumber
00033 {
00034     int32_t value;
00035 
00036  public:
00037     SequenceNumber();
00038     SequenceNumber(uint32_t v);
00039 
00040     SequenceNumber& operator++();//prefix ++
00041     const SequenceNumber operator++(int);//postfix ++
00042     SequenceNumber& operator--();//prefix ++
00043     bool operator==(const SequenceNumber& other) const;
00044     bool operator!=(const SequenceNumber& other) const;
00045     bool operator<(const SequenceNumber& other) const;
00046     bool operator>(const SequenceNumber& other) const;
00047     bool operator<=(const SequenceNumber& other) const;
00048     bool operator>=(const SequenceNumber& other) const;
00049     uint32_t getValue() const { return (uint32_t) value; }
00050     operator uint32_t() const { return (uint32_t) value; }
00051 
00052     friend int32_t operator-(const SequenceNumber& a, const SequenceNumber& b);
00053 
00054     template <class S> void serialize(S& s) { s(value); }
00055 };    
00056 
00057 struct Window 
00058 {
00059     SequenceNumber hwm;
00060     SequenceNumber lwm;
00061 };
00062 
00063 }} // namespace qpid::framing
00064 
00065 
00066 #endif

Generated on Thu Apr 10 11:08:18 2008 for Qpid by  doxygen 1.4.7