SHiP Geometry
SHiP experiment geometry implementation using GeoModel.
Loading...
Searching...
No Matches
Materials.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) CERN for the benefit of the SHiP Collaboration
3
4#pragma once
5
6#include <functional>
7#include <map>
8#include <string>
9#include <string_view>
10
11class GeoMaterial;
12class GeoElement;
13
14namespace SHiP::geometry {
15
22class Materials {
23 public:
24 Materials();
25 ~Materials() = default;
26
27 // Prevent copying (materials should be shared)
28 Materials(const Materials&) = delete;
29 Materials& operator=(const Materials&) = delete;
30
36 [[nodiscard]] GeoMaterial* getMaterial(std::string_view name) const;
37
44 [[nodiscard]] GeoMaterial* requireMaterial(std::string_view name) const;
45
46 private:
47 void createElements();
48 void createMaterials();
49
50 std::map<std::string, GeoElement*> m_elements;
51 std::map<std::string, GeoMaterial*, std::less<>> m_materials;
52};
53
54} // namespace SHiP::geometry
Materials()
Definition Materials.cpp:18
Materials()
Definition Materials.cpp:18
GeoMaterial * getMaterial(std::string_view name) const
Get a material by name.
Definition Materials.cpp:23
Materials & operator=(const Materials &)=delete
Materials(const Materials &)=delete
GeoMaterial * requireMaterial(std::string_view name) const
Get a material by name, throwing if not found.
Definition Materials.cpp:28
Definition DetectorBuilder.h:8