PVControl::minStep implemented
This commit is contained in:
@@ -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;}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
private:
|
||||
PVDoublePtr pvLow;
|
||||
PVDoublePtr pvHigh;
|
||||
PVDoublePtr pvMinStep;
|
||||
static std::string noControlFound;
|
||||
static std::string notAttached;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user