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

DC_DeltaProfile.cpp

00001 // 00002 // Copyright 2004 P&P Software GmbH - All Rights Reserved 00003 // 00004 // DC_DeltaProfile.cpp 00005 // 00006 // Version 1.1 00007 // Date 07.01.03 (Version 1.0) 00008 // 01.10.03 (Version 1.1) 00009 // Author A. Pasetti (P&P Software), R. Totaro 00010 // 00011 // Change Record: 00012 // Version 1.1: replaced double and int with TD_Float and TD_Integer 00013 00014 #include "../GeneralInclude/CompilerSwitches.h" 00015 #include "../GeneralInclude/DebugSupport.h" 00016 #include "../GeneralInclude/Constants.h" 00017 #include "../GeneralInclude/ClassId.h" 00018 #include "DC_DeltaProfile.h" 00019 00020 #include <math.h> 00021 00022 DC_DeltaProfile::DC_DeltaProfile(void) { 00023 setClassId(ID_DELTAPROFILE); 00024 deltaThreshold = (TD_Float)0.0; 00025 previousValue = (TD_Float)0.0; 00026 reset(); 00027 } 00028 00029 bool DC_DeltaProfile::doProfileCheck(TD_Float value) { 00030 assert( deltaThreshold>(TD_Float)0.0 ); 00031 00032 if (notFirst && fabs(value-previousValue)>(double)deltaThreshold) { 00033 previousValue = value; 00034 return MON_PROFILE_DEVIATION; 00035 } 00036 else { 00037 notFirst = true; 00038 previousValue = value; 00039 return NO_MON_PROFILE_DEVIATION; 00040 } 00041 } 00042 00043 bool DC_DeltaProfile::doProfileCheck(TD_Integer value) { 00044 assert( deltaThreshold>(TD_Float)0.0 ); 00045 return doProfileCheck( (TD_Float)value ); 00046 } 00047 00048 void DC_DeltaProfile::setDeltaThreshold(TD_Float deltaThreshold) { 00049 assert( deltaThreshold>(TD_Float)0.0 ); 00050 this->deltaThreshold = deltaThreshold; 00051 } 00052 00053 TD_Float DC_DeltaProfile::getDeltaThreshold(void) { 00054 assert( deltaThreshold>(TD_Float)0.0 ); 00055 return deltaThreshold; 00056 } 00057 00058 void DC_DeltaProfile::reset(void) { 00059 notFirst = false; 00060 } 00061 00062 bool DC_DeltaProfile::isObjectConfigured(void) { 00063 return (MonitoringProfile::isObjectConfigured() && deltaThreshold>(TD_Float)0.0); 00064 }
Copyright 2003 P&P Software GmbH - All Rights Reserved