DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
Assembly.hh
Go to the documentation of this file.
1#pragma once
2#ifndef DLG4_ASSEMBLY_HPP
3#define DLG4_ASSEMBLY_HPP
4//
5// Created by Douglas S. Leonard on 6/8/25. All rights Reserved
6// See related files for license, if any is provided.
7//
8// Assemblies for treating a collection of builders as a single unit.
9//#include "StructureBuilder.hh"
10#include "Linkable.hh"
11#include "i_shared_ptr.hh"
12#include <stdexcept>
13//#include <VolumeBuilder.hh>
15#include <StructureBuilder.hh>
16#include <BuilderFactories.hh>
17
18// Factory CreateAssembly moved to BuilderFactories.hh
19
38 class Assembly final: public StructureBuilder<Assembly> {
39 template <typename T>
40 friend class VolumeBuilder;
41 template <typename T>
42 friend class StructureBuilder;
43 friend AssemblyPtr VB::CreateAssembly(G4String name);
44
45 friend class i_shared_ptr<Assembly>;
46
47 public:
49
50 private:
51 //ctor used by factory. Will construct an assembly from a builder actually.
52 template <typename T>
53 Assembly(i_shared_ptr<T> other, // NOLINT(*-explicit-constructor)
54 std::enable_if_t<std::is_base_of_v<IStructureBuilder, T>,
55 int> = 0) : StructureBuilder<Assembly>(other, SET_LINK) {
56 }
57
58 [[noreturn]]
59 G4VSolid *SolidConstructor(const G4String &name) override {
60 throw std::runtime_error(
61 "Error in StructureBuilderReference::SolidConstructor(const G4String &name) "
62 + this->builder_configs_->name + " \n" +
63 "SolidConstructor(const G4String &name) is not implemented.");
64 }
65
66 template <typename T>
67 friend class i_shared_ptr;
68
69
70 Assembly(const Assembly &other);
71 Assembly() = default;
72
73 protected:
74 // Clone impl, this returns a type-erased ISolidPtr
75 // But in reality must bee a BuilderPtr here to be downcast by Clone().
76
77 public:
78 Assembly &operator=(const Assembly &other) = delete;
79 };
80}
81
82
83#endif
#define SET_LINK
Definition Linkable.hh:63
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
Definition Assembly.hh:38
Assembly & operator=(const Assembly &other)=delete
AssemblyPtr AddStructure(const StructureView &other)
Definition Assembly.cc:45
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
VolumeBuilder: Common functionality for volume builder classes.
AssemblyPtr CreateAssembly(G4String name)
Assembly of strucures, ie builders and/or other assemblies.
Definition Assembly.cc:18