FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairParIo.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 //*-- AUTHOR : Ilse Koenig
9 //*-- Created : 20/10/2004
10 
12 // FairParIo
13 //
14 // Base class for different parameter input/output sources:
15 // Rootfiles, Asciifiles, Oracle
16 // It contains a list of detector I/Os.
18 
19 #include "FairParIo.h"
20 
21 #include "FairDetParIo.h" // for FairDetParIo
22 
23 #include <TCollection.h> // for TIter
24 #include <TList.h> // for TList
25 
26 using namespace std;
27 
29 
31  : TObject()
32  , detParIoList(new TList())
33  , autoWritable(kTRUE)
34  , filename("")
35 {
36  // default constructor creates an empty list of detector I/Os
37  // detParIoList=new TList();
38  // autoWritable=kTRUE;
39 }
40 
42 {
43  // default destructor
44  if (detParIoList) {
45  detParIoList->Delete();
46  delete detParIoList;
47  detParIoList = 0;
48  }
49 }
50 
52 {
53  // stores pointer of the input/output class for a detector
54  // used for I/O from ROOT file or Ascii file
55  const Text_t* detName = detParIo->GetName();
56  if (!detParIoList->FindObject(detName)) {
57  detParIoList->Add(detParIo);
58  }
59 }
60 
62 {
63  // sets in all detector I/Os the number of the input
64  TIter next(detParIoList);
65  FairDetParIo* io;
66  while ((io = static_cast<FairDetParIo*>(next()))) {
67  io->setInputNumber(num);
68  }
69 }
70 
71 FairDetParIo* FairParIo::getDetParIo(const Text_t* detName)
72 {
73  // returns pointer to input/output class for a detector
74  // std::cout << " DetParIO # " << detName << detParIoList->GetEntries() << std::endl;
75  return (static_cast<FairDetParIo*>(detParIoList->FindObject(detName)));
76 }
77 
78 void FairParIo::removeDetParIo(Text_t* detName)
79 {
80  // removes input/output class for a detector
81  TObject* p = detParIoList->FindObject(detName);
82  delete p;
83  p = 0;
84 }
void setInputNumber(Int_t)
Definition: FairParIo.cxx:61
void setInputNumber(Int_t n)
Definition: FairDetParIo.h:26
ClassImp(FairEventBuilder)
virtual void removeDetParIo(Text_t *)
Definition: FairParIo.cxx:78
TList * detParIoList
Definition: FairParIo.h:22
virtual FairDetParIo * getDetParIo(const Text_t *)
Definition: FairParIo.cxx:71
virtual void setDetParIo(FairDetParIo *)
Definition: FairParIo.cxx:51
virtual ~FairParIo()
Definition: FairParIo.cxx:41