EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: data access structures, strings
From: Kay-Uwe Kasemir <[email protected]>
To: [email protected]
Date: Fri, 23 Sep 2005 17:13:06 -0400
Hi:

Assume I have this source data:

struct RGB { int r, g, b; };
struct data
{
    double    value;
    struct RGB color;
};

I can implement a property catalog for the sub-struct:
class RGBCatalog : public propertyCatalog
{   void traverse ( propertyViewer &v) const
    {
        v.reveal(red_id, rgb->r);
        ..
and then use that in the PC for the data:
class DataCatalog : public propertyCatalog
{   // constructor somehow gets pointer to 'data',
    // prepares RGBCatalog 'color' for data->color
    void traverse ( propertyViewer &v) const
    {
        v.reveal(value_id, data->value);
        v.reveal(color_id, color);
        ...
OK. If I only want the 'value', I use
   data_catalog->find(value_id, ...)
and get a 'reveal' callback for the value.

What if my target data is
struct destination
{
    double value;
    int r, g, b;
}

Is there a way to get
   destination->r =  data -> color.r;
   destination->g =  data -> color.g;
?
As far as I see it, I can call
   data_catalog->find(color_id, ...).
That results in
   reveal(color_id, propertyCatalog &color)
for the whole propertyCatalog for color.

Seems to me that yes, dataAccess helps with handling
containers with differing types for matching properties;
Even containers with differing properties,
but that only on the 'top' level.
Anything one level down must match.

That's the situation where a pulling interface
would be more obvious, because then I can write
the mapping code
  destination->r = data_catalog->find("color")->find("red")->toDouble()

----

When I ask the propertyId->getName() to get the property name,
why not return char * "value"?
Instead it's
    propertyId->getName(stringSegment s)
and then propertyId will call
    s->putChar('v'), s->putChar('a'), s->putChar('l'), ...
That might sound like a very performant and memory-conserving
idea for the channel access library,
but the user of the library still would like to get the property
name, and the required code probably reverses any CPU & mem savings.

-Kay



Replies:
RE: data access structures, strings Jeff Hill

Navigate by Date:
Prev: Re: Failure probing for event generator Ernest L. Williams Jr.
Next: RE: data access structures, strings Jeff Hill
Index: 2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Failure probing for event generator Ernest L. Williams Jr.
Next: RE: data access structures, strings Jeff Hill
Index: 2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·