EPICS Home

Experimental Physics and Industrial Control System


 
2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Get sub field of Union
From: Michael Davidsaver via Core-talk <[email protected]>
To: "Shen, Guobao" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Thu, 21 Mar 2019 11:19:05 -0700
On 3/21/19 8:43 AM, Shen, Guobao via Core-talk wrote:
> Hi Core member,
> 
> Does anyone have experienced to read sub field of a Union structure?

What you are showing looks like a discriminating/tagged union.
This is quite different to having a union containing a structure,
which is maybe what you expect?


> For example, I have a record:
> 
> $ pvinfo Test:Data
> 
> …
> 
> structure
> 
>     uint ArrayId
> 
>     double[] Time
> 
>     union value
> 
>         float[] data1
> 
>         double[] data2
> 
>  
> 
> If I use
> 
> $ pvget -r value Test:Data
> 
> Test:Data
> 
> structure
> 
>     union value
> 
>         float[]  [-0.034794,-0.0417011, …]
> 
>  
> 
> But if I do it with:
> 
> $ pvget -r value.data1 Test:Data
> 
>  
> 
> I got an error on my client like
> 
> [Test: Data] failed to create channel get: Status [type=FATAL, message=std::bad_alloc]
> 
>  
> 
> Is that a right way to use it for union?
> 
>  
> 
> Thanks,
> 
> Guobao
> 


Replies:
Re: Get sub field of Union Shen, Guobao via Core-talk
References:
Get sub field of Union Shen, Guobao via Core-talk

Navigate by Date:
Prev: Get sub field of Union Shen, Guobao via Core-talk
Next: Re: Get sub field of Union Shen, Guobao via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Get sub field of Union Shen, Guobao via Core-talk
Next: Re: Get sub field of Union Shen, Guobao via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024