Experimental Physics and Industrial Control System
|
Begin forwarded message:
From: Kay-Uwe Kasemir <[email protected]>
Date: September 26, 2005 10:58:02 EDT
To: Jeff Hill <[email protected]>
Subject: Re: data access structures, strings
On Sep 23, 2005, at 18:43 , Jeff Hill wrote:
its easy enough to write a
convenience library that implements "destination->r =
data_catalog->find("color")->find("red")->toDouble()" on top of
the data
access minimalist interfaces.
Here's my example of what
the "pulling"
data_catalog->find("color")->find("red")->toInt()
data_catalog->find("color")->find("green")->toInt()
data_catalog->find("color")->find("blue")->toInt()
turns into based on the dataAccess callback mechanism:
class PickRGBPieces : public propertyViewer
{
public:
PickRGBPieces()
{ in_color = have_r = have_g = have_b = false; }
bool isValid()
{ return !in_color && have_r && have_g && have_b; }
int getR()
{ return r; }
int getG()
{ return g; }
int getB()
{ return b; }
void reveal ( const propertyId &, const double &v, const
propertyCatalog &x)
{}
void reveal ( const propertyId &id, const int &v, const
propertyCatalog &x)
{
if (in_color)
{
if (id == red_id)
{
r = v;
have_r = true;
}
else if (id == green_id)
{
g = v;
have_g = true;
}
else if (id == blue_id)
{
b = v;
have_b = true;
}
}
}
void reveal ( const propertyId &, const unsigned int &v, const
propertyCatalog &x)
{}
void reveal ( const propertyId &, const long &v, const
propertyCatalog &x)
{}
void reveal ( const propertyId &, const unsigned long &v, const
propertyCatalog &x)
{}
void reveal ( const propertyId &, const epicsTime &, const
propertyCatalog &x)
{}
void reveal ( const propertyId &, const stringSegment &, const
propertyCatalog &x)
{}
void reveal ( const propertyId &, const enumStateSet & )
{}
void reveal ( const propertyId &, const arraySegment &, const
propertyCatalog &x)
{}
void reveal ( const propertyId &id, const propertyCatalog &x)
{
if (id == color_id)
{
in_color = true;
x.traverse(*this);
in_color = false;
}
}
private:
bool in_color, have_r, have_g, have_b;
int r, g, b;
};
PickRGBPieces rgb;
data_catalog.traverse(rgb);
if (rgb.isValid())
{
cout << "Red : " << rgb.getR() << "\n";
cout << "Green : " << rgb.getG() << "\n";
cout << "Blue : " << rgb.getB() << "\n";
}
-Kay
- Replies:
- RE: data access structures, strings Jeff Hill
- Navigate by Date:
- Prev:
RE: data access structures, strings Jeff Hill
- Next:
RE: data access structures, strings Jeff Hill
- Index:
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: data access structures, strings Jeff Hill
- Next:
RE: data access structures, strings Jeff Hill
- Index:
2002
2003
2004
<2005>
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|
ANJ, 02 Feb 2012 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|