GEMC  1.8
Geant4 Monte-Carlo Framework
material_factory.cc
Go to the documentation of this file.
1 // %%%%%%%%%%%%
2 // GEMC headers
3 // %%%%%%%%%%%%
4 #include "material_factory.h"
5 #include "cpp_materials.h"
6 #include "mysql_materials.h"
7 
8 materials *getMaterialFactory(map<string, materialFactory> *factory, string materialsMethod)
9 {
10 
11  if(factory->find(materialsMethod) == factory->end())
12  {
13  cout << endl << endl << " >>> WARNING: " << materialsMethod << " NOT FOUND IN Material Factory Map." << endl;
14  return NULL;
15  }
16 
17  return (*factory)[materialsMethod]();
18 }
19 
20 map<string, materialFactory> registerMaterialFactories()
21 {
22 
23  map<string, materialFactory> materialMethodMap;
24 
25 
26  // CPP initialization
27  // cout << " Registering Material Factory: cpp_materials " << endl;
28  materialMethodMap["CPP"] = &cpp_materials::createMaterials;
29 
30 
31  // MYSQL initialization
32  // cout << " Registering Material Factory: mysql_materials " << endl;
33  materialMethodMap["MYSQL"] = &mysql_materials::createMaterials;
34 
35 
36 
37 
38 
39  return materialMethodMap;
40 }
41 
materials * getMaterialFactory(map< string, materialFactory > *factory, string materialsMethod)
static materials * createMaterials()
Definition: cpp_materials.h:13
map< string, materialFactory > registerMaterialFactories()
static materials * createMaterials()