Go to the documentation of this file.00001 #ifndef QPID_CLIENT_FLOWCONTROL_H
00002 #define QPID_CLIENT_FLOWCONTROL_H
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
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 }} 
00074 
00075 #endif