|
11 | 11 | * or submit itself to any jurisdiction. * |
12 | 12 | ******************************************************************************/ |
13 | 13 |
|
14 | | -#include "FairParSet.h" |
15 | | -#include "FairRuntimeDb.h" |
| 14 | +#include <FairParSet.h> |
| 15 | +#include <FairRuntimeDb.h> |
16 | 16 |
|
17 | 17 | #include "R3BLogger.h" |
18 | 18 | #include "R3BTCalContFact.h" |
19 | 19 | #include "R3BTCalPar.h" |
20 | 20 |
|
21 | | -#include "TList.h" |
22 | | -#include <string.h> |
23 | | - |
24 | 21 | static R3BTCalContFact gR3BTCalContFact; |
25 | 22 |
|
26 | 23 | R3BTCalContFact::R3BTCalContFact() |
27 | 24 | { |
28 | 25 | // Constructor (called when the library is loaded) |
29 | 26 | fName = "R3BTCalContFact"; |
30 | | - fTitle = "Tutorial factory for parameter containers"; |
| 27 | + fTitle = "Factory for TCal parameter containers"; |
31 | 28 | setAllContainers(); |
32 | 29 | FairRuntimeDb::instance()->addContFactory(this); |
33 | 30 | } |
34 | 31 |
|
35 | 32 | void R3BTCalContFact::addContainer(TString name, TString description) |
36 | 33 | { |
37 | | - auto container = new FairContainer(name, description, "TestDefaultContext"); |
38 | | - container->addContext("TestNonDefaultContext"); |
39 | | - containers->Add(container); |
| 34 | + auto container = std::make_unique<FairContainer>(name.Data(), description.Data(), "DefaultContext"); |
| 35 | + containers->Add(container.release()); |
40 | 36 | } |
41 | 37 |
|
42 | 38 | void R3BTCalContFact::setAllContainers() |
43 | | -{ |
44 | | - /** Creates the Container objects with all accepted contexts and adds |
45 | | - * them to the list of containers.*/ |
| 39 | +{ /** |
| 40 | + ** Creates the Container objects with all accepted contexts and adds |
| 41 | + ** them to the list of containers. |
| 42 | + **/ |
46 | 43 | addContainer("LandTCalPar", "NeuLAND TCAL Calibration Parameters"); |
47 | 44 | addContainer("LosTCalPar", "LOS TCAL Calibration Parameters"); |
48 | 45 | addContainer("RoluTCalPar", "ROLU TCAL Calibration Parameters"); |
@@ -81,13 +78,13 @@ void R3BTCalContFact::setAllContainers() |
81 | 78 | } |
82 | 79 |
|
83 | 80 | FairParSet* R3BTCalContFact::createContainer(FairContainer* c) |
84 | | -{ |
85 | | - /** Calls the constructor of the corresponding parameter container. |
86 | | - * For an actual context, which is not an empty string and not the default context |
87 | | - * of this container, the name is concatinated with the context. */ |
88 | | - |
89 | | - const char* name = c->GetName(); |
90 | | - R3BLOG(info, name); |
| 81 | +{ /** |
| 82 | + ** Calls the constructor of the corresponding parameter container. For an |
| 83 | + ** actual context, which is not an empty string and not the default context |
| 84 | + ** of this container, the name is concatinated with the context. |
| 85 | + **/ |
| 86 | + const std::string name(c->GetName()); |
| 87 | + R3BLOG(info, "Create container name: " << name.c_str()); |
91 | 88 |
|
92 | 89 | containerNames.push_back("LandTCalPar"); |
93 | 90 | containerNames.push_back("LosTCalPar"); |
@@ -125,25 +122,14 @@ FairParSet* R3BTCalContFact::createContainer(FairContainer* c) |
125 | 122 | PUSH_FIBER(Fi32); |
126 | 123 | PUSH_FIBER(Fi33); |
127 | 124 |
|
128 | | - // bool found = false; |
129 | 125 | for (auto containerName : containerNames) |
130 | 126 | { |
131 | | - if (strncmp(name, containerName, strlen(containerName)) == 0) |
| 127 | + if (name == containerName) |
132 | 128 | { |
133 | | - // found = true; |
134 | | - // break; |
135 | 129 | return new R3BTCalPar(c->getConcatName().Data(), c->GetTitle(), c->getContext()); |
136 | 130 | } |
137 | 131 | } |
138 | | - |
139 | | - /* if (found == true) |
140 | | - { |
141 | | - return new R3BTCalPar(c->getConcatName().Data(), c->GetTitle(), c->getContext()); |
142 | | - } |
143 | | - else |
144 | | - {*/ |
145 | 132 | return nullptr; |
146 | | - // } |
147 | 133 | } |
148 | 134 |
|
149 | | -ClassImp(R3BTCalContFact); |
| 135 | +ClassImp(R3BTCalContFact) |
0 commit comments