Hi Phil,
Unfortunately the EPICS IOC code and CA libraries don't handle
zero-length arrays, which is probably the fundamental reason for the
crashes that you saw. Zero elements is commonly taken to mean either one
element, or "as many as you've got", so for your case I agree that this
slightly ugly solution is probably your best one.
- Andrew
On 07/25/2016 09:49 AM, Phil Atkin wrote:
> It's ugly - but yes I can do this, and it might be the least worst
> option. Thanks,
>
> Phil
>
> On 25/07/2016 15:47, Mark Rivers wrote:
>>
>> Rather than using a 0 array dimension to signal no events, could you
>> use a special data value instead? Make a 1x1 array with value=0 or -1
>> or something to signal no events?
>>
>>
>>
>> By using the data rather than the dimension you could then use
>> NDPluginCircularBuff to trigger some action on the special value.
>>
>>
>>
>> Mark
>>
>>
>>
>>
>>
>> *From:*Phil Atkin [mailto:[email protected]]
>> *Sent:* Monday, July 25, 2016 9:17 AM
>> *To:* Mark Rivers; [email protected]
>> *Subject:* Re: areaDetector with 'empty' array output
>>
>>
>>
>> Perhaps a better example: suppose we want to plot the events as each
>> camera frame is processed? If there are no events, we want to clear
>> the display.
>>
>> Phil
>>
>>
>>
>> On 25/07/2016 13:44, Mark Rivers wrote:
>>
>> I'm not sure I understand the question. If count is 0 then is there any point in allocating the NDArray and doing callbacks? Do you still want to pass NDAttributes to downstream plugins? If not, then why not just skip the NDArray allocation and callbacks when count is 0?
>>
>>
>>
>> Mark
>>
>>
>>
>> ________________________________
>>
>> From: [email protected] <mailto:[email protected]> [[email protected] <mailto:[email protected]>] on behalf of Phil Atkin [[email protected]
>> <mailto:[email protected]>]
>>
>> Sent: Monday, July 25, 2016 5:35 AM
>>
>> To: [email protected] <mailto:[email protected]>
>>
>> Subject: areaDetector with 'empty' array output
>>
>>
>>
>> Hi,
>>
>>
>>
>> My areaDetector plugin has an option to generate an array containing a 'list' of events. In pseudocode, it does something like the following in the processCallbacks method:
>>
>>
>>
>> if (this->pArrays[0]) {
>>
>> this->pArrays[0]->release();
>>
>> this->pArrays[0] = NULL;
>>
>> }
>>
>>
>>
>> this->unlock();
>>
>>
>>
>> // Copy the events list to the output array
>>
>> size_t count = events.size();
>>
>> dims[xDim] = count;
>>
>> dims[yDim] = 3; // x, y and type
>>
>> this->pArrays[0] = pNDArrayPool->alloc(2, dims, NDFloat32, 0, nullptr);
>>
>>
>>
>> this->pArrays[0]->timeStamp = pArray->timeStamp;
>>
>> this->pArrays[0]->epicsTS = pArray->epicsTS;
>>
>> this->pArrays[0]->uniqueId = pArray->uniqueId;
>>
>> pArray->pAttributeList->copy(this->pArrays[0]->pAttributeList);
>>
>>
>>
>> this->lock();
>>
>> // [Set some parameter values, including NDArraySizeX,Y,Z]
>>
>> this->getAttributes(this->pArrays[0]->pAttributeList);
>>
>> this->unlock();
>>
>> doCallbacksGenericPointer(this->pArrays[0], NDArrayData, 0);
>>
>> this->lock();
>>
>> callParamCallbacks();
>>
>> Currently I'm experiencing a crash if there are no events in the list. pNDArrayPool->alloc returns null if count is zero. I guess this is neither surprising nor unreasonable, but it leaves me with the question of what I should (and should not) do if the list is empty. I somehow need to 'output' something, otherwise plugins downstream won't be called, will they?
>>
>>
>>
>> Thanks in advance,
>>
>>
>>
>> Phil
>>
>>
>>
>> --
>>
>> [cid:[email protected]]Pixel Analytics is a limited company registered in England. Company number: 7747526; Registered office: 93A New Road, Haslingfield, Cambridge CB23 1LP
>>
>>
>>
>>
>>
>> --
>> *Pixel Analytics*is a limited company registered in England. Company
>> number: 7747526; Registered office: 93A New Road, Haslingfield,
>> Cambridge CB23 1LP
>>
>
> --
> *Pixel Analytics* is a limited company registered in England. Company
> number: 7747526; Registered office: 93A New Road, Haslingfield,
> Cambridge CB23 1LP
--
Arguing for surveillance because you have nothing to hide is no
different than making the claim, "I don't care about freedom of
speech because I have nothing to say." -- Edward Snowdon
- References:
- areaDetector with 'empty' array output Phil Atkin
- RE: areaDetector with 'empty' array output Mark Rivers
- Re: areaDetector with 'empty' array output Phil Atkin
- RE: areaDetector with 'empty' array output Mark Rivers
- Re: areaDetector with 'empty' array output Phil Atkin
- Navigate by Date:
- Prev:
Re: areaDetector with 'empty' array output Phil Atkin
- Next:
Re: MEDM installation error on Linux Mint (libXp.a error) Hulusi Öz
- 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
- Navigate by Thread:
- Prev:
Re: areaDetector with 'empty' array output Phil Atkin
- Next:
may I start a pcaspy ioc together with a streamdevice ioc? Silver
- 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
|