00001
00002 #ifndef _MANAGEMENT_BINDING_
00003 #define _MANAGEMENT_BINDING_
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 Binding : 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 exchangeRef;
00044 uint64_t queueRef;
00045 std::string bindingKey;
00046 framing::FieldTable arguments;
00047
00048
00049
00050
00051
00052 struct PerThreadStats {
00053 uint64_t msgMatched;
00054
00055 };
00056
00057 struct PerThreadStats** perThreadStatsArray;
00058
00059 inline struct PerThreadStats* getThreadStats() {
00060 int index = getThreadIndex();
00061 struct PerThreadStats* threadStats = perThreadStatsArray[index];
00062 if (threadStats == 0) {
00063 threadStats = new(PerThreadStats);
00064 perThreadStatsArray[index] = threadStats;
00065 threadStats->msgMatched = 0;
00066
00067 }
00068 return threadStats;
00069 }
00070
00071 void aggregatePerThreadStats(struct PerThreadStats*);
00072
00073
00074 static void writeSchema (qpid::framing::Buffer& buf);
00075 void writeProperties (qpid::framing::Buffer& buf);
00076 void writeStatistics (qpid::framing::Buffer& buf,
00077 bool skipHeaders = false);
00078 void doMethod (std::string methodName,
00079 qpid::framing::Buffer& inBuf,
00080 qpid::framing::Buffer& outBuf);
00081 writeSchemaCall_t getWriteSchemaCall(void) { return writeSchema; }
00082
00083 public:
00084
00085 friend class PackageQpid;
00086
00087 Binding (ManagementAgent* agent,
00088 Manageable* coreObject, Manageable* _parent, uint64_t _queueRef, std::string _bindingKey, framing::FieldTable _arguments);
00089 ~Binding (void);
00090
00091
00092
00093 std::string& getPackageName (void) { return packageName; }
00094 std::string& getClassName (void) { return className; }
00095 uint8_t* getMd5Sum (void) { return md5Sum; }
00096
00097
00098
00099
00100 inline void inc_msgMatched (uint64_t by = 1){
00101 getThreadStats()->msgMatched += by;
00102 instChanged = true;
00103 }
00104 inline void dec_msgMatched (uint64_t by = 1){
00105 getThreadStats()->msgMatched -= by;
00106 instChanged = true;
00107 }
00108
00109 };
00110
00111 }}
00112
00113 #endif