Automated support of STL containers

Slides:



Advertisements
Similar presentations
Chapter 19 Vectors, templates, and exceptions Bjarne Stroustrup
Advertisements

Chapter 18 Vectors and Arrays
Introduction to C++ Templates Speaker: Bill Chapman, C++ developer, financial company in Mid-Manhattan. Can be reached via: ' This.
Chapter 18 Vectors and Arrays John Keyser’s Modification of Slides by Bjarne Stroustrup
Dynamic Memory Allocation (also see pointers lectures) -L. Grewe.
Introduction to Programming Lecture 39. Copy Constructor.
Template class Wrapper { public: T* operator->() { return &myT; } private: T myT; }; int main() { Wrapper wThing; wThing- >Foo(); // calls Thing::Foo()...
OOP Project Develop an Application which incorporates the following OO Mechanisms and Principals: – Classes Visibility Constructor(s) Class Variable (if.
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
XML I/O in ROOT S. Linev, R. Brun, H.G. Essel CHEP 2004.
Introduction to C++. Overview C++? What are references Object orientation Classes Access specifiers Constructor/destructor Interface-implementation separation.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
STAR C OMPUTING Maker and I/O Model in STAR Victor Perevoztchikov.
Memory Management CS Chakrabarti Variable storage thus far  Never used global variables  All variables allocated inside functions, passed.
Object-Oriented Programming in C++
Memory Management Issues, Solutions, and Examples.
C++ Memory Overview 4 major memory segments Key differences from Java
Introduction to C#. Why C#? Develop on the Following Platforms ASP.NET Native Windows Windows 8 / 8.1 Windows Phone WPF Android (Xamarin) iOS (Xamarin)
GAM 200 Club. How to Game Engine GAM 200 Club Zachary Nawar.
STAR Event data storage and management in STAR V. Perevoztchikov Brookhaven National Laboratory,USA.
STAR Schema Evolution Implementation in ROOT I/O V. Perevoztchikov Brookhaven National Laboratory,USA.
STAR STAR MC Filter V. Perevoztchikov Brookhaven National Laboratory,USA.
General Purpose ROOT Utilities Victor Perevoztchikov, BNL.
9/28/2005Philippe Canal, ROOT Workshop TTree / SQL Philippe Canal (FNAL) 2005 Root Workshop.
More about Java Classes Writing your own Java Classes More about constructors and creating objects.
PROGRAMMING 1 – HELPER INSTRUCTIONS ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED BY NANCY M. AMATO AND JORY DENNY 1.
Chapter 17 – Templates. Function Templates u Express general form for a function u Example: template for adding two numbers Lesson 17.1 template Type.
STAR Persistent Pointers in the STAR Micro-DST V. Perevoztchikov Brookhaven National Laboratory,USA.
STAR Simulation. Status and plans V. Perevoztchikov Brookhaven National Laboratory,USA.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 20 – C++ Subclasses and Inheritance.
Variables, Operators, and Expressions
CS212: Object Oriented Analysis and Design
“Generic Programming” ECE 297
Computer Organization and Design Pointers, Arrays and Strings in C
Learning Objectives Pointers as dada members
Classes (Part 1) Lecture 3
User-Written Functions
Overview 4 major memory segments Key differences from Java stack
Possibility of XML I/O support in ROOT
C++ Templates.
Templates.
A bit of C programming Lecture 3 Uli Raich.
UNIT – I Linked Lists.
objects CIS 421 Kutztown University
Arrays in C.
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Data Representation Methods
Overview 4 major memory segments Key differences from Java stack
Introduction to the Standard Template Library
Data Representation Methods
Brought to you by C++ Tutorial Brought to you by
תירגול 9 אובייקטים.
Recent Developments in ROOT I/O Support for foreign classes
CSE 451: Operating Systems Autumn 2004 BSD UNIX Fast File System
Doubly Linked List Implementation
Object-Oriented Programming (OOP) Lecture No. 37
The Standard Template Library
ArrayLists 22-Feb-19.
CSE 451: Operating Systems Winter Module 15 BSD UNIX Fast File System
CSE 333 – Section 10 Final Review.
Objects Managing a Resource
Use of Root I/O Trees for CMS Crossings
CSE 373 Data Structures and Algorithms
Data Representation Methods
Data Representation Methods
ENERGY 211 / CME 211 Lecture 30 December 5, 2008.
Doubly Linked List Implementation
CSE 451: Operating Systems Winter Module 15 BSD UNIX Fast File System
CSE 373: Data Structures and Algorithms
B+-trees In practice, B-trees are not used much as defined earlier.
Presentation transcript:

Automated support of STL containers V. Perevoztchikov Brookhaven National Laboratory,USA

What is the PROBLEM? Current ROOT can write/read STL containers, but differently than native ROOT containers, like TClonesArray or TObjArray. Why? For each instance of STL container special wrapper is generated by rootcint; To read STL container, the same library must be loaded, which was used for writing; There is no general way to split them, as it is possible for TClonesArray; There is no general way to navigate,increase,decrease,read and write STL containers in ROOT. To improve this, special approach was developed. Only for two of. them, vector and list, it is possible. But these two are the most. important. Victor Perevoztchikov, BNL ROOT2002

Direct access to STL containers Direct access to STL containers is a method to add, remove, increase, decrease container without using templates. This is enough for a general I/O. In the current design only vector and list are implemented. Details: Special helper classes TSTLCont and TSTLIter were developed; Initialization by text descriptor like “vector<TNamed>” and by void* or void** as a pointer to object; Methods Resize(int),At(int),… represent according STL methods. All constructors and destructors of objects inside container are called properly; Method Streamer(TBuffer &) provides ROOT I/O for container, not for helper class itself; Methods New() and Delete() for new and delete of container. Victor Perevoztchikov, BNL ROOT2002

Implementation details. Inside of helper classes TSTLCont and TSTLIter real containers are casted to vector<char> and list<char> . All the differences between these simple containers and real ones is accounted inside of helpers. All work with the objects inside of container performed via TClass etc… company. So these classes should be in ROOT dictionary; For list container memory allocated for objects is bigger then it really needs. In average it is bigger in 1.5 times, which is not too big penalty. Victor Perevoztchikov, BNL ROOT2002

TTree improvements. TTRee family of classes was modified, to introduce new functionality: vector and list containers could be written into TTree in split mode, exactly as TClonesArray. For reading no need anymore to load library used in writing; These STL containers are more general then TClonesArray. They could contain not only Tobject* pointers , but pointers to any classes, any classes itself, and even simple objects like int, float, double etc…; TTree::Draw() , TTree::MakeClass etc…can work with STL classes exactly as with TClonesArray but in more general way. Victor Perevoztchikov, BNL ROOT2002

Conclusions The helper classes TSTLCont and TSTLIter to support ROOT I/O for STL containers were developed; There is no more need to generate multiple wrappers for each instance of STL container; No need to load special library with wrappers; STL containers could be splitted like TClonesArray This spliting mechanism works not only for TOBject* pointers but for pointers to any classes, classes itself and simple objects like int,float, etc… Victor Perevoztchikov, BNL ROOT2002