Newer
Older
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef MaterialDataBase_h
#define MaterialDataBase_h
/** MaterialDataBase: Class to hold and manage collection of materials
*
* @author S.Aplin DESY
*/
#include <string>
#include <map>
#include <exception>
#include "lcio.h"
#include "Exceptions.h"
class TMaterial;
namespace gear{
class GearMgr ;
}
class IGeoSvc;
// fg: define the MaterialDataBaseException as an lcio Exception to allow for
// messages to be printed in what()
typedef lcio::Exception MaterialDataBaseException ;
class MaterialDataBase {
public:
/** Accessor Method */
static MaterialDataBase& Instance() {
static MaterialDataBase singleton;
return singleton;
}
// Other non-static member functions
public:
/** Destructor */
~MaterialDataBase();
/** Get Material via name */
TMaterial* getMaterial(std::string mat_name) ;
void registerForService(const gear::GearMgr& gearMgr, IGeoSvc* geoSvc=0) ;
private:
void initialise(const gear::GearMgr& gearMgr, IGeoSvc* geoSvc) ;
MaterialDataBase() { _material_map.clear(); _isInitialised = false ; _gearMgr = 0; } // Private constructor
MaterialDataBase(const MaterialDataBase&) ; // Prevent copy-construction
MaterialDataBase& operator=(const MaterialDataBase&) ; // Prevent assignment
void addMaterial(TMaterial* mat, std::string name);
void createMaterials(const gear::GearMgr& gearMgr, IGeoSvc* geoSvc);
// private member variables
std::map<std::string,TMaterial* > _material_map;
bool _isInitialised;
const gear::GearMgr* _gearMgr;
};
#endif