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/Uuid.h"
00029
00030 namespace qpid {
00031 namespace management {
00032
00033 class Exchange : public ManagementObject
00034 {
00035 private:
00036
00037 static std::string packageName;
00038 static std::string className;
00039 static uint8_t md5Sum[16];
00040
00041
00042 uint64_t vhostRef;
00043 std::string name;
00044 std::string type;
00045
00046
00047 uint32_t producers;
00048 uint32_t producersHigh;
00049 uint32_t producersLow;
00050 uint32_t bindings;
00051 uint32_t bindingsHigh;
00052 uint32_t bindingsLow;
00053 uint64_t msgReceives;
00054 uint64_t msgDrops;
00055 uint64_t msgRoutes;
00056 uint64_t byteReceives;
00057 uint64_t byteDrops;
00058 uint64_t byteRoutes;
00059
00060
00061 static void writeSchema (qpid::framing::Buffer& buf);
00062 void writeConfig (qpid::framing::Buffer& buf);
00063 void writeInstrumentation (qpid::framing::Buffer& buf,
00064 bool skipHeaders = false);
00065 void doMethod (std::string methodName,
00066 qpid::framing::Buffer& inBuf,
00067 qpid::framing::Buffer& outBuf);
00068 writeSchemaCall_t getWriteSchemaCall (void) { return writeSchema; }
00069
00070
00071 public:
00072
00073 friend class PackageQpid;
00074 typedef boost::shared_ptr<Exchange> shared_ptr;
00075
00076 Exchange (Manageable* coreObject, Manageable* _parent, std::string _name);
00077 ~Exchange (void);
00078
00079 std::string getPackageName (void) { return packageName; }
00080 std::string getClassName (void) { return className; }
00081 uint8_t* getMd5Sum (void) { return md5Sum; }
00082
00083
00084
00085
00086 inline void set_type (std::string val){
00087 sys::RWlock::ScopedWlock writeLock (accessLock);
00088 type = val;
00089 configChanged = true;
00090 }
00091 inline void inc_producers (uint32_t by = 1){
00092 sys::RWlock::ScopedWlock writeLock (accessLock);
00093 producers += by;
00094 if (producersHigh < producers)
00095 producersHigh = producers;
00096 instChanged = true;
00097 }
00098 inline void dec_producers (uint32_t by = 1){
00099 sys::RWlock::ScopedWlock writeLock (accessLock);
00100 producers -= by;
00101 if (producersLow > producers)
00102 producersLow = producers;
00103 instChanged = true;
00104 }
00105 inline void inc_bindings (uint32_t by = 1){
00106 sys::RWlock::ScopedWlock writeLock (accessLock);
00107 bindings += by;
00108 if (bindingsHigh < bindings)
00109 bindingsHigh = bindings;
00110 instChanged = true;
00111 }
00112 inline void dec_bindings (uint32_t by = 1){
00113 sys::RWlock::ScopedWlock writeLock (accessLock);
00114 bindings -= by;
00115 if (bindingsLow > bindings)
00116 bindingsLow = bindings;
00117 instChanged = true;
00118 }
00119 inline void inc_msgReceives (uint64_t by = 1){
00120 sys::RWlock::ScopedWlock writeLock (accessLock);
00121 msgReceives += by;
00122 instChanged = true;
00123 }
00124 inline void dec_msgReceives (uint64_t by = 1){
00125 sys::RWlock::ScopedWlock writeLock (accessLock);
00126 msgReceives -= by;
00127 instChanged = true;
00128 }
00129 inline void inc_msgDrops (uint64_t by = 1){
00130 sys::RWlock::ScopedWlock writeLock (accessLock);
00131 msgDrops += by;
00132 instChanged = true;
00133 }
00134 inline void dec_msgDrops (uint64_t by = 1){
00135 sys::RWlock::ScopedWlock writeLock (accessLock);
00136 msgDrops -= by;
00137 instChanged = true;
00138 }
00139 inline void inc_msgRoutes (uint64_t by = 1){
00140 sys::RWlock::ScopedWlock writeLock (accessLock);
00141 msgRoutes += by;
00142 instChanged = true;
00143 }
00144 inline void dec_msgRoutes (uint64_t by = 1){
00145 sys::RWlock::ScopedWlock writeLock (accessLock);
00146 msgRoutes -= by;
00147 instChanged = true;
00148 }
00149 inline void inc_byteReceives (uint64_t by = 1){
00150 sys::RWlock::ScopedWlock writeLock (accessLock);
00151 byteReceives += by;
00152 instChanged = true;
00153 }
00154 inline void dec_byteReceives (uint64_t by = 1){
00155 sys::RWlock::ScopedWlock writeLock (accessLock);
00156 byteReceives -= by;
00157 instChanged = true;
00158 }
00159 inline void inc_byteDrops (uint64_t by = 1){
00160 sys::RWlock::ScopedWlock writeLock (accessLock);
00161 byteDrops += by;
00162 instChanged = true;
00163 }
00164 inline void dec_byteDrops (uint64_t by = 1){
00165 sys::RWlock::ScopedWlock writeLock (accessLock);
00166 byteDrops -= by;
00167 instChanged = true;
00168 }
00169 inline void inc_byteRoutes (uint64_t by = 1){
00170 sys::RWlock::ScopedWlock writeLock (accessLock);
00171 byteRoutes += by;
00172 instChanged = true;
00173 }
00174 inline void dec_byteRoutes (uint64_t by = 1){
00175 sys::RWlock::ScopedWlock writeLock (accessLock);
00176 byteRoutes -= by;
00177 instChanged = true;
00178 }
00179
00180 };
00181
00182 }}
00183
00184
00185 #endif