DLG4::VolumeBuilders
A fluent interface for Geant4 geometry definition.
Loading...
Searching...
No Matches
src
StructureBuilderReference.cc
Go to the documentation of this file.
1
10
#include "
VolumeBuilderTypes.hh
"
11
#include "
ISolidBuilder.hh
"
12
#include "
VolumeBuilder.hh
"
13
#include "
VolumeBuilderReference.hh
"
14
#include "
StructureBuilderReference.hh
"
15
#include "
StructureBuilder.hh
"
16
#include "
StructureBuilder.hpp
"
17
18
19
namespace
DLG4::VolumeBuilders
{
20
SharedPtr<IStructureBuilder>
StructureBuilderReference::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 builderPtr from itself:
25
// These are non owning views, won't keep the temp copy:
26
BuilderView
builder_view = copy->ToBuilderView();
27
StructureView
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
StructureView
StructureBuilderReference::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
StructureBuilderReference.hh
StructureBuilder.hh
StructureBuilder.hpp
Created by.
VolumeBuilderReference.hh
VolumeBuilderTypes.hh
VolumeBuilder.hh
DLG4::VolumeBuilders::StructureBuilderReference::clone_impl
SharedPtr< IStructureBuilder > clone_impl() const override
Definition
StructureBuilderReference.cc:20
DLG4::VolumeBuilders::StructureBuilderReference::ToStructureView
StructureView ToStructureView() const override
Definition
StructureBuilderReference.cc:40
DLG4::i_shared_ptr
A wrapper for std::shared_ptr that allows and facilitates many implicit(i) type conversions.
Definition
i_shared_ptr.hh:36
DLG4::VolumeBuilders
Class by D.
Definition
Assembly.hh:17
DLG4::VolumeBuilders::shared_mutable_this
std::shared_ptr< T > shared_mutable_this(const std::enable_shared_from_this< T > *obj)
Definition
VolumeBuilderTypes.hh:139
Generated by
1.9.8