Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace display.format with .form and .precision #62

Merged
merged 1 commit into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/factory/StandardField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
15 changes: 1 addition & 14 deletions src/property/pv/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class epicsShareClass Display {
* 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.
Expand Down Expand Up @@ -75,17 +74,6 @@ class epicsShareClass Display {
* @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.
Expand All @@ -98,7 +86,6 @@ class epicsShareClass Display {
void setUnits(std::string const & value) {units = value;}
private:
std::string description;
std::string format;
std::string units;
double low;
double high;
Expand Down
1 change: 0 additions & 1 deletion src/property/pv/pvDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class epicsShareClass PVDisplay {
static std::string noDisplayFound;
static std::string notAttached;
PVStringPtr pvDescription;
PVStringPtr pvFormat;
PVStringPtr pvUnits;
PVDoublePtr pvLow;
PVDoublePtr pvHigh;
Expand Down
14 changes: 1 addition & 13 deletions src/property/pvDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ bool PVDisplay::attach(PVFieldPtr const & pvField)
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
pvDescription = pvStructure->getSubField<PVString>("description");
if(pvDescription.get()==NULL) return false;
pvFormat = pvStructure->getSubField<PVString>("format");
if(pvFormat.get()==NULL) {
detach();
return false;
}
pvUnits = pvStructure->getSubField<PVString>("units");
if(pvUnits.get()==NULL) {
detach();
Expand All @@ -55,7 +50,6 @@ bool PVDisplay::attach(PVFieldPtr const & pvField)
void PVDisplay::detach()
{
pvDescription.reset();
pvFormat.reset();
pvUnits.reset();
pvLow.reset();
pvHigh.reset();
Expand All @@ -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());
Expand All @@ -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;
Expand All @@ -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());
Expand Down
4 changes: 1 addition & 3 deletions testApp/property/testProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,13 @@ 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);
pvDisplay.get(display);
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();
Expand Down Expand Up @@ -217,7 +215,7 @@ static void testEnumerated()

MAIN(testProperty)
{
testPlan(27);
testPlan(26);
testDiag("Tests property");
fieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
Expand Down
6 changes: 1 addition & 5 deletions testApp/pv/testPVData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PVString>(
string("display.format"));
testOk1(format.get()!=0);
format->put(string("f10.2"));
PVStringPtr units = pvStructure->getSubField<PVString>(
string("display.units"));
testOk1(units.get()!=0);
Expand Down Expand Up @@ -740,7 +736,7 @@ static void testSubField()

MAIN(testPVData)
{
testPlan(271);
testPlan(261);
try{
fieldCreate = getFieldCreate();
pvDataCreate = getPVDataCreate();
Expand Down