SEAL Reflex, the new Reflection Library Stefan Roiser (for the LCG/SEAL Dictionary work package) LCG Applications Area Meeting, Oct. 6, 2004.

Slides:



Advertisements
Similar presentations
Reflex Dictionary Generator Antti Hahto
Advertisements

Seal Dictionary Applications Area Internal Review 20 October 2003 Stefan Roiser / CERN.
 2006 Pearson Education, Inc. All rights reserved. Templates (again)CS-2303, C-Term Templates (again) CS-2303 System Programming Concepts (Slides.
Templates. Objectives At the conclusion of this lesson, students should be able to Explain how function templates are used Correctly create a function.
Review of C++ Programming Part II Sheng-Fang Huang.
10th TTCN-3 User Conference, 7-9 June 2011, Bled, Slovenia AUTOSAR Conformance Tests - Feedback on their development and utilization Alain Feudjio-Vouffo,
SEAL V1 Status 12 February 2003 P. Mato / CERN Shared Environment for Applications at LHC.
Lecture 23 Today Standard Template Library Programs in: programs/p19 Bibliography: Textbook p.252,
XML I/O in ROOT S. Linev, R. Brun, H.G. Essel CHEP 2004.
Object Oriented Data Structures
SPI Software Process & Infrastructure EGEE France - 11 June 2004 Yannick Patois
CINT Retrospect ROOT Workshop Mar 2013 Agilent Technologies Masaharu Goto.
M.Frank CERN/LHCb - Persistency Workshop, Dec.2004 Agenda: 2 separate talks! Don’t mangle together what does not belong together 1.Schema Evolution Tests.
CINT & Reflex: New Reflection Data Structures Masa(haru) Goto Agilent Philippe Canal Fermilab/CD Stefan Roiser, Axel Naumann PH/SFT.
By Noorez Kassam Welcome to JNI. Why use JNI ? 1. You already have significantly large and tricky code written in another language and you would rather.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
 2006 Pearson Education, Inc. All rights reserved Classes: A Deeper Look, Part 2.
SEAL: Core Libraries and Services Project CERN/IT After-C5 Meeting 6 June 2003 P. Mato / CERN.
March 27, 2007HPC 07 - Norfolk, VA1 C++ Reflection for High Performance Problem Solving Environments Tharaka Devadithya 1, Kenneth Chiu 2, Wei Lu 1 1.
GPCE'04, Vancouver 1 Towards a General Template Introspection Library in C++ István Zólyomi, Zoltán Porkoláb Department of Programming Languages and Compilers.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
CHEP 2003 March 22-28, 2003 POOL Data Storage, Cache and Conversion Mechanism Motivation Data access Generic model Experience & Conclusions D.Düllmann,
Object Based Programming Chapter 8. 2 In This Chapter We will learn about classes Garbage Collection Data Abstraction and encapsulation.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
W. Pokorski - CERN Simulation Project1 Python binding for Geant4 toolkit using Reflex/PyROOT tool Witek Pokorski EuroPython 2006, CERN, Geneva
The SEAL C++ Reflection System Stefan Roiser (for the LCG/SEAL Dictionary work package) CHEP 2004, 27. Sept Oct., Interlaken.
SEAL Project Overview Lorenzo Moneta/ CERN-EP on behalf of the SEAL team ACAT03 IX International Workshop on Advanced Computing and Analysis Techniques.
SEAL: Common Core Libraries and Services for LHC Applications CHEP’03, March 24-28, 2003 La Jolla, California J. Generowicz/CERN, M. Marino/LBNL, P. Mato/CERN,
SEAL Core Libraries and Services CLHEP Workshop 28 January 2003 P. Mato / CERN Shared Environment for Applications at LHC.
Chapter 7 Templates. Objectives Introduction Function Templates Class Templates Standard Template Library.
SEAL Project Core Libraries and Services 18 December 2002 P. Mato / CERN Shared Environment for Applications at LHC.
JACO JACO - Java Access to C++ Objects Mark Dönszelmann and Tony Johnson 25 May 2000.
LC Software Workshop, May 2009, CERN P. Mato /CERN.
C Sharp Web & Internet Programming Group Diana, Aren, Jeff, & Adam, Farrin 5/5/20081CS 311.
- Athena Data Dictionary (28nov00 - SW CERN) Athena Data Dictionary Craig E. Tull HCG/NERSC/LBNL Software CERN November 28,
ROOT Tutorials - Session 51 ROOT Tutorials – Session 5 Dictionary Generation, rootcint, Simple I/O, Hands-on Fons Rademakers.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 16: Introduction to C++
An evaluation of tools for static checking of C++ code E. Arderiu Ribera, G. Cosmo, S. M. Fisher, S. Paoli, M. Stavrianakou CHEP2000, Padova,
Feedback from LHC Experiments on using CLHEP Lorenzo Moneta CLHEP workshop 28 January 2003.
Servicing HEP experiments with a complete set of ready integrated and configured common software components Stefan Roiser 1, Ana Gaspar 1, Yves Perrin.
SEAL and PI Project Status LHCC Comprehensive Review of LCG November 2004 P. Mato / CERN.
Software Engineering Overview DTI International Technology Service-Global Watch Mission “Mission to CERN in Distributed IT Applications” June 2004.
Event Data Definition in LHCb Marco Cattaneo Markus Frank Silvia Miksch Gloria Corti Pere Mato Vila Stefan Roiser.
STL CSSE 250 Susan Reeder. What is the STL? Standard Template Library Standard C++ Library is an extensible framework which contains components for Language.
Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class.
ROOT Team Meeting Axel Naumann CERN PH/SFT Crienftlex Extended Version. And also Director’s Cut. Crienftlex.
D. Duellmann - IT/DB LCG - POOL Project1 The LCG Dictionary and POOL Dirk Duellmann.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 3 is due Sunday, the 8 th at 7pm. Problems with assn 3? Discuss at your team meeting tonight.
Geant4 is a toolkit to simulate the passage of particles through matter, and is widely used in HEP, in medical physics and for space applications. Ongoing.
CINT & Reflex – The Future CINT’s Future Layout Reflex API Work In Progress: Use Reflex to store dictionary data Smaller memory footprint First step to.
SEAL Project Status SC2 Meeting 16th April 2003 P. Mato / CERN.
G.Govi CERN/IT-DB 1GridPP7 June30 - July 2, 2003 Data Storage with the POOL persistency framework Motivation Strategy Storage model Storage operation Summary.
Object-Oriented Programming (OOP) and C++
CINT/Reflex workshop 1 Rene Brun 4 May 2005 Summary of the CINT/Reflex workshop 2-6 May 2005
Project Work Plan SEAL: Core Libraries and Services 7 January 2003 P. Mato / CERN Shared Environment for Applications at LHC.
JRA1 Meeting – 09/02/ Software Configuration Management and Integration EGEE is proposed as a project funded by the European Union under contract.
2001 ROOT Workshop The Summary. Content Most Requested Request already satisfied Build and Distribution Web Page Information and Documentation.
POOL Based CMS Framework Bill Tanenbaum US-CMS/Fermilab 04/June/2003.
Object Based Programming Chapter 8. 2 Contrast ____________________ Languages –Action oriented –Concentrate on writing ________________ –Data supports.
ROOT / Reflex ‘07+ Stefan Roiser Missed last team meeting b/c.
SEAL: Common Core Libraries and Services for LHC Applications
SEAL Project Overview Lorenzo Moneta/ CERN-EP ACAT03
Stefan Roiser CERN / PH / SFT
SEAL Project Status LCG Applications Area Internal Review
Dictionary generation for the Experiments
Templates.
Event Data Definition in LHCb
Geant4 Geometry Objects Persistency using ROOT
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
SEAL Project Core Libraries and Services
Presentation transcript:

SEAL Reflex, the new Reflection Library Stefan Roiser (for the LCG/SEAL Dictionary work package) LCG Applications Area Meeting, Oct. 6, 2004

6. Oct. 2004Stefan Roiser2 Content Reflection and C++ The Model Use Cases Producing reflection information Current status, future enhancements CHEP ‘04 Conclusion

6. Oct. 2004Stefan Roiser3 Definitions Reflection is the ability of a language to introspect it’s own structure at runtime and interact with it in a generic way A dictionary provides reflection information about types of a certain language to the user

6. Oct. 2004Stefan Roiser4 What is Reflection? class Particle { public: double mass(); private: double m_mass; }; Without prior knowledge about types Particle p; std::cout << p.mass(); ClassBuilder(“Particle”). addDataMember(“m_mass”). addFunctionMember(“mass”); const Type* t = Type::byName(“Particle”); Object o = t->construct(); cout << *(double*) o.invoke(“mass”); t->destruct(o);

6. Oct. 2004Stefan Roiser5 Reflection and C++ Very limited support by the language (RTTI) –Other languages do (e.g. Java, Python,…) Several approaches exist, but … –Tied to a system or –Instrumentation of code needed Stroustrup proposed XTI (eXtended Type Information)

6. Oct. 2004Stefan Roiser6 Goals Enhance C++ with reflection capabilities – non intrusive, automated Close to the C++ ISO standard Light and standalone system Small memory footprint Multi platform –Linux, Windows, Mac OSX, …

6. Oct. 2004Stefan Roiser7 Reflection Model Type TypeBase Scope ScopeBase Member Class PropertyList … Function Typedef Reference Pointer Namespace InstTemplate TemplFamily InstTFunction InstTClass

6. Oct. 2004Stefan Roiser8 Reflection Use Cases const Type * t = Type::byName(“Particle”); size_t s = t->sizeOf(); bool t = t->isClass(); Types –Retrieve a specific type –Introspect the actual type

6. Oct. 2004Stefan Roiser9 Reflection Use Cases (ctd.) Classes –Inspect inheritance tree –Create / delete instances const Class * c = t->asClass(); const Base * b = c->base(0); Object o = c->construct(); c->destruct(o);

6. Oct. 2004Stefan Roiser10 Reflection Use Cases (ctd.) Data Members –Get / set values –Retrieve offset relative to beginning of class const DataMember * dm = c->dataMember(0); double d = *(double*) dm->get(v); size_t s2 = dm->offset();

6. Oct. 2004Stefan Roiser11 Reflection Use Cases (ctd.) const FunctionMember * fm = c->functionMember(0); const Type * rt = fm->type()->asFunction()->returnType(); void * r = fm->invoke(o); Function Members –Inspect return and parameter types –Invoke a function and retrieve return values

6. Oct. 2004Stefan Roiser12 Reflection Use Cases (ctd.) All Types –Reference, Pointer, PointerToMember, Array, Enum, Union, Fundamental, Class, Function Typedefs Scopes –Search scopes –Retrieve scopes Additional Properties –For Types, Scopes and Members –Everything that does not fit ISO standard –Any type supported CV qualifiers Templates –Inspect families –Look for instantiations

6. Oct. 2004Stefan Roiser13 System Overview.h _dict.cpp gcc_xml. xml gendict.py lcgdict.xml Type Selection make.so.cpp _dict.so make Reflex.so User Program

6. Oct. 2004Stefan Roiser14 [lxplus]~> Dictionary Creation #include “Particle.h” class Particle_dict { public: Particle_dict(); }; void* stubfun(void* o) { return (void*)((Particle*)o)->mass(); } Particle_dict::Particle_dict() { ClassBuilder (“Particle”).addDataMember (”m_mass”,Offset(Particle,m_mass),PRIVATE).addFunctionMember (”mass”,&stubfun,0,0,PUBLIC); } static Particle_dict instance; [lxplus]~> lcgdict Particle.h -s selection.xml --reflex -I../incl[lxplus]~> lcgdict Particle.h -s selection.xml --reflex -I../incl Parsing File Particle.h with GCC_XML OK Generating LCG Dictionary (reflex) class Particle [lxplus]~> lcgdict Particle.h -s selection.xml --reflex -I../incl Parsing File Particle.h with GCC_XML OK Generating LCG Dictionary (reflex) class Particle [lxplus]~> ls Particle.h Particle.xml Particle_dict.cpp [lxplus]~>

6. Oct. 2004Stefan Roiser15 gcc_xml “[…] generate an XML description of a C++ program from GCC's internal representation.” Any gcc compilable program can be used as input lcgdict uses the XML file to produce dictionary files

6. Oct. 2004Stefan Roiser16 Library Sizes SEAL ROOT Dictionary: 405 classes

6. Oct. 2004Stefan Roiser17 Library Sizes (ctd.) CLHEP Dictionary : 56 classes

6. Oct. 2004Stefan Roiser18 Status Reflex - new version will be released with SEAL 1_4_2 and 1_5_2 –In collaboration with the ROOT team –Idea is common LCG & ROOT dictionary –Several enhancements References, Enums, Unions, Typedefs, … –Closer to ISO standard

6. Oct. 2004Stefan Roiser19 Future Enhancements Template types –Full implementation needed Measuring the memory footprint –Instructing new / delete –Counting instances Unloading libraries –Proper deletion of types / scopes

6. Oct. 2004Stefan Roiser20 Future Enhancements (ctd.) Missing Builders –UnionBuilder, EnumBuilder STL like iterators –In addition to current implementation String parser –Could be used when building types

6. Oct. 2004Stefan Roiser21 Integration with LCG SW POOL –Reflex provides sufficient functionality –Integration foreseen SEAL Scripting –PyLCGDict will become PyReflex –Work has already started

6. Oct. 2004Stefan Roiser22 Integration with ROOT For ROOT I/O –ROOT Meta Classes (e.g. TClass, TMethod) may be implemented using Reflex –Check of sufficient functionality needed For interactive ROOT (CINT) –Creation of CINT data structures needed –Equivalent to existing CINT/Lcgdict gateway in POOL Easy for data members Function members not so straight forward

6. Oct. 2004Stefan Roiser23 Integration with ROOT.h lcgdict _dict.so rootcint CINT cint.so Reflex ROOT CINT DS TDictionary Current Situation Reflex DS

6. Oct. 2004Stefan Roiser24 Integration with ROOT.h lcgdict _dict.so rootcint CINT cint.so Reflex ROOT CINT DS Enabling ROOT I/O Reflex DS

6. Oct. 2004Stefan Roiser25 Integration with ROOT.h lcgdict _dict.so rootcint CINT cint.so Reflex ROOT CINT DS Reflex DS Enabling ROOT I/O & interactive CINT

6. Oct. 2004Stefan Roiser26 Integration with ROOT.h lcgdict _dict.so rootcint CINT cint.so Reflex ROOT Common DS Final Goal

6. Oct. 2004Stefan Roiser27 CHEP ‘04 Other projects showed interest –FreeHEP Java Library –Panoramix Improving Standard C++ –Compile time reflection wanted feature –No proposal for the time being Summary talk of Core Software –Propose reflection as part of ISO standard

6. Oct. 2004Stefan Roiser28 SW packages Reflection library –Current implementation Reflection, ReflectionBuilder –New model Reflex DictionaryGenerator –Produce dictionary files for both versions Dictionaries CLHEP, STL, ROOT –Standard dictionaries ready to use

6. Oct. 2004Stefan Roiser29 Conclusion SEAL Dictionaries –Light, standalone system –Non intrusive, automated code production –Dictionaries for any gcc compileable program New system - Reflex - ready for integration –In collaboration with ROOT –Common LCG/ROOT dictionary envisaged –Several enhancements, closer to ISO std –Positive feedback from CHEP’04

6. Oct. 2004Stefan Roiser30 Pointers The SEAL project – CVS repository –SEAL.cvs.cern.ch:/cvs/SEAL/Dictionary access: kserver, ssh, (anonymous) pserver gcc_xml –