Status PvValue::getAlarm(Alarm &alarm) { if(pvGetStructure.get()==NULL) { return Status(Status::STATUSTYPE_ERROR, "no alarm field"); } PVAlarm pvAlarm; PVFieldPtr pvField = pvGetStructure->getSubField("alarm"); if(pvField.get()==NULL) { return Status(Status::STATUSTYPE_ERROR, "no alarm field"); } if(!pvAlarm.attach(pvField)) { return Status(Status::STATUSTYPE_ERROR, "no alarm field"); } pvAlarm.get(alarm); return Status::Ok; }
static PyObject * _getAlarm(PyObject *willBeNull, PyObject *args) { PyObject *pcapsule = 0; PyObject *palarm = 0; if(!PyArg_ParseTuple(args,"OO:nttablePy", &pcapsule, &palarm)) { PyErr_SetString(PyExc_SyntaxError, "Bad argument. Expected (pvt,palarm)"); return NULL; } void *pvoid = PyCapsule_GetPointer(pcapsule,"nttablePvt"); if(pvoid==0) { PyErr_SetString(PyExc_SyntaxError, "first arg must be return from _init"); return NULL; } NTTablePvt *pvt = static_cast<NTTablePvt *>(pvoid); pvoid = PyCapsule_GetPointer(palarm,"alarm"); if(pvoid==0) { PyErr_SetString(PyExc_SyntaxError, "second argument is not an alarm capsule"); return NULL; } Alarm *xxx = static_cast<Alarm *>(pvoid); PVStructurePtr pvStructure = pvt->nttable->getAlarm(); //if(pvStructure!=0) { if(!pvStructure) { PVAlarm pvAlarm; pvAlarm.attach(pvStructure); pvAlarm.get(*xxx); } Py_INCREF(Py_None); return Py_None; }