DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
Assembly.cc
Go to the documentation of this file.
1
11#include "VolumeBuilder.hh"
13#include "StructureBuilder.hpp"
14#include "Assembly.hh"
15
17namespace DLG4::VolumeBuilders {
18 AssemblyPtr CreateAssembly(G4String name) {
19 // Haha... assemblies actually are builders!!!
20 auto object = AssemblyPtr(new Assembly());
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->ToBuilderView();
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 = AssemblyPtr(object);
31 return return_obj;
32
33 // This let's us reuse builder methods!
34 }
35}
36
38 Assembly::Assembly(const Assembly &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.".
Definition Assembly.hh:38
AssemblyPtr AddStructure(const StructureView &other)
Definition Assembly.cc:45
A type-erased (data shared view) view of a builder or assembly, ie a "structure.".
AssemblyPtr CreateAssembly(G4String name)
Assembly of strucures, ie builders and/or other assemblies.
Definition Assembly.cc:18