CbmBftcContFact.cxx 1.95 KB
Newer Older
Eoin Clerkin's avatar
Eoin Clerkin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/********************************************************************************
 *    Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH    *
 *                                                                              *
 *              This software is distributed under the terms of the             * 
 *              GNU Lesser General Public Licence (LGPL) version 3,             *  
 *                  copied verbatim in the file "LICENSE"                       *
 ********************************************************************************/
#include "CbmBftcContFact.h"

#include "CbmBftcGeoPar.h"

#include "FairRuntimeDb.h"

#include <iostream>

ClassImp(CbmBftcContFact)

static CbmBftcContFact gCbmBftcContFact;

CbmBftcContFact::CbmBftcContFact()
  : FairContFact()
{
  /** Constructor (called when the library is loaded) */
  fName="CbmBftcContFact";
  fTitle="Factory for parameter containers in libCbmBftc";
  setAllContainers();
  FairRuntimeDb::instance()->addContFactory(this);
}

void CbmBftcContFact::setAllContainers()
{
  /** Creates the Container objects with all accepted
      contexts and adds them to
      the list of containers for the CbmBftc library.
  */

  FairContainer* p= new FairContainer("CbmBftcGeoPar",
                                      "CbmBftc Geometry Parameters",
                                      "TestDefaultContext");
  p->addContext("TestNonDefaultContext");

  containers->Add(p);
}

FairParSet* CbmBftcContFact::createContainer(FairContainer* c)
{
  /** Calls the constructor of the corresponding parameter container.
      For an actual context, which is not an empty string and not
      the default context
      of this container, the name is concatinated with the context.
  */
  const char* name=c->GetName();
  FairParSet* p=NULL;
  if (strcmp(name,"CbmBftcGeoPar")==0) {
    p=new CbmBftcGeoPar(c->getConcatName().Data(),
                            c->GetTitle(),c->getContext());
  }
  return p;
}