FairPassiveContFact.cxx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 version 3 (LGPL) version 3, *
  6. * copied verbatim in the file "LICENSE" *
  7. ********************************************************************************/
  8. //*-- AUTHOR : Denis Bertini
  9. //*-- Created : 21/06/2005
  10. /////////////////////////////////////////////////////////////
  11. //
  12. // FairPassiveContFact
  13. //
  14. // Factory for the parameter containers in libPassive
  15. //
  16. /////////////////////////////////////////////////////////////
  17. #include "FairPassiveContFact.h"
  18. #include "FairGeoPassivePar.h" // for FairGeoPassivePar
  19. #include "FairRuntimeDb.h" // for FairRuntimeDb
  20. #include "TList.h" // for TList
  21. #include "TString.h" // for TString
  22. #include <string.h> // for strcmp, NULL
  23. class FairParSet;
  24. using namespace std;
  25. ClassImp(FairPassiveContFact)
  26. static FairPassiveContFact gFairPassiveContFact;
  27. FairPassiveContFact::FairPassiveContFact()
  28. : FairContFact()
  29. {
  30. // Constructor (called when the library is loaded)
  31. fName="FairPassiveContFact";
  32. fTitle="Factory for parameter containers in libPassive";
  33. setAllContainers();
  34. FairRuntimeDb::instance()->addContFactory(this);
  35. }
  36. void FairPassiveContFact::setAllContainers()
  37. {
  38. /** Creates the Container objects with all accepted contexts and adds them to
  39. * the list of containers for the STS library.*/
  40. FairContainer* p= new FairContainer("FairGeoPassivePar",
  41. "Passive Geometry Parameters",
  42. "TestDefaultContext");
  43. p->addContext("TestNonDefaultContext");
  44. containers->Add(p);
  45. }
  46. FairParSet* FairPassiveContFact::createContainer(FairContainer* c)
  47. {
  48. /** Calls the constructor of the corresponding parameter container.
  49. * For an actual context, which is not an empty string and not the default context
  50. * of this container, the name is concatinated with the context. */
  51. const char* name=c->GetName();
  52. FairParSet* p=NULL;
  53. if (strcmp(name,"FairGeoPassivePar")==0) {
  54. p=new FairGeoPassivePar(c->getConcatName().Data(),c->GetTitle(),c->getContext());
  55. }
  56. return p;
  57. }