The SEAL C++ Reflection System Stefan Roiser (for the LCG/SEAL Dictionary work package) CHEP 2004, 27. Sept. - 1. Oct., Interlaken.

Slides:



Advertisements
Similar presentations
What's new in Microsoft Visual C Preview
Advertisements

Reflex Dictionary Generator Antti Hahto
Seal Dictionary Applications Area Internal Review 20 October 2003 Stefan Roiser / CERN.
SEAL Reflex, the new Reflection Library Stefan Roiser (for the LCG/SEAL Dictionary work package) LCG Applications Area Meeting, Oct. 6, 2004.
Lecture 9 Concepts of Programming Languages
 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.
 2007 Pearson Education, Inc. All rights reserved C++ as a Better C; Introducing Object Technology.
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.
David Adams ATLAS ATLAS Distributed Analysis David Adams BNL March 18, 2004 ATLAS Software Workshop Grid session.
K. Harrison CERN, 20th April 2004 AJDL interface and LCG submission - Overview of AJDL - Using AJDL from Python - LCG submission.
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.
1 21 COP 3540 Data Structures with OOP Overview: Chapter 1.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
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.
W. Pokorski - CERN Simulation Project1 Python binding for Geant4 toolkit using Reflex/PyROOT tool Witek Pokorski EuroPython 2006, CERN, Geneva
David Adams ATLAS Architecture for ATLAS Distributed Analysis David Adams BNL March 25, 2004 ATLAS Distributed Analysis Meeting.
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,
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
SEAL Core Libraries and Services CLHEP Workshop 28 January 2003 P. Mato / CERN Shared Environment for Applications at LHC.
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.
- Athena Data Dictionary (28nov00 - SW CERN) Athena Data Dictionary Craig E. Tull HCG/NERSC/LBNL Software CERN November 28,
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 16: Introduction to C++
Feedback from LHC Experiments on using CLHEP Lorenzo Moneta CLHEP workshop 28 January 2003.
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.
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.
Object-Oriented Programming (OOP) and C++
David Adams ATLAS ATLAS Distributed Analysis and proposal for ATLAS-LHCb system David Adams BNL March 22, 2004 ATLAS-LHCb-GANGA Meeting.
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.
Status of SEAL LCG Applications Area Meeting 22 July 2003 P. Mato / CERN Contents Overview Work Packages Status Summary.
Introduction to C++ programming Recap- session 1 Structure of C++ program Keywords Operators – Arithmetic – Relational – Logical Data types Classes and.
Object Based Programming Chapter 8. 2 Contrast ____________________ Languages –Action oriented –Concentrate on writing ________________ –Data supports.
5th MaCS Debrecen On the Turing-Completeness of Generative Metaprograms Zoltán Porkoláb, István Zólyomi Dept. of Programming.
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
Templates.
Event Data Definition in LHCb
Review: Two Programming Paradigms
Geant4 Geometry Objects Persistency using ROOT
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
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.
Name: Rubaisha Rajpoot
Classes, Constructors, etc., in C++
SEAL Project Core Libraries and Services
Object Oriented Programming
Presentation transcript:

The SEAL C++ Reflection System Stefan Roiser (for the LCG/SEAL Dictionary work package) CHEP 2004, 27. Sept Oct., Interlaken

27. Sept. Content Reflection and C++ The Model Use Cases Production of reflection information Packages and users Status and Conclusion

27. Sept. 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

27. Sept. 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);

27. Sept. 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 proposes XTI (eXtended Type Information) as inherent extension

27. Sept. 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, …

27. Sept. Reflection Model Type TypeBase Scope ScopeBase Member Class PropertyList … Function Typedef Reference Pointer Namespace InstTemplate TemplFamily InstTFunction InstTClass

27. Sept. 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

27. Sept. 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);

27. Sept. 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();

27. Sept. 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

27. Sept. Reflection Use Cases (ctd.) More Types –Reference, Pointer, PointerToMember, Array, Enum, Union, Fundamental Typedefs Scopes –Search scopes –Retrieve Base-/ Subscopes 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

27. Sept. System Overview.h _dict.cpp gcc_xml. xml gendict.py lcgdict.xml Type Selection make.so.cpp _dict.so make Reflex.so User Program

27. Sept. [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 -I/my/include[lxplus]~> lcgdict Particle.h -s selection.xml -I/my/include Parsing File Particle.h with GCC_XML OK Generating LCG Dictionary class Particle [lxplus]~> lcgdict Particle.h -s selection.xml -I/my/include Parsing File Particle.h with GCC_XML OK Generating LCG Dictionary class Particle [lxplus]~> ls Particle.h Particle.xml Particle_dict.cpp [lxplus]~>

27. Sept. 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

27. Sept. Status Current version - Reflection(Builder) - in production –POOL & SEAL PyLCGDict Prototype of new version - Reflex - released –In collaboration with the ROOT team –The idea is a common dictionary of LCG & ROOT –Several enhancements (e.g. references, enums) –Closer to ISO standard

27. Sept. Users POOL –The LCG project for persistence of objects (#381, D. Duellmann, Wed , Core SW) SEAL PyLCGDict –Python binding to the Reflection system (#494, W. Lavrijsen, Mon , Core SW) SUN Microsystems –Porting to SUN forte compiler

27. Sept. 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

27. Sept. Conclusion SEAL Dictionaries extend C++ RTTI –Light, standalone system –Non intrusive, automated code production –Dictionaries for any gcc compileable program New system ready for integration –In collaboration with ROOT –Several enhancements, closer to ISO std. Current version in production

27. Sept. Pointers The SEAL project – CVS repository –SEAL.cvs.cern.ch:/cvs/SEAL/Dictionary access: kserver, ssh, (anonymous) pserver gcc_xml –