DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
src
StructureBuilderCore.cc
Go to the documentation of this file.
1
10
#include "
VolumeBuildersTypes.hh
"
11
#include "
ISolidBuilder.hh
"
12
#include "
VolumeBuilderBase.hh
"
13
#include "
VolumeBuilderCore.hh
"
14
#include "
StructureBuilderCore.hh
"
15
#include "
StructureBuilderBase.hh
"
16
#include "
StructureBuilderBase.hpp
"
17
18
19
namespace
DLG4::VolumeBuilders::_internals_
{
20
SharedPtr<IStructureBuilder>
StructureBuilderCore::clone_impl
()
const
{
21
if
(builder_configs_->istructure_ptr) {
22
// have the erased base clone itself ex: new RZBuilder(*this); :
23
IStructurePtr
copy = builder_configs_->istructure_ptr->clone_impl();
24
// Then have it create a Builder from itself:
25
// These are non owning views, won't keep the temp copy:
26
VolumeBuilder
builder_view = copy->ToVolumeBuilder();
27
StructureBuilder
structure_view = copy->ToStructureView();
28
// Then store itself in its new builder (that links to its data).
29
builder_view->StoreIStructurePtr(copy);
// this is the owning copy.
30
//We're storing the view in the builder by writing to the builder through that same view!
31
builder_view->StoreBuilderView(builder_view);
32
return
structure_view;
// and return the builder
33
}
else
{
34
// not sure we should get here:
35
auto
x =
static_cast<
SharedPtr<IStructureBuilder>
>
(
shared_mutable_this
(
this
));
36
return
x;
37
}
38
}
39
40
StructureBuilder
StructureBuilderCore::ToStructureView
()
const
{
41
// we're already type erased, so just return ourselves.
42
auto
x =
shared_mutable_this
(
this
);
43
return
x;
44
}
45
}
46
47
//
ISolidBuilder.hh
StructureBuilderBase.hh
StructureBuilderBase.hpp
Created by.
StructureBuilderCore.hh
VolumeBuilderBase.hh
VolumeBuilderCore.hh
VolumeBuildersTypes.hh
DLG4::VolumeBuilders::_internals_::StructureBuilderCore::clone_impl
SharedPtr< IStructureBuilder > clone_impl() const override
Definition
StructureBuilderCore.cc:20
DLG4::VolumeBuilders::_internals_::StructureBuilderCore::ToStructureView
StructureBuilder ToStructureView() const override
Definition
StructureBuilderCore.cc:40
DLG4::VolumeBuilders::_internals_::i_shared_ptr
Definition
i_shared_ptr.hh:36
DLG4::VolumeBuilders::_internals_
Definition
AssemblyCore.cc:37
DLG4::VolumeBuilders::_internals_::shared_mutable_this
std::shared_ptr< T > shared_mutable_this(const std::enable_shared_from_this< T > *obj)
Definition
VolumeBuildersTypes.hh:148
Generated by
1.9.8