Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

DC_ProfileList.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // DC_ProfileList.cpp 00005 // 00006 // Version 1.3 00007 // Date 15.08.03 (Version 1.0) 00008 // 01.10.03 (Version 1.1) 00009 // 08.10.03 (Version 1.2) 00010 // 21.10.03 (Version 1.3) 00011 // Author R. Totaro 00012 // 00013 // Change Record: 00014 // Version 1.1: Replaced double and int with TD_Float and TD_Integer 00015 // Version 1.2: Fixed isObjectConfigured() it did not check that all the 00016 // profiles were loaded. 00017 // Version 1.3: loadMonitoringProfile() renamed setMonitoringProfile() 00018 00019 #include "../GeneralInclude/CompilerSwitches.h" 00020 #include "../GeneralInclude/DebugSupport.h" 00021 #include "../GeneralInclude/Constants.h" 00022 #include "../GeneralInclude/ClassId.h" 00023 #include "../Base/CC_RootObject.h" 00024 #include "DC_ProfileList.h" 00025 00026 DC_ProfileList::DC_ProfileList(void) { 00027 setClassId(ID_PROFILELIST); 00028 listSize=0; 00029 pList=pNULL; 00030 } 00031 00032 void DC_ProfileList::setListSize(unsigned int listSize) { 00033 assert(this->listSize==0 && listSize!=0); 00034 00035 this->listSize=listSize; 00036 pList=new MonitoringProfile*[listSize]; 00037 00038 for (unsigned int i=0;i<listSize;i++) 00039 pList[i]=pNULL; 00040 } 00041 00042 unsigned int DC_ProfileList::getListSize(void) const { 00043 return listSize; 00044 } 00045 00046 void DC_ProfileList::setMonitoringProfile(unsigned int i,MonitoringProfile *item) { 00047 // Note that, being i unsigned, if i<listSize, then listSize must be >0! 00048 assert(i<listSize && item!=pNULL); 00049 00050 if (i<listSize) 00051 pList[i]=item; 00052 else 00053 CC_RootObject::getEventRepository()->create(this,EVT_ILLEGAL_MP); 00054 } 00055 00056 MonitoringProfile *DC_ProfileList::getMonitoringProfile(unsigned int i) const { 00057 // Note that, being i unsigned, if i<listSize, then listSize must be >0! 00058 assert(i<listSize); 00059 00060 return pList[i]; 00061 } 00062 00063 bool DC_ProfileList::doProfileCheck(TD_Integer value) { 00064 assert(isObjectConfigured()); 00065 00066 bool retVal=false; 00067 00068 for (unsigned int i=0;i<listSize;i++) { 00069 if (pList[i]->deviatesFromProfile(value)) 00070 retVal=true; 00071 } 00072 00073 return retVal; 00074 } 00075 00076 bool DC_ProfileList::doProfileCheck(TD_Float value) { 00077 assert(isObjectConfigured()); 00078 00079 bool retVal=false; 00080 00081 for (unsigned int i=0;i<listSize;i++) { 00082 if (pList[i]->deviatesFromProfile(value)) 00083 retVal=true; 00084 } 00085 00086 return retVal; 00087 } 00088 00089 bool DC_ProfileList::isObjectConfigured(void) { 00090 if (!MonitoringProfile::isObjectConfigured() || listSize==0) 00091 return NOT_CONFIGURED; 00092 00093 for (unsigned int i=0;i<listSize;i++) { 00094 if (pList[i]==pNULL) 00095 return NOT_CONFIGURED; 00096 } 00097 00098 return CONFIGURED; 00099 }
Copyright 2003 P&P Software GmbH - All Rights Reserved