PVControl::minStep implemented

This commit is contained in:
Matej Sekoranja
2014-08-22 22:22:38 +02:00
parent 1098650421
commit 62bc6c1fb1
3 changed files with 12 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ namespace epics { namespace pvData {
class epicsShareClass Control {
public:
Control() : low(0.0), high(0.0) {}
Control() : low(0.0), high(0.0), minStep(0.0) {}
//default constructors and destructor are OK
double getLow() const {return low;}
double getHigh() const {return high;}

View File

@@ -30,11 +30,17 @@ bool PVControl::attach(PVFieldPtr const & pvField)
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
pvLow = pvStructure->getDoubleField("limitLow");
if(pvLow.get()==NULL) return false;
pvHigh = pvStructure->getDoubleField(string("limitHigh"));
pvHigh = pvStructure->getDoubleField("limitHigh");
if(pvHigh.get()==NULL) {
pvLow.reset();
return false;
}
pvMinStep = pvStructure->getDoubleField("minStep");
if(pvMinStep.get()==NULL) {
pvLow.reset();
pvHigh.reset();
return false;
}
return true;
}
@@ -56,6 +62,7 @@ void PVControl::get(Control &control) const
}
control.setLow(pvLow->get());
control.setHigh(pvHigh->get());
control.setMinStep(pvMinStep->get());
}
bool PVControl::set(Control const & control)
@@ -63,9 +70,10 @@ bool PVControl::set(Control const & control)
if(pvLow.get()==NULL) {
throw std::logic_error(notAttached);
}
if(pvLow->isImmutable() || pvHigh->isImmutable()) return false;
if(pvLow->isImmutable() || pvHigh->isImmutable() || pvMinStep->isImmutable()) return false;
pvLow->put(control.getLow());
pvHigh->put(control.getHigh());
pvMinStep->put(control.getMinStep());
return true;
}

View File

@@ -33,6 +33,7 @@ public:
private:
PVDoublePtr pvLow;
PVDoublePtr pvHigh;
PVDoublePtr pvMinStep;
static std::string noControlFound;
static std::string notAttached;
};