bool PVAlarm::attach(PVFieldPtr const & pvField) { if(pvField->getField()->getType()!=structure) return false; PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField); pvSeverity = pvStructure->getIntField("severity"); if(pvSeverity.get()==NULL) return false; pvStatus = pvStructure->getIntField("status"); if(pvStatus.get()==NULL) { pvSeverity.reset(); return false; } pvMessage = pvStructure->getStringField("message"); if(pvMessage.get()==NULL) { pvSeverity.reset(); pvStatus.reset(); return false; } return true; }
bool PVEnumerated::attach(PVFieldPtr const & pvField) { if(pvField->getField()->getType()!=structure) return false; PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField); pvIndex = pvStructure->getIntField("index"); if(pvIndex.get()==NULL) return false; PVScalarArrayPtr pvScalarArray = pvStructure->getScalarArrayField( "choices",pvString); if(pvScalarArray.get()==NULL) { pvIndex.reset(); return false; } pvChoices = static_pointer_cast<PVStringArray>(pvScalarArray); return true; }