Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL] MPL use cases overview
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2009-03-26 11:12:33


Dominique Devienne wrote:
> On Wed, Mar 25, 2009 at 3:54 PM, Noah Roberts <roberts.noah_at_[hidden]> wrote:
>> We [...] developed a type description library
>> that can be used to implement runtime reflection and MPL generated edit
>> controls in a GUI.
>
> I'm interested in runtime reflection (introspection) in C++ as well.
> Is your type description library something publicly available? I found
> a "mirror" boost proposal that apparently didn't make it, and it
> wasn't clear to me how complete or usable it was. Any pointers on how
> an augmented type system can be used with MPL to generate code would
> also be appreciated. Thanks, --DD

No, it isn't publicly available. It also would need a lot of work and
research before it's really something I'd feel good about proposing to
boost. It works for our needs, pretty much, but as to others I don't
really know. Perhaps someday because it is an interesting set of
problems and the current reflection proposal seems to focus on something
totally different.

I can tell you though that all the ideas I used are public. I'm not
exactly the best out there, compared to others on this list especially,
so with work and my sources you should be able to implement it or
something that works for you.

I based much of the original code on "Reflection support by means of
template metaprogramming" by Attardi and Cisternino. I probably got it
from citeseer.com but perhaps from the ACM digital library. I altered
it a bit to get rid of void pointers and to allow for fields to be
function based.

I later used the structure composition ideas from the MPL book (chapter
9) and created a way of generating the meta<> class automatically if the
fields are all variable based (couldn't think of a method to use this
idea for function based). At a basic level, meta<> "returns" (as
defined by the MPL book) a Sequence containing field descriptors that
can be used to query and set the field values in a "record".

In my system fields are types with names and type information. The
runtime reflection is simply an object that wraps a "record" (something
that when passed to meta<> will have a type in it) and allows you to set
via strings and template functions. It is there that I used the ideas
given by boost::any and if you look at the docs for that lib there's a
paper on it.

That's the best I can do without permission from my employer. I could
ask my supervisor later...they did let me use it for a presentation
recently.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net