Tomato
OxFactoryOfModels.hxx
1 
7 #ifndef Tomato_OXFACTORYOFFUNCTIONS_HXX
8 #define Tomato_OXFACTORYOFFUNCTIONS_HXX
9 
10 #include "OxModelT1ThreeParam.h"
11 #include "OxModelT1TwoParam.h"
12 #include "OxModelT1Shmolli.h"
13 #ifdef USE_PRIVATE_NR2
14 #include "OxModelT2ThreeParam.h"
15 #include "OxModelT2TwoParam.h"
16 #include "OxModelT2TwoParamScale.h"
17 #include "OxModelT2OneParam.h"
18 #endif
19 
20 namespace Ox {
21  template < typename TYPE >
22  Model<TYPE>*
23  FactoryOfModels<TYPE>
24  ::newByFactory(TomatoOptions<TYPE> *opts){
25  switch (opts->model_type){
26  case _ModelT1ThreeParam: {
27  return new ModelT1ThreeParam<TYPE>();
28  }
29  case _ModelT1TwoParam: {
30  return new ModelT1TwoParam<TYPE>();
31  }
32  case _ModelT1Shmolli: {
33  return new ModelT1Shmolli<TYPE>();
34  }
35 #ifdef USE_PRIVATE_NR2
36  case _ModelT2ThreeParam: {
37  return new ModelT2ThreeParam<TYPE>();
38  }
39  case _ModelT2TwoParam: {
40  return new ModelT2TwoParam<TYPE>();
41  }
42  case _ModelT2TwoParamScale: {
43  return new ModelT2TwoParamScale<TYPE>();
44  }
45  case _ModelT2OneParam: {
46  return new ModelT2OneParam<TYPE>();
47  }
48 #endif
49  default:
50  throw std::runtime_error("model_type not available");
51  }
52  }
53 
54  template < typename TYPE >
55  void
56  FactoryOfModels<TYPE>
57  ::disp(int model_type){
58 
59  if (model_type >= 0) {
60  printf("%-28s%-22s", " model_type: ", modelTypeNames[model_type]);
61  }
62 
63  printf("options: [ ");
64 
65  for (int i = 0; i < lastFunctorType+1; i++){
66 
67  if(modelAvailability[i]){
68  printf("%s ", modelTypeNames[i]);
69  }
70  }
71 
72  printf("] \n");
73  }
74 
75 } // namespace Ox
76 
77 #endif //Tomato_OXFACTORYOFFUNCTIONS_HXX
Definition: OxCalculator.h:19