From 4ffddfa2f6188665e1ca7592c33fba44ca670b8d Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 15 Jan 2019 20:37:28 -0800 Subject: [PATCH] Replace display.format with .form and .precision Remove instance accessors w/o replacement as a prelude to deprecation. --- src/factory/StandardField.cpp | 3 ++- src/property/pv/display.h | 15 +-------------- src/property/pv/pvDisplay.h | 1 - src/property/pvDisplay.cpp | 14 +------------- testApp/property/testProperty.cpp | 4 +--- testApp/pv/testPVData.cpp | 6 +----- 6 files changed, 6 insertions(+), 37 deletions(-) diff --git a/src/factory/StandardField.cpp b/src/factory/StandardField.cpp index 4bfc7f3..57e695f 100644 --- a/src/factory/StandardField.cpp +++ b/src/factory/StandardField.cpp @@ -65,7 +65,8 @@ StandardField::StandardField() ->add("limitLow", pvDouble) ->add("limitHigh", pvDouble) ->add("description", pvString) - ->add("format", pvString) + ->add("precision", pvInt) + ->add("form", enumerated()) ->add("units", pvString) ->createStructure()) diff --git a/src/property/pv/display.h b/src/property/pv/display.h index 391a2e4..2c2bca2 100644 --- a/src/property/pv/display.h +++ b/src/property/pv/display.h @@ -42,8 +42,7 @@ public: * Constructor */ Display() - : description(std::string("")),format(std::string("")),units(std::string("")), - low(0.0),high(0.0) {} + :low(0.0),high(0.0) {} //default constructors and destructor are OK /** * Get the current value of limitLow. @@ -75,17 +74,6 @@ public: * @param value The value. */ void setDescription(std::string const & value) {description = value;} - /** - * Get the current value of format. - * @return The current value. - */ - std::string getFormat() const {return format;} - /** - * Set format to a new value. - * @param value The value. - * The rules for a valid syntax has not been specified. - */ - void setFormat(std::string const & value) {format = value;} /** * Get the current value of units. * @return The current value. @@ -98,7 +86,6 @@ public: void setUnits(std::string const & value) {units = value;} private: std::string description; - std::string format; std::string units; double low; double high; diff --git a/src/property/pv/pvDisplay.h b/src/property/pv/pvDisplay.h index 968ee45..dcd8ba3 100644 --- a/src/property/pv/pvDisplay.h +++ b/src/property/pv/pvDisplay.h @@ -79,7 +79,6 @@ private: static std::string noDisplayFound; static std::string notAttached; PVStringPtr pvDescription; - PVStringPtr pvFormat; PVStringPtr pvUnits; PVDoublePtr pvLow; PVDoublePtr pvHigh; diff --git a/src/property/pvDisplay.cpp b/src/property/pvDisplay.cpp index 1205262..7f6cce0 100644 --- a/src/property/pvDisplay.cpp +++ b/src/property/pvDisplay.cpp @@ -29,11 +29,6 @@ bool PVDisplay::attach(PVFieldPtr const & pvField) PVStructurePtr pvStructure = static_pointer_cast(pvField); pvDescription = pvStructure->getSubField("description"); if(pvDescription.get()==NULL) return false; - pvFormat = pvStructure->getSubField("format"); - if(pvFormat.get()==NULL) { - detach(); - return false; - } pvUnits = pvStructure->getSubField("units"); if(pvUnits.get()==NULL) { detach(); @@ -55,7 +50,6 @@ bool PVDisplay::attach(PVFieldPtr const & pvField) void PVDisplay::detach() { pvDescription.reset(); - pvFormat.reset(); pvUnits.reset(); pvLow.reset(); pvHigh.reset(); @@ -72,7 +66,6 @@ void PVDisplay::get(Display & display) const throw std::logic_error(notAttached); } display.setDescription(pvDescription->get()); - display.setFormat(pvFormat->get()); display.setUnits(pvUnits->get()); display.setLow(pvLow->get()); display.setHigh(pvHigh->get()); @@ -83,7 +76,7 @@ bool PVDisplay::set(Display const & display) if(pvDescription.get()==NULL) { throw std::logic_error(notAttached); } - if(pvDescription->isImmutable() || pvFormat->isImmutable()) return false; + if(pvDescription->isImmutable()) return false; if(pvUnits->isImmutable() || pvLow->isImmutable() || pvHigh->isImmutable()) { return false; @@ -96,11 +89,6 @@ bool PVDisplay::set(Display const & display) pvDescription->put(display.getDescription()); returnValue = true; } - if(current.getFormat()!=display.getFormat()) - { - pvFormat->put(display.getFormat()); - returnValue = true; - } if(current.getUnits()!=display.getUnits()) { pvUnits->put(display.getUnits()); diff --git a/testApp/property/testProperty.cpp b/testApp/property/testProperty.cpp index fd74d7d..949662c 100644 --- a/testApp/property/testProperty.cpp +++ b/testApp/property/testProperty.cpp @@ -172,7 +172,6 @@ static void testDisplay() dy.setLow(-10.0); dy.setHigh(-1.0); dy.setDescription(string("testDescription")); - dy.setFormat(string("%f10.0")); dy.setUnits(string("volts")); result = pvDisplay.set(dy); testOk1(result); @@ -180,7 +179,6 @@ static void testDisplay() testOk1(dy.getLow()==display.getLow()); testOk1(dy.getHigh()==display.getHigh()); testOk1(dy.getDescription().compare(display.getDescription())==0); - testOk1(dy.getFormat().compare(display.getFormat())==0); testOk1(dy.getUnits().compare(display.getUnits())==0); double low = display.getLow(); double high = display.getHigh(); @@ -217,7 +215,7 @@ static void testEnumerated() MAIN(testProperty) { - testPlan(27); + testPlan(26); testDiag("Tests property"); fieldCreate = getFieldCreate(); pvDataCreate = getPVDataCreate(); diff --git a/testApp/pv/testPVData.cpp b/testApp/pv/testPVData.cpp index 7625924..b532f0b 100644 --- a/testApp/pv/testPVData.cpp +++ b/testApp/pv/testPVData.cpp @@ -224,10 +224,6 @@ static void testPVScalarWithProperties( string("display.description")); testOk1(desc.get()!=0); desc->put(string("this is a description")); - PVStringPtr format = pvStructure->getSubField( - string("display.format")); - testOk1(format.get()!=0); - format->put(string("f10.2")); PVStringPtr units = pvStructure->getSubField( string("display.units")); testOk1(units.get()!=0); @@ -740,7 +736,7 @@ static void testSubField() MAIN(testPVData) { - testPlan(271); + testPlan(261); try{ fieldCreate = getFieldCreate(); pvDataCreate = getPVDataCreate();