StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St_table_header_Table.cxx
1 //*-- Author : Valery Fine(fine@bnl.gov) 11/07/99
2 // $Id: St_table_header_Table.cxx,v 1.6 2000/07/06 16:33:11 fine Exp $
3 //
4 #include "St_table_header_Table.h"
6 // //
7 // Class St_table_header creates and fills the STAF "table header" //
8 // to call STAF module (pams) properly //
9 // //
11 
12 #include "Stypes.h"
13 
14 TTableDescriptor *St_table_header::fgColDescriptors = 0;
15 TableClassImp(St_table_header,table_head_st)
16 
17 //______________________________________________________________________________
19  : TTable("table_header",1,sizeof(table_head_st))
20 {
21  SetType("table_header");
22  table_head_st header;
23  *header.name = 0;
24  *header.type = 0;
25  strncat(header.name,table->GetName(),sizeof(header.name)); // table name
26  strncat(header.type,table->GetType(),sizeof(header.type)); // table type
27  header.maxlen = table->GetTableSize(); // # rows allocated
28  header.nok = table->GetNRows(); // # rows filled */
29  header.rbytes = table->GetRowSize(); // # bytes per row
30  header.dsl_pointer = long(table); // back pointer to table
31  header.data_pointer = 0; // Unused
32  AddAt(&header,0);
33 }
34 
35 //______________________________________________________________________________
36 void *ReAllocate(table_head_st *header, Int_t newsize)
37 {
38  //
39  // header - "plain" C interface to re-allocate the STAF table
40  // "this" pointer is supplied indirectly via
41  // header->dsl_pointer member
42  //
43  // newsize - is a new size of the STAF table.
44  // If it is smaller is the old one then nothing happens
45  //
46  void *newTable = 0;
47  if (header && newsize) {
48  newTable = ((TTable *)header->dsl_pointer)->ReAllocate(newsize);
49  // update the counter
50  header->maxlen = ((TTable *)header->dsl_pointer)->GetTableSize(); // # rows allocated
51  }
52  return newTable;
53 }
54 
55 
56 //______________________________________________________________________________
57 // $Log: St_table_header_Table.cxx,v $
58 // Revision 1.6 2000/07/06 16:33:11 fine
59 // Bug fix: St_table_header::ReAllocate(). Thanks Iwona
60 //
61 // Revision 1.5 2000/04/13 23:12:07 fine
62 // Bug fix
63 //
64 // Revision 1.4 2000/03/30 05:20:52 fine
65 // bug fixed
66 //
67 // Revision 1.3 2000/03/29 20:39:18 fine
68 // bug fix
69 //
70 // Revision 1.2 2000/03/27 00:34:04 fine
71 // function ReAllocate and method TTable::Object have been move to St_table_head class
72 //
73 // Revision 1.1 2000/03/23 17:58:13 fine
74 // new class to hold STAF table header aside
75 //
76 //______________________________________________________________________________
77 
char type[20]
Definition: table_header.h:13
virtual Long_t GetRowSize() const
Returns the size (in bytes) of one table row.
Definition: TTable.cxx:1395
virtual const Char_t * GetType() const
Returns the type of the wrapped C-structure kept as the TNamed title.
Definition: TTable.cxx:1444
virtual Long_t GetNRows() const
Returns the number of the used rows for the wrapped table.
Definition: TTable.cxx:1388
char name[20]
Definition: table_header.h:12
virtual Long_t GetTableSize() const
Returns the number of the allocated rows.
Definition: TTable.cxx:1402
Definition: TTable.h:48