00001
00002 #ifndef _MANAGEMENT_EXCHANGE_
00003 #define _MANAGEMENT_EXCHANGE_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "qpid/management/ManagementObject.h"
00028 #include "qpid/framing/FieldTable.h"
00029 #include "qpid/framing/Uuid.h"
00030
00031 namespace qpid {
00032 namespace management {
00033
00034 class Exchange : public ManagementObject
00035 {
00036 private:
00037
00038 static std::string packageName;
00039 static std::string className;
00040 static uint8_t md5Sum[16];
00041
00042
00043 uint64_t vhostRef;
00044 std::string name;
00045 std::string type;
00046 uint8_t durable;
00047
00048
00049 uint32_t producers;
00050 uint32_t producersHigh;
00051 uint32_t producersLow;
00052 uint32_t bindings;
00053 uint32_t bindingsHigh;
00054 uint32_t bindingsLow;
00055 uint64_t msgReceives;
00056 uint64_t msgDrops;
00057 uint64_t msgRoutes;
00058 uint64_t byteReceives;
00059 uint64_t byteDrops;
00060 uint64_t byteRoutes;
00061
00062
00063 static void writeSchema (qpid::framing::Buffer& buf);
00064 void writeConfig (qpid::framing::Buffer& buf);
00065 void writeInstrumentation (qpid::framing::Buffer& buf,
00066 bool skipHeaders = false);
00067 void doMethod (std::string methodName,
00068 qpid::framing::Buffer& inBuf,
00069 qpid::framing::Buffer& outBuf);
00070 writeSchemaCall_t getWriteSchemaCall (void) { return writeSchema; }
00071
00072
00073 public:
00074
00075 friend class PackageQpid;
00076 typedef boost::shared_ptr<Exchange> shared_ptr;
00077
00078 Exchange (Manageable* coreObject, Manageable* _parent, std::string _name, uint8_t _durable);
00079 ~Exchange (void);
00080
00081 std::string getPackageName (void) { return packageName; }
00082 std::string getClassName (void) { return className; }
00083 uint8_t* getMd5Sum (void) { return md5Sum; }
00084
00085
00086
00087
00088 inline void set_type (std::string val){
00089 sys::RWlock::ScopedWlock writeLock (accessLock);
00090 type = val;
00091 configChanged = true;
00092 }
00093 inline void inc_producers (uint32_t by = 1){
00094 sys::RWlock::ScopedWlock writeLock (accessLock);
00095 producers += by;
00096 if (producersHigh < producers)
00097 producersHigh = producers;
00098 instChanged = true;
00099 }
00100 inline void dec_producers (uint32_t by = 1){
00101 sys::RWlock::ScopedWlock writeLock (accessLock);
00102 producers -= by;
00103 if (producersLow > producers)
00104 producersLow = producers;
00105 instChanged = true;
00106 }
00107 inline void set_producers (uint32_t val){
00108 sys::RWlock::ScopedWlock writeLock (accessLock);
00109 producers = val;
00110 if (producersLow > val)
00111 producersLow = val;
00112 if (producersHigh < val)
00113 producersHigh = val;
00114 instChanged = true;
00115 }
00116 inline void inc_bindings (uint32_t by = 1){
00117 sys::RWlock::ScopedWlock writeLock (accessLock);
00118 bindings += by;
00119 if (bindingsHigh < bindings)
00120 bindingsHigh = bindings;
00121 instChanged = true;
00122 }
00123 inline void dec_bindings (uint32_t by = 1){
00124 sys::RWlock::ScopedWlock writeLock (accessLock);
00125 bindings -= by;
00126 if (bindingsLow > bindings)
00127 bindingsLow = bindings;
00128 instChanged = true;
00129 }
00130 inline void set_bindings (uint32_t val){
00131 sys::RWlock::ScopedWlock writeLock (accessLock);
00132 bindings = val;
00133 if (bindingsLow > val)
00134 bindingsLow = val;
00135 if (bindingsHigh < val)
00136 bindingsHigh = val;
00137 instChanged = true;
00138 }
00139 inline void inc_msgReceives (uint64_t by = 1){
00140 sys::RWlock::ScopedWlock writeLock (accessLock);
00141 msgReceives += by;
00142 instChanged = true;
00143 }
00144 inline void dec_msgReceives (uint64_t by = 1){
00145 sys::RWlock::ScopedWlock writeLock (accessLock);
00146 msgReceives -= by;
00147 instChanged = true;
00148 }
00149 inline void set_msgReceives (uint64_t val){
00150 sys::RWlock::ScopedWlock writeLock (accessLock);
00151 msgReceives = val;
00152 instChanged = true;
00153 }
00154 inline void inc_msgDrops (uint64_t by = 1){
00155 sys::RWlock::ScopedWlock writeLock (accessLock);
00156 msgDrops += by;
00157 instChanged = true;
00158 }
00159 inline void dec_msgDrops (uint64_t by = 1){
00160 sys::RWlock::ScopedWlock writeLock (accessLock);
00161 msgDrops -= by;
00162 instChanged = true;
00163 }
00164 inline void set_msgDrops (uint64_t val){
00165 sys::RWlock::ScopedWlock writeLock (accessLock);
00166 msgDrops = val;
00167 instChanged = true;
00168 }
00169 inline void inc_msgRoutes (uint64_t by = 1){
00170 sys::RWlock::ScopedWlock writeLock (accessLock);
00171 msgRoutes += by;
00172 instChanged = true;
00173 }
00174 inline void dec_msgRoutes (uint64_t by = 1){
00175 sys::RWlock::ScopedWlock writeLock (accessLock);
00176 msgRoutes -= by;
00177 instChanged = true;
00178 }
00179 inline void set_msgRoutes (uint64_t val){
00180 sys::RWlock::ScopedWlock writeLock (accessLock);
00181 msgRoutes = val;
00182 instChanged = true;
00183 }
00184 inline void inc_byteReceives (uint64_t by = 1){
00185 sys::RWlock::ScopedWlock writeLock (accessLock);
00186 byteReceives += by;
00187 instChanged = true;
00188 }
00189 inline void dec_byteReceives (uint64_t by = 1){
00190 sys::RWlock::ScopedWlock writeLock (accessLock);
00191 byteReceives -= by;
00192 instChanged = true;
00193 }
00194 inline void set_byteReceives (uint64_t val){
00195 sys::RWlock::ScopedWlock writeLock (accessLock);
00196 byteReceives = val;
00197 instChanged = true;
00198 }
00199 inline void inc_byteDrops (uint64_t by = 1){
00200 sys::RWlock::ScopedWlock writeLock (accessLock);
00201 byteDrops += by;
00202 instChanged = true;
00203 }
00204 inline void dec_byteDrops (uint64_t by = 1){
00205 sys::RWlock::ScopedWlock writeLock (accessLock);
00206 byteDrops -= by;
00207 instChanged = true;
00208 }
00209 inline void set_byteDrops (uint64_t val){
00210 sys::RWlock::ScopedWlock writeLock (accessLock);
00211 byteDrops = val;
00212 instChanged = true;
00213 }
00214 inline void inc_byteRoutes (uint64_t by = 1){
00215 sys::RWlock::ScopedWlock writeLock (accessLock);
00216 byteRoutes += by;
00217 instChanged = true;
00218 }
00219 inline void dec_byteRoutes (uint64_t by = 1){
00220 sys::RWlock::ScopedWlock writeLock (accessLock);
00221 byteRoutes -= by;
00222 instChanged = true;
00223 }
00224 inline void set_byteRoutes (uint64_t val){
00225 sys::RWlock::ScopedWlock writeLock (accessLock);
00226 byteRoutes = val;
00227 instChanged = true;
00228 }
00229
00230 };
00231
00232 }}
00233
00234
00235 #endif