I think that for command line utilities having the filter be on the client side and sending everything over the network is fine. The time to dump a 2 Mpixel image in ASCII, which I am forced to do now, dwarfs the overhead of the network transmission, and probably actually consumes more network resources unless I happen to be sitting at the console of the client machine.
It seems that one place to implement this would be in the pvData Formatter class. It already has methods for highlight() and format(). One possibility would be to add a trim() method. This would not actually limit the number of array elements, but would rather trim the formatted string for an array to the specified length. That would probably not be an integral number of array elements, but it would meet my requirements.
Mark
-----Original Message-----
From: Marty Kraimer <mrkraimer at comcast.net>
Sent: Wednesday, April 1, 2020 12:48 PM
To: Mark Rivers <rivers at cars.uchicago.edu>; tech-talk at aps.anl.gov
Subject: Re: NTNDArray array filter does not work on value
On 4/1/20 9:44 AM, Mark Rivers wrote:
mrk> pvget -r 'value[array=0:2]' PVRdoubleArray
Can your proposed syntax work to limit all arrays to N values or do I need to specify it for each array? If I use the proposed syntax can I get all elements of the NTNDArray while limiting all arrays to N values?
I was thinking of only providing support for individual fields.
The request syntax provides record options.
Maybe pvDatabaseCPP could support a record option?
-r 'record[array=low:high:inc]field(...)'
This would apply an array filter to all scalarArray fields in the structure the client is requesting.
The structure could have all field types, i.e.
scalar,scalarArray,structure,structureArray,union,unionArray.
But ONLY scalarArray fields will have the filter applied.
I don't think it should be applied to structureArray or unionArray fields.
For complicated structures this can be an expensive request.
BUT this should only be used for get.
I see all kinds of bad behavior for puts.
To my naïve thinking this is something that belongs as a simple option in the pvget and pvmonitor client and not something that requires a complex filter expression. As a user I don't want to have to know the names of the NTNDArray structure elements in advance, I just want to know that the entire structure is called 13SIM1:Pva1:Image which I can determine from the OPI display for NDPluginPva.
The array filter can be used by any client, i.e. not just caget and caput.
I agree that it would be nice to have pvget provide a way to limit the amount of output for all scalarArrays in the received data.
Thus it could be used with all channel providers.
But note that is would be done on the client side so that entire arrays will still be passed from server to client.
Again I see all kinds of bad behavior if it is done for pvput.
Marty