00001 #ifndef __rmSysInfo_
00002 #define __rmSysInfo_
00003
00004 #include "ResourceMonitor/ResourceMonitorTypes.h"
00005 #include <vector>
00006 #include <string>
00007
00008 #include "rmClient.h"
00009
00010
00011 #include "rmBaseArray.h"
00012
00013 struct SubsystemInfo
00014 {
00015 unsigned long id;
00016 rmSubsystemInfo info;
00017 };
00018
00019 struct ResourceInfo
00020 {
00021 unsigned long subsystemId;
00022 rmResourceInfo info;
00023 };
00024
00025 struct StatisticInfo
00026 {
00027 unsigned long subsystemId;
00028 unsigned long resourceId;
00029 rmValue counterValue;
00030 rmValue guageUpperBound;
00031 rmStatisticInfo info;
00032 };
00033
00034 struct DataCaptureInfo
00035 {
00036 rmUID uuid;
00037 string name;
00038 };
00039
00040 class resourceInfo;
00041 class statisticInfo;
00042
00052 class subsystemInfo : public rmBaseArray<SubsystemInfo>
00053 {
00054 public:
00055 subsystemInfo(unsigned long aSystemStartupTime) : rmBaseArray<SubsystemInfo>(aSystemStartupTime){}
00056 virtual ~subsystemInfo(){}
00057
00058 int init(resourceInfo * aResourceInfo, statisticInfo * aStatisticInfo);
00059
00060 virtual int getUUIDString(RMAttribute aName, unsigned long aID, char * aUUIDStr);
00061 virtual int getUUID(RMAttribute aName, unsigned long aID, uuid_t aUUID);
00062
00063 virtual int getUnsigned(RMAttribute aName, unsigned long aID, unsigned long & aValue);
00064 virtual int getString(RMAttribute aName, unsigned long aID, char * & aBuf);
00065
00066 virtual unsigned long getSubsystemIDByUUID(const uuid_t aUUID);
00067
00068 virtual int addSubsystemByUUID(const uuid_t aUUID);
00069
00070 virtual int removeSubsystemByUUID(const uuid_t aUUID);
00071
00072 private:
00073 resourceInfo * mResourceInfo;
00074 statisticInfo * mStatisticInfo;
00075 };
00076
00087 class resourceInfo : public rmBaseArray<ResourceInfo>
00088 {
00089 public:
00090 resourceInfo(){}
00091 virtual ~resourceInfo(){}
00092
00093 int init(subsystemInfo * aSubsystemInfo, statisticInfo * aStatisticInfo);
00094
00095 virtual int getUUIDString(RMAttribute aName, unsigned long aID, char * aUUIDStr);
00096 virtual int getUUID(RMAttribute aName, unsigned long aID, uuid_t aUUID);
00097
00098 virtual int getUnsigned(RMAttribute aName, unsigned long aID, unsigned long & aValue);
00099 virtual int getString(RMAttribute aName, unsigned long aID, char * & aBuf);
00100
00101 virtual int addResource(const uuid_t aUUID, unsigned long aID);
00102
00103 virtual int removeResource(const uuid_t aUUID, unsigned long aID);
00104
00105 int initResourceInfoBySubsystemID(unsigned long aID, bool initStatistics = false);
00106
00107 private:
00108 subsystemInfo * mSubsystemInfo;
00109 statisticInfo * mStatisticInfo;
00110 };
00111
00122 class statisticInfo : public rmBaseArray<StatisticInfo>
00123 {
00124 public:
00125 statisticInfo(){}
00126 virtual ~statisticInfo(){}
00127
00128 int init(subsystemInfo * aSubsystemInfo, resourceInfo * aResourceInfo);
00129
00130 virtual int getUUIDString(RMAttribute aName, unsigned long aID, char * aUUIDStr);
00131 virtual int getUUID(RMAttribute aName, unsigned long aID, uuid_t aUUID);
00132
00133 virtual int getInteger32(RMAttribute aName, unsigned long aID, long & aValue);
00134
00135 virtual int getUnsigned(RMAttribute aName, unsigned long aID, unsigned long & aValue);
00136 virtual int getString(RMAttribute aName, unsigned long aID, char * & aBuf);
00137
00138 virtual int getUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t & aValue);
00139
00140 virtual int setInteger32(RMAttribute aName, unsigned long aID, long aValue);
00141
00142 virtual int setUnsigned(RMAttribute aName, unsigned long aID, unsigned long aValue);
00143
00144 virtual int setUnsigned64(RMAttribute aName, unsigned long aID, u_int64_t aValue);
00145
00146 int initStatisticInfoByResourceID(unsigned long aID);
00147
00148 private:
00149 subsystemInfo * mSubsystemInfo;
00150 resourceInfo * mResourceInfo;
00151 };
00152
00167 class dataCaptureInfo : public rmBaseArray<DataCaptureInfo>
00168 {
00169 public:
00170 dataCaptureInfo(subsystemInfo * aSubsystemInfo) : mSubsystemInfo(aSubsystemInfo){}
00171 virtual ~dataCaptureInfo(){}
00172
00173 virtual int init();
00174
00175 virtual int getUUIDString(RMAttribute aName, unsigned long aID, char * aUUIDStr);
00176 virtual int getString(RMAttribute aName, unsigned long aID, char * & aBuf);
00177
00178 virtual unsigned long getIDByUUID(const rmUID aUUID);
00179
00180 private:
00181 subsystemInfo * mSubsystemInfo;
00182 };
00183
00184
00185 #endif // __rmSysInfo__