120 likes | 250 Views
Seal Dictionary. Applications Area Internal Review 20 October 2003 Stefan Roiser / CERN. Motivation. The Architecture Blueprint RTAG proposes the use of object dictionaries for object streamers, object browsers, debuggers rapid prototyping applications (e.g. Python)
E N D
Seal Dictionary Applications Area Internal Review 20 October 2003 Stefan Roiser / CERN
Motivation • The Architecture Blueprint RTAG proposes the use of object dictionaries for • object streamers, object browsers, debuggers • rapid prototyping applications (e.g. Python) • runtime discovery of interfaces • Modern languages provide reflection inherently • In C++ reflection is very limited (RTTI) • The basic C++ concepts shall be supported • e.g. inheritance, methods, data members, accessibility, templates Seal Dictionary
Packages in Seal Dictionary • Reflection packages • DictionaryGenerator for producing sources • ReflectionBuilder, the loading interface • Reflection, the user API • Dictionary examples • CMS • ATLAS (not yet in cvs) • Standard Dictionaries • CLHEP: Random, Vector • STL: Vector, List, String • Dictionary: Reflection Seal Dictionary
Overall View C++ Object • Build dictionary for C++ object Dictionary for C++ Object • Load information about the object into the reflection model Reflection System • Provide meta information about • the object to the user Client Seal Dictionary
Reflection Model Class Diagram NamespaceBuilder ItemBuilder ClassBuilder FieldBuilder MethodBuilder ReflectionBuilder Item PropertyList Namespace Class Field Method Reflection Seal Dictionary
Usage Example Class mc* = Class::forName(“Foo”); void* fooInst = mc->instantiate(); std::vector<Field*> fields = mc->fields(); std::string f0name = fields[0]->name(); std::string f0type = fields[0]->type()->name(); fields[0].set(fooInst, 4711); Method* m0meth = mc->method(“getBar”); int m0val = m0meth->invoke(fooInst); Seal Dictionary
.xml GOD desc Parse C++ Header Files .xml selection file filter + extend .h gccxml .xml parser gendict header file lcgdict _dict.cpp make dict.so dictionary source dictionary library Example: lcgdict Foo.h –-select=FooSel.xml --deep –I/home/lcg/include Seal Dictionary
How to build Dictionaries #include “Foo.h” class Foo_dict { public: Foo_dict(); }; Foo_dict::Foo_dict() { ClassBuilder(“Foo”,”desc of Foo”, typeid(Foo),sizeof(Foo)). addField(“bar”,”int”,”desc of bar”, OffsetOf(Foo,bar)). addMethod(“getBar”,“desc of getBar”, “int”, Foo_getBar). build(); } static Foo_dict inst; • Parse C++ header files • lcgdict • i.e. gccxml + python script • Other means • Derive from XML descriptions • LHCb approach • Write by hand • design was made with simple syntax in mind Seal Dictionary
Who is using Dictionaries • POOL • DataService • Casting, type-checking and deleting of objects • StorageService • Provide meta-information of objects when writing • Instantiating objects when reading, type-checking • SEAL • PyLCGDict • Python gateway to dictionaries • PluginManager (work in progress) • Loading dictionaries into the application Seal Dictionary
New Reflection Model Scope Namespace PropertyList Type Fundamental Function Array Reference Pointer TypeDef Class Enum Member Inheritance Reflection Seal Dictionary
Outlook • Implementation of new model • Extending and creating new dictionaries on demand • eXtended Type Information (XTI) • Stroustrup approach • Still very preliminary, solution for far future • New language gateways • Java gateway under investigation Seal Dictionary
Summary • Seal • Provides standard dictionaries (STL, CLHEP, …) • Provides python gateway (PyLCGDict) • Feasibility studies for ATLAS and CMS • PluginManager will load dictionaries • New model will be implemented soon • Pool • Has been using dictionary system from the beginning • LHCb • Will use dictionaries as well Seal Dictionary