forked from sPHENIX-Collaboration/acts
/
IMaterialWriter.hpp
69 lines (55 loc) · 1.77 KB
/
IMaterialWriter.hpp
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
// This file is part of the Acts project.
//
// Copyright (C) 2019 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#pragma once
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include <map>
namespace Acts {
class ISurfaceMaterial;
class IVolumeMaterial;
using SurfaceMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
using VolumeMaterialMap =
std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
} // namespace Acts
namespace ActsExamples {
/// @class IMaterialWriter
///
/// Interface definition for material writing
class IMaterialWriter {
public:
/// Virtual Destructor
virtual ~IMaterialWriter() = default;
/// The single wirter class
///
/// @param detMaterial the detector material maps
virtual void writeMaterial(const Acts::DetectorMaterialMaps& detMaterial) = 0;
};
/// @class MaterialWriterT
///
/// @tparam writer_t is the actual implementation
template <typename writer_t>
class MaterialWriterT : virtual public IMaterialWriter {
public:
/// Constructor
///
/// @tparam writer_t the templated writer implementation
///
/// @param impl the actaul implementation of the writer
MaterialWriterT(writer_t impl) : m_impl(std::move(impl)) {}
/// The single wirter class
///
/// @param detMaterial the detector material maps
void writeMaterial(const Acts::DetectorMaterialMaps& detMaterial) {
m_impl.write(detMaterial);
}
private:
/// The writer implementation
writer_t m_impl;
};
} // namespace ActsExamples