[GCC-XML] C++ Reflection Using GCCXML? / Reflex

Guy Barrand barrand at lal.in2p3.fr
Thu Sep 1 03:56:05 EDT 2005


Le 1 sept. 05, à 08:39, Bryan Ischo a écrit :

   Hello Bryan

   You may have a look to the "Reflex" project done at CERN.
It is more or less the same idea. Have full introspection for C++ ;
something that a hell of people now recognize to be a huge lack in the  
C++
language / standard itself. In the High Energy Physic (HEP) community  
people attacked
this problem too (mainly to deal with the IO and some OO persistency).

   Some are passing through a C++ interpreter (CINT) to do that,
but it is much more than an introspection system ; and others, then  
Reflex, try to really deal
with the introspection / RTTI problem only and that by using also  
gccxml as input.
About Reflex you can get infos by searching with something like "Reflex  
gccxml" or
"Reflex CERN" or "Reflex LCG" or "Reflex SEAL" on some web search  
engine. You are going to fall on it.
(The Reflex project "moved around", then not clear to me what is now a  
reliable URL).
(But I know that some CERN people (Stefan are you around ? ) are on  
this list ; they can bring more
exact infos).

   Else you may have a look to "acdk". It is more a framework, but in  
it, people
had put some introspection (not using gccxml). One nice idea here is  
that people try to follow
the same class organization, concepts, naming than java to organize  
their things.

  Else if you are developing something of your own which is deliverable  
in its own
(that is to say not embedded / quantum-intricated in some complex C++  
framework reinventing everything) ;
which is open source, portable (at least Linux/g++, Windows/VC++,  
MacOSX/g++) then let give some URL ;
you are going to raise interests...

   If others know also good addresses that deal with this problem...

    Best regards

>
> Hi all.  I've been working on a project for some time now which uses a
> form of reflection for C++, which I have implemented using GCCXML.  My
> goal was rather more narrow than a full reflection system for C++ - I  
> just
> wanted to implement automatic marshalling of C++ objects into a  
> portable
> binary format - but in implementing my system I came to realize the  
> full
> potential of GCCXML in such an application.
>
> So I thought I'd throw the idea out here and see what others think.
>
> The concept is pretty simple: GCCXML can be used to generate, via a  
> tool
> which reads in the GCCXML output and constructs a representation of the
> class hierarchy and class structures thus parsed by GCCXML, a set of
> "tables" describing all of the data relevent to reflection for the  
> input
> C++ classes.  These tables can be used at runtime by a library of  
> methods
> for looking up information describing any C++ class.
>
> The kinds of information that such a reflection-generating tool could
> output into static tables include, for any given class, the set of  
> parent
> classes it inherits from (and from these the set of grandparent classes
> that it inherits from, etc), the set of methods that the class  
> implements,
> including information about the return type and argument types of these
> methods, and information about the fields of the class in addition to
> low-level info about the layout in memory of the class.  Class factory
> methods could be generated as well and allow the construction of  
> "default"
> instances of any C++ class, as well as destructor methods.
>
> The result (I've already done some of this for my purposes but hide it  
> all
> behind an object marshalling framework, not a general C++ reflection
> framework) would be the ability during run-time of querying for the
> properties of any given class, so that all of the functionality made
> possible by a true reflection framework could be realized.  RTTI could  
> be
> used to identify classes and match them up to the generated reflection
> tables.  This would in essence be a way of augmenting the existing C++
> RTTI with a much, much richer set of information.
>
> I've not really used reflection APIs before, except some early Java  
> stuff
> (implements etc) which were mostly useful due to architectural  
> features of
> the Java language.  So I'm wondering if a C++ API that would let you  
> query
> an object for its members, set them by name, call methods of objects  
> whose
> actual types you don't know, by name, etc, would be useful to anyone.   
> I
> actually can't think of too many ways that I would use such an API in  
> the
> kids of code that I write.  Like I said I find object serialization to  
> be
> a worthwhile goal so I have implemented enough of the above system to,  
> in
> my code, generate tables which allow the automated marshalling to and
> unmarshalling from a binary serialization format for C++ classes.
>
> Just curious what others think of this idea.  Was it obvious already?   
> I
> haven't heard of anyone doing anything similar before, and I'm not  
> sure if
> that's because no one's thought of it before, or because no one's  
> thought
> that it would be useful enough to do.
>
> All the best,
> Bryan
>
>
> ----------------------------------------------------------------------- 
> -
> Bryan Ischo             bryan at ischo.com                          N, R,  
> 6
> New York, NY, USA       http://www.ischo.com            RedHat Linux  
> 7.3
> ----------------------------------------------------------------------- 
> -
>
>
>
> _______________________________________________
> gccxml mailing list
> gccxml at gccxml.org
> http://www.gccxml.org/mailman/listinfo/gccxml
>
     Guy

-------------------------------------------------------------
Guy Barrand. eXtreme debugger.
   LAL
   Universite de Paris-Sud
   B.P 34
   91898 ORSAY CEDEX France

e-mail: barrand at lal.in2p3.fr
Tel: +33 (1) 64 46 84 17
Fax: +33 (1) 69 07 94 04

office at cern: B01-R001
Tel at cern: 41 22 76 72335
-------------------------------------------------------------




More information about the gccxml mailing list