#include <MonitoringProfile.h>
Inheritance diagram for MonitoringProfile:
A monitoring profile encapsulates a profile against which the value of a monitored variable must be checked (monitoring check). Two versions of the monitoring check are offered by this class, one for monitored variables of TD_Float
type and one for monitored variables of TD_Integer
type.
Monitoring profiles can be enabled or disabled. A monitoring profile that is disabled will always report: "no deviation from profile".
Monitoring profiles can be linked in sequential chains. The client only sees one single monitoring profile (the one at the head of the chain) but its execution can lead to all profiles in the chain being executed in sequence. This class defines a next monitoring profile attribute that holds the pointer to the next monitoring profile in the chain. A monitoring profile reports "no profile violation detected" only if neither itself nor any of the monitoring profiles downstream in the chain of linked profiles report "no profile violation detected".
A violation of a monitoring profile is reported as an event.
This class is abstract because the implementation of the monitoring profile is class-specific and must be defined in the derived classes that implement concrete profiles. The management of the enable status and the reporting of profile violation as events is however performed in this base class.
Add a test case to cover the "next monitoring profile" functionality. This could be obtained by modifying the test case of DC_ProfileList.
Monitoring profiles use parameters that are implemented as internal variables. In practice, these parameters will often have to come from the parameter database. Two solutions are possible: generators are used to parameterize the concrete monitoring profiles classes with respect to the mode of implementation of the profile parameters. Or aspect programs are used modify the monitoring profile class as follows: code to set the link to the parameter database is inserted, and code to update the value of the internal parameter with the value read from the parameter database is added at the beginning of method doProfileCheck.
Roberto Totaro
Definition at line 67 of file MonitoringProfile.h.
Public Member Functions | |
MonitoringProfile (void) | |
Instantiate a monitoring profile. | |
bool | deviatesFromProfile (TD_Float value) |
Check whether the value of the monitored variable - passed as an argument to the method - is within the profile encapsulated by the monitoring profile object. | |
bool | deviatesFromProfile (TD_Integer value) |
Version of method deviatesFromProfile() for monitored variables of integer type. | |
void | setEnabled (bool enableStatus) |
Set the enable status of the monitoring profile. | |
bool | isEnabled (void) |
Check the enable status of the monitoring profile. | |
void | setNextMonitoringProfile (MonitoringProfile *pNextMonitoringProfile) |
Set the next monitoring profile. | |
MonitoringProfile * | getNextMonitoringProfile () |
Get the next monitoring profile. | |
virtual void | reset (void) |
Reset the internal state of the monitoring profile to the value it had immediately after instantiation. | |
Protected Member Functions | |
virtual bool | doProfileCheck (TD_Float value)=0 |
Encapsulate the check of the monitored variable value against the monitoring profile. | |
virtual bool | doProfileCheck (TD_Integer value)=0 |
Version of method doProfileCheck() for monitored variables of integer type. |
|
Instantiate a monitoring profile. The enabled status of the profile is initialized to "enabled". The "next monitoring profile" attribute is set to NULL. Definition at line 22 of file MonitoringProfile.cpp. |
|
Version of method
Definition at line 41 of file MonitoringProfile.cpp. |
|
Check whether the value of the monitored variable - passed as an argument to the method - is within the profile encapsulated by the monitoring profile object. The check is only done if the monitoring profile object is enabled. If it is disabled, the method returns true indicating that there is no deviation from the profile. After performing the monitoring check encapsulated by this class, it is verified whether there are any linked monitoring checks and, if so, the check value is passed on to them. A return value of "deviation detected" may indicate either that this check has detected a violation or that a violation has been detected by the next monitoring profile in the chain. A pseudo-code implementation for this method is as follows: bool outcome = NO_MON_PROFILE_DEVIATION; if ( isEnabled() ) { if (doProfileCheck(value)) { createEventReport(EVT_MON_PROFILE_VIOLATION); outcome = MON_PROFILE_DEVIATION; } } if ( pNext!=pNULL ) // there is a next monitoring profile if ( next->deviatesFromProfile(value) ) outcome = MON_PROFILE_DEVIATION; return outcome;The doProfileCheck() method is abstract and encapsulates the implementation of the profile check. Thus, this class enforces the management of the enabled status and of the "next monitoring profile" but delegates implementation of the monitoring profile check to derived classes implementing concrete profiles. An event is created when deviations from the profile are detected. The event parameter is the class identifier of the monitoring profile object itself.
Definition at line 27 of file MonitoringProfile.cpp. |
|
Version of method
Implemented in DC_DeltaProfile, DC_ForbiddenValueProfile, DC_NullProfile, DC_ProfileList, DC_SampleMonitoringProfile, DC_SimpleChangeProfile, DC_StuckDataProfile, and RangeProfile. |
|
Encapsulate the check of the monitored variable value against the monitoring profile.
This method is called by method
Implemented in DC_DeltaProfile, DC_ForbiddenValueProfile, DC_InRangeProfile, DC_NullProfile, DC_OutOfRangeProfile, DC_ProfileList, DC_SampleMonitoringProfile, DC_SimpleChangeProfile, DC_StuckDataProfile, and RangeProfile. |
|
Get the next monitoring profile. If no monitoring profile has been chained to this one, then a value of pNULL is returned.
Definition at line 60 of file MonitoringProfile.cpp. |
|
Check the enable status of the monitoring profile.
Definition at line 17 of file MonitoringProfile_inl.h. |
|
Reset the internal state of the monitoring profile to the value it had immediately after instantiation. Some monitoring profiles need to keep track of past values of the monitored variable and therefore have an internal state. This method allows this internal state to be reset. This class offers a default implementation of this method that does not do anything. Subclasses may need to override this default implementation. Reimplemented in DC_DeltaProfile, and DC_StuckDataProfile. Definition at line 64 of file MonitoringProfile.cpp. |
|
Set the enable status of the monitoring profile.
When the profile is disabled, a call to method
Definition at line 13 of file MonitoringProfile_inl.h. |
|
Set the next monitoring profile.
Definition at line 55 of file MonitoringProfile.cpp. |