Presentation is loading. Please wait.

Presentation is loading. Please wait.

Reflex Dictionary Generator Antti Hahto 4.8.2006.

Similar presentations


Presentation on theme: "Reflex Dictionary Generator Antti Hahto 4.8.2006."— Presentation transcript:

1 Reflex Dictionary Generator Antti Hahto antti.hahto@tut.fi 4.8.2006

2 What?  Replacing the CINT Dictionary Generator with a new one, using Reflex API

3 Why?  CINT memory requirements large (no dynamic allocation)  Root written in C++ object oriented way, CINT is not. Previous DictGen using also Python → lacking uniformity  Data structures already in the Reflex format  The advantages of modern object oriented programming  maintainability, flexibility, re-usability, data encapsuling...

4 Do I need one? 1) Interactive usage through scripting languages  Root scripts in c++, no need to compile to see the results immediately 2) Making objects persistent  Writing/retrieving objects from disk  Using Root I/O, for an example

5 Reflection  A program can observe and modify its structural information while running  Usually, when a C++ program source is compiled into a machine code, information about the structure is lost  Reflection is a preservation of the original structure, in a way of producing some additional metadata (dictionary)  Poorly supported in C++, unlike for example in Java

6 How?  A dictionary is built for types, scopes and members  Dictionary is then loaded into the reflection database  Metainformation is provided for the user

7 The structure User’s.h - file CINT/ Pyroot Dictionary CINT Root services Dynamic Library file.so Old Dictgen Reflex datastruct Cint datastruct Reflex datastruct New Dictgen loads

8 Object oriented architecture  Each type capable of generating its own dictionary information (“ DataMemberGen(type666,"a") “) in addition to its c++ code code representation (“ int a; ”)  Dictionary generation via hierarchy; class generates information about itself and then forwards the request to all its members.

9 Object oriented architecture globalscope.G() Namespace.G() class/struct.G() funct.member Datamember.G() Fundamental.G() enum (union) int.G() Int Mynamespace::MyClas s::Member::fNumber

10 An example namespace Alaska { class Elephant { private: unsigned fEnergy_level; public: void Eat_nuts(unsigned amount) { for(unsigned i=0; i<amount; ++i) { ++fEnergy_level;} }};}... NamespaceBuilder nsb0( "Alaska" ); Type type_666 = TypeBuilder("unsigned int"); ClassBuilder("Alaska::Elephant", typeid(Alaska::Elephant), sizeof(Alaska::Elephant), PUBLIC | CLASS).AddFunctionMember(FunctionTypeBuilder(t ype_void, type_666), "Eat_nuts", method_3555, 0, "amount", PUBLIC)

11 DictGen class  A new class, taking care of common tasks in dictionary generation and configuration  Member functions: Use_recursive(true/false) Use_selection("filename") Add_extra_header(“filename”) Dump("filename")

12 Testing procedure.h - file Dictionary Reflex datastruct New Dictgen Gcc_xml Gendict.py Dictionary ==

13 Status, ToDo  Successfully generates dictionaries for tested header files .xml selection file usage / Linkdef and unions not fully implemented  Needs testing for more complicated & large files

14


Download ppt "Reflex Dictionary Generator Antti Hahto 4.8.2006."

Similar presentations


Ads by Google