Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Commits
871a9df5
Commit
871a9df5
authored
1 year ago
by
Johannes Junggeburth
Browse files
Options
Downloads
Patches
Plain Diff
Transform the daughter pointers into GeoModelIntrusivePtrs
parent
00909f63
No related branches found
No related tags found
1 merge request
!228
GeoPhysVol / GeoFullPhysVol - Pointer managment clean up
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPhysVol.h
+4
-8
4 additions, 8 deletions
GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPhysVol.h
GeoModelCore/GeoModelKernel/src/GeoPhysVol.cxx
+7
-16
7 additions, 16 deletions
GeoModelCore/GeoModelKernel/src/GeoPhysVol.cxx
with
11 additions
and
24 deletions
GeoModelCore/GeoModelKernel/GeoModelKernel/GeoPhysVol.h
+
4
−
8
View file @
871a9df5
/*
Copyright (C) 2002-202
2
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
3
CERN for the benefit of the ATLAS collaboration
*/
#ifndef GEOMODELKERNEL_GEOPHYSVOL_H
...
...
@@ -28,14 +28,10 @@
#include
<mutex>
class
GeoPhysVol
:
public
GeoVPhysVol
{
class
GeoPhysVol
:
public
GeoVPhysVol
{
public:
GeoPhysVol
(
const
GeoLogVol
*
LogVol
);
GeoPhysVol
(
const
GeoPhysVol
&
right
)
=
delete
;
GeoPhysVol
&
operator
=
(
const
GeoPhysVol
&
right
)
=
delete
;
/// Adds a Graph Node to the Geometry Graph
virtual
void
add
(
GeoGraphNode
*
graphNode
)
override
final
;
...
...
@@ -72,10 +68,10 @@ class GeoPhysVol : public GeoVPhysVol
virtual
const
GeoGraphNode
*
const
*
findChildNode
(
const
GeoGraphNode
*
n
)
const
override
final
;
protected:
virtual
~
GeoPhysVol
()
override
;
virtual
~
GeoPhysVol
()
=
default
;
private:
std
::
vector
<
const
GeoGraphNode
*
>
m_daughters
;
std
::
vector
<
GeoIntrusivePtr
<
GeoGraphNode
>
>
m_daughters
{}
;
mutable
std
::
mutex
m_muxVec
;
};
...
...
This diff is collapsed.
Click to expand it.
GeoModelCore/GeoModelKernel/src/GeoPhysVol.cxx
+
7
−
16
View file @
871a9df5
/*
Copyright (C) 2002-20
17
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-20
23
CERN for the benefit of the ATLAS collaboration
*/
#include
"GeoModelKernel/GeoPhysVol.h"
...
...
@@ -17,17 +17,11 @@ GeoPhysVol::GeoPhysVol(const GeoLogVol* LogVol)
{
}
GeoPhysVol
::~
GeoPhysVol
()
{
std
::
scoped_lock
<
std
::
mutex
>
lk
(
m_muxVec
);
for
(
const
GeoGraphNode
*
daughter
:
m_daughters
)
daughter
->
unref
();
}
void
GeoPhysVol
::
add
(
GeoGraphNode
*
graphNode
)
{
std
::
scoped_lock
<
std
::
mutex
>
lk
(
m_muxVec
);
m_daughters
.
push_back
(
graphNode
);
graphNode
->
ref
();
graphNode
->
dockTo
(
this
);
}
...
...
@@ -199,20 +193,17 @@ unsigned int GeoPhysVol::getNChildNodes() const
return
m_daughters
.
size
();
}
const
GeoGraphNode
*
const
*
GeoPhysVol
::
getChildNode
(
unsigned
int
i
)
const
{
const
GeoGraphNode
*
const
*
GeoPhysVol
::
getChildNode
(
unsigned
int
i
)
const
{
std
::
scoped_lock
<
std
::
mutex
>
lk
(
m_muxVec
);
return
&
(
m_daughters
[
i
]
)
;
return
m_daughters
[
i
];
}
const
GeoGraphNode
*
const
*
GeoPhysVol
::
findChildNode
(
const
GeoGraphNode
*
n
)
const
{
const
GeoGraphNode
*
const
*
GeoPhysVol
::
findChildNode
(
const
GeoGraphNode
*
n
)
const
{
std
::
scoped_lock
<
std
::
mutex
>
lk
(
m_muxVec
);
std
::
vector
<
const
GeoGraphNode
*
>::
const_iterator
i
=
std
::
find
(
m_daughters
.
begin
(),
m_daughters
.
end
(),
n
);
std
::
vector
<
GeoIntrusivePtr
<
GeoGraphNode
>
>::
const_iterator
i
=
std
::
find
(
m_daughters
.
begin
(),
m_daughters
.
end
(),
n
);
if
(
i
==
m_daughters
.
end
())
{
return
nullptr
;
}
else
{
return
&*
i
;
}
return
(
*
i
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment