Experimental Physics and Industrial Control System
Liyu, Andrei wrote:
I would like to write to waveform record (long or float type) directly.
At first, I can use dbPutField( ...) but it would take much time because
I need to change 30% of record's array.
At second,
dbScanLock( ...)
write to record array
if I need to give sign CA monitors
precord->putf = TRUE and dbProcess( ...)
dbScanUnlock( ...)
Am I right?
Thanks, Andrei.
I assume you are concerned about performance and thus want to directly
access the array.
I will also assume that your code is not run under a scan task, i.e. it
is not part of record or device support or a subroutine connected to a
record.
Do the following:
At initialization:
struct dbAddr addr;
dbCommon *pdbCommon;
rset *prset;
status = dbNameToAddr("<name>",&addr);
if(status) /*error handle it!!! */
pdbCommon = (dbCommon *)addr.precord;
prset = pdbCommon->rset;
Now get ready to access the array
long no_elements,offset,nNew;
double *pdata;
dbScanLock(pdbCommon);
status = prset->get_array_info(&addr,&no_elements,&offset)
/* check the following things to see if your code can handle the array
Is offset 0?
The current number of elements is no_elements.
The maximum number of elements is addr.no_elements.
Are these OK with you?
Is addr.field_type OK with you?
You probable want DBF_DOUBLE.
This example assumes double
*/
if(addr.field_type!=DBF_DOUBLE) /*ERROR handle it*/
pdata = (double *)addr.pfield;
/* You can now write the data. also set nNew */
status = put_array_info(&addr,nNew);
status = dbProcess(pdbCommon);
dbScanUnlock(pdbCommon);
- References:
- writing to record Liyu, Andrei
- Navigate by Date:
- Prev:
writing to record Liyu, Andrei
- Next:
Record processing knowledge of dbAccess context Peregrine M. McGehee
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
<2004>
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
- Navigate by Thread:
- Prev:
writing to record Liyu, Andrei
- Next:
Record processing knowledge of dbAccess context Peregrine M. McGehee
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
<2004>
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025