qpid/client/FlowControl.h Source File

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

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

qpid/client/FlowControl.h
Go to the documentation of this file.

    00001 #ifndef QPID_CLIENT_FLOWCONTROL_H
    00002 #define QPID_CLIENT_FLOWCONTROL_H
    00003
    00004 /*
    00005  *
    00006  * Licensed to the Apache Software Foundation (ASF) under one
    00007  * or more contributor license agreements.  See the NOTICE file
    00008  * distributed with this work for additional information
    00009  * regarding copyright ownership.  The ASF licenses this file
    00010  * to you under the Apache License, Version 2.0 (the
    00011  * "License"); you may not use this file except in compliance
    00012  * with the License.  You may obtain a copy of the License at
    00013  *
    00014  *   http://www.apache.org/licenses/LICENSE-2.0
    00015  *
    00016  * Unless required by applicable law or agreed to in writing,
    00017  * software distributed under the License is distributed on an
    00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    00019  * KIND, either express or implied.  See the License for the
    00020  * specific language governing permissions and limitations
    00021  * under the License.
    00022  *
    00023  */
    00024
    00025 #include <qpid/sys/IntegerTypes.h>
    00026
    00027 namespace qpid {
    00028 namespace client {
    00029
    00049 struct FlowControl {
    00050     static const uint32_t UNLIMITED=0xFFFFFFFF;
    00051     FlowControl(uint32_t messages_=0, uint32_t bytes_=0, bool window_=false)
    00052         : messages(messages_), bytes(bytes_), window(window_) {}
    00053
    00054     static FlowControl messageCredit(uint32_t messages_) { return FlowControl(messages_,UNLIMITED,false); }
    00055     static FlowControl messageWindow(uint32_t messages_) { return FlowControl(messages_,UNLIMITED,true); }
    00056     static FlowControl byteCredit(uint32_t bytes_) { return FlowControl(UNLIMITED,bytes_,false); }
    00057     static FlowControl byteWindow(uint32_t bytes_) { return FlowControl(UNLIMITED,bytes_,true); }
    00058     static FlowControl unlimited() { return FlowControl(UNLIMITED, UNLIMITED, false); }
    00059     static FlowControl zero() { return FlowControl(0, 0, false); }
    00060
    00062     uint32_t messages;
    00064     uint32_t bytes;
    00066     bool window;
    00067
    00068     bool operator==(const FlowControl& x) {
    00069         return messages == x.messages && bytes == x.bytes && window == x.window;
    00070     };
    00071 };
    00072
    00073 }} // namespace qpid::client
    00074
    00075 #endif