DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
AssemblyCore.cc
Go to the documentation of this file.
1
11#include "VolumeBuilderBase.hh"
12#include "VolumeBuilderCore.hh"
14#include "AssemblyCore.hh"
15
18 Assembly CreateAssembly(G4String name) {
19 // Haha... assemblies actually are builders!!!
20 auto object = Assembly(new AssemblyCore());
21 // ... with is_builder set to false.
22 object->placement_configs_->is_builder = false;
23 //We're storing a pointer to the view in the builder by writing to the builder through that same view!
24 BuilderView builder_view = object->ToVolumeBuilder();
25 builder_view->StoreBuilderView(builder_view);
26 // Then store itself in its new builder (that links to its data).
27 //object->builder_configs_->builder_view->StoreIStructurePtr(IStructurePtr(object.get())); // this is the owning copy.
28 // ... and viewed through a reduced StructureView interface:
29 object->SetName(name);
30 auto return_obj = Assembly(object);
31 return return_obj;
32
33 // This let's us reuse builder methods!
34 }
35}
36
38 AssemblyCore::AssemblyCore(const AssemblyCore &other) :
40 // Call base class copy constructor
41 set_shared_from_this_enabled(false);
42 set_shared_from_this_enabled(true);
43 }
44
46 this->placement_configs_->children.emplace_back(other);
47 return this->shared_from_this();
48 }
49}
50
51//
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
Assembly AddStructure(const StructureBuilder &other)
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
Assembly CreateAssembly(G4String name)
Assembly of strucures, ie builders and/or other assemblies.
_internals_::Assembly Assembly
Pointer to Assembly type to hold Structures, ie other assemblies or buidlers.