On Sep 26, 2005, at 14:12 , Jeff Hill wrote:
1) In your example you know at compile time that you want to
extract the
red, green, and blue properties out of some unknown PropertyCatalog.
Almost. I want the r, g, b under "color":
catalog->color->red, ...
Who knows, the catalog might also contain
catalog->preferred_display->foreground->color->red
catalog->preferred_display->background->color->red
catalog->beam->color->red
but I don't want any of those reds.
In your example, you expose a "red" property and
receive a "red" from the "incoming".
Which one would that be?
In this situation you have control over the content of MyColor and no
control over the content of catalogX. Since you have control over
MyColor
you can access it in any way MyColor sees fit - with blinding speed.
...
struct MyColor
{
public:
void set ( const & PropertyCatalog );
private:
int r, g, b;
template < class VIEWER >
static void traverse ( VIEWER & );
};
MyColor :: set ( const PropertyCatalog & incoming )
{
ClassCatalog
< MyColor, PropertyManipulator, traverse >
manipulator ( *this );
manipulator = incoming;
}
template < class VIEWER >
inline void MyColor :: traverse ( VIEWER & viewer )
{
viewer.reveal ( colorRed, & MyColor::r );
viewer.reveal ( colorGreen, & MyColor::g );
viewer.reveal ( colorBlue, & MyColor::b );
}
...C++ templates are great for situations where the algorithm Is
the same, but the
data type varies. I can show you how to automate this if you are
interested
I'm purposedly avoiding the "locator" and templates at this stage
in order to see all that's happening.
When do you think the stringSegment will be usable?
It's the mayor thing missing to be able to play
with some more meaningful data.
Personally, the
getDouble()/getFloat/getInt/getUnsigned/getTime/getString/... type of
interface makes me nauseous.
Well, if we want to get down to what we're feeling,
I worry about the bend-over-and-expose-your-data approach.
That's almost a "paradigm".
-Kay
- Replies:
- Re: data access structures, strings Andrew Johnson
- References:
- 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 Andrew Johnson
- Index:
2002
2003
2004
<2005>
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|