void DbPv::init() { // this requires valid existance of dbPv::shared_pointer instance StandardFieldPtr standardField = getStandardField(); ScalarType scalarType = pvBoolean; switch(dbChannelFinalFieldType(dbChan)) { case DBF_CHAR: scalarType = pvByte; break; case DBF_UCHAR: scalarType = pvUByte; break; case DBF_SHORT: scalarType = pvShort; break; case DBF_USHORT: scalarType = pvUShort; break; case DBF_LONG: scalarType = pvInt; break; case DBF_ULONG: scalarType = pvUInt; break; case DBF_FLOAT: scalarType = pvFloat; break; case DBF_DOUBLE: scalarType = pvDouble; break; case DBF_STRING: scalarType = pvString; break; case DBF_ENUM: case DBF_MENU: case DBF_DEVICE: recordField = standardField->enumerated("value,timeStamp,alarm"); return; case DBF_INLINK: case DBF_OUTLINK: case DBF_FWDLINK: scalarType = pvString; break; default: break; } bool isArray = (dbChannelFinalElements(dbChan) > 1) ? true : false; if(scalarType==pvString) { if(isArray) { recordField = standardField->scalarArray(scalarType, "value,timeStamp,alarm"); } else { recordField = standardField->scalar(scalarType, "value,timeStamp,alarm"); } } else if(scalarType!=pvBoolean) { if(isArray) { recordField = standardField->scalarArray(scalarType, "value,timeStamp,alarm,display"); } else { recordField = standardField->scalar(scalarType, "value,timeStamp,alarm,display,control,valueAlarm"); } } }
static Structure::const_shared_pointer createStructure(CAChannel::shared_pointer const & channel, string const & properties) { StandardFieldPtr standardField = getStandardField(); Structure::const_shared_pointer structure; chtype channelType = channel->getNativeType(); if (channelType != DBR_ENUM) { ScalarType st = dbr2ST[channelType]; structure = (channel->getElementCount() > 1) ? standardField->scalarArray(st, properties) : standardField->scalar(st, properties); } else { // NOTE: enum arrays not supported structure = standardField->enumerated(properties); } return structure; }