diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index e3cea46..9e5af4b 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -2,6 +2,16 @@ This document summarizes the changes to the module between releases. +## Release 4.7.2 (UNRELEASED) + +* The virtual `init()` method of `class PVSupport` has been made un-virtual, and the base-class + implementation always returns `false` as it should not be used. The `ControlSupport` and + `ScalarAlarmSupport` derived classes already provided their own implementations but needed + different method arguments, so a virtual base-class method couldn't be used anyway. + Those derived classes don't appear to be used internally at all, although they were being + used in Marty Kraimer's exampleCPP repository which is no longer maintained or recommended + for use anyway. + ## Release 4.7.1 (EPICS 7.0.8, Dec 2023) * Added data distributor plugin which can be used for distributing data between diff --git a/src/pv/controlSupport.h b/src/pv/controlSupport.h index 4438020..3c501dc 100644 --- a/src/pv/controlSupport.h +++ b/src/pv/controlSupport.h @@ -35,19 +35,18 @@ class epicsShareClass ControlSupport : */ virtual ~ControlSupport(); /** - * @brief Connects to contol fields. + * @brief Connects to control fields. * * @param pvValue The field to support. * @param pvSupport Support specific fields. * @return true for success and false for failure. */ - virtual bool init( + bool init( epics::pvData::PVFieldPtr const & pvValue, epics::pvData::PVFieldPtr const & pvSupport); /** * @brief Honors control fields. * - * * @return Returns true is any fields were modified; otherwise false. */ virtual bool process(); diff --git a/src/pv/pvSupport.h b/src/pv/pvSupport.h index fff10c6..df8b552 100644 --- a/src/pv/pvSupport.h +++ b/src/pv/pvSupport.h @@ -38,17 +38,17 @@ class epicsShareClass PVSupport */ virtual ~PVSupport(){} /** - * @brief Optional initialization method. + * @brief Required initialization method. * - * Called after PVRecord is created but before record is installed into PVDatabase. + * Implementation classes must define an init() method that must be + * explicitly called by PVRecord classes that use them to provide + * references to the specific fields to be supported. Different support + * will may different fields, so a virtual method cannot be defined in + * this base class to support them, hence this method always fails. * - * @param pvValue The field to support. - * @param pvSupport Support specific fields. * @return true for success and false for failure. */ - virtual bool init( - epics::pvData::PVFieldPtr const & pvValue, - epics::pvData::PVFieldPtr const & pvSupport) {return true;} + bool init() {return false;} /** * @brief Optional method for derived class. * diff --git a/src/pv/scalarAlarmSupport.h b/src/pv/scalarAlarmSupport.h index 0563e60..0c5f550 100644 --- a/src/pv/scalarAlarmSupport.h +++ b/src/pv/scalarAlarmSupport.h @@ -45,15 +45,14 @@ class epicsShareClass ScalarAlarmSupport : * @param pvSupport Support specific fields. * @return true for success and false for failure. */ - virtual bool init( + bool init( epics::pvData::PVFieldPtr const & pvValue, epics::pvData::PVStructurePtr const & pvAlarm, epics::pvData::PVFieldPtr const & pvSupport); /** * @brief Honors scalarAlarm fields. * - * - * @return Returns true is any fields were modified; otherwise false. + * @return true if any fields were modified, otherwise false. */ virtual bool process(); /** @@ -77,7 +76,7 @@ class epicsShareClass ScalarAlarmSupport : private: ScalarAlarmSupport(PVRecordPtr const & pvRecord); - enum { + enum AlarmRange { range_Lolo = 0, range_Low, range_Normal, @@ -85,12 +84,12 @@ class epicsShareClass ScalarAlarmSupport : range_Hihi, range_Invalid, range_Undefined - } AlarmRange; + }; void setAlarm( epics::pvData::PVStructurePtr const & pvAlarm, int alarmRange); PVRecordPtr pvRecord; - int prevAlarmRange; + enum AlarmRange prevAlarmRange; epics::pvData::PVScalarPtr pvValue; epics::pvData::PVStructurePtr pvAlarm; epics::pvData::PVStructurePtr pvScalarAlarm; diff --git a/src/support/scalarAlarmSupport.cpp b/src/support/scalarAlarmSupport.cpp index b911bdf..134c3b0 100644 --- a/src/support/scalarAlarmSupport.cpp +++ b/src/support/scalarAlarmSupport.cpp @@ -110,7 +110,7 @@ bool ScalarAlarmSupport::process() double highWarningLimit = pvHighWarningLimit->get(); double highAlarmLimit = pvHighAlarmLimit->get(); double hysteresis = pvHysteresis->get(); - int alarmRange = range_Normal; + enum AlarmRange alarmRange = range_Normal; if(highAlarmLimit>lowAlarmLimit) { if(value>=highAlarmLimit ||(prevAlarmRange==range_Hihi && value>=highAlarmLimit-hysteresis)) {