Back to the POOL home page
Back to the Tutorial top page

Learning POOL by examples: Simple navigation


Description

The aim of this example is to demonstrate the basic object navigation using the POOL Ref< T > class as embedded objects in a persistent class.

The user creates a class library which contains the implementation of a Hit class, which is associated to a Digit class via an embedded Ref< Digit > data member, runs the LCG dictionary for these classes and builds the corresponding dictionary run time library.
A simple writer application writes Hits and Digits in different containers of a database file which are specified in the program. Hits and Digits are written using ROOT Key and ROOT Tree technology respectively. The reader starts an iteration in the implicit collection of Hit objects defined by the database/container specified in the writer and prints the contents of each Hit together with the contents of its associated Digit.
The writer and reader applications are linked against the user class library. The dictionary library is explicitly loaded during run time.

Files

Building and running

Make sure that you are using the correct compiler. If you are not using the afs installation at CERN, make sure you update accordingly the corresponding values in the GNUmakefile or/and the shell script.

The make file provides the following targets:
runreader reader runwriter writer dictlib userlib and clean.
The simplest way to build and execute everything in one go is by typing:.
make runwriter runreader

Extend this example


Contact : Ioannis Papadopoulos, IT Department, CERN.