1. Create a new table structure

Create in your workdirectory the directory "StDb/idl/"
Create a new ".idl"-file with the structure of your new table. (For example: $STAR/StDb/idl/ssdConfiguration.idl)
Name the file ssdExample.idl
Do a const +StDb
In this example the structure has 3 entries: example_id;

2. Use the new table structure in the code

The new table has to be included into the c++-code.
Just call at the beginning of your code the line: #include "tables/St_ssdExample_Table.h"
Define a new table, which can be used with:
St_ssdExample *example_tableSet = new St_ssdExamplelocal("ssdExample",NumberOfRows); // NumberOfRows is the number of the table lines; e.g. 320 in case of wafers
Then define a variable(structure of the table) which will be filled into the table:
ssdExample_st example_row; // Be carefull, this is not! a pointer
Now fill this variable:
for(int i=0; i<NumberOfRows; i++)
example_row.example_id = 1;
example_row.example_x = 34;
example_tableSet->AddAt(&example_row); // carefull: parameter given by reference; now an additional line into the table is added

2. Later read out the table

St_DataSet *svtparams = GetInputDB("svt");
St_DataSetIter local(svtparams);
St_ssdExample* example_table = (St_ssdExample*)local("ssd/ssdExample");
ssdExample_st example = example_table->GetTable(); // Gets the whole information of the table and puts it into example
with example->GetNRows() you can loop over all the entries in the datatable

Last modified: Wed Jun 15 09:26:44 CEST 2005