Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
athena
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review 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
atlas
athena
Merge requests
!68749
InDetGeoModelUtils - Use GeoIntrusivePtr in favour of manual ref/unref
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
InDetGeoModelUtils - Use GeoIntrusivePtr in favour of manual ref/unref
jojungge/athena:IntrusiveInDetGeoUtils
into
main
Overview
15
Commits
1
Pipelines
0
Changes
7
Merged
Johannes Junggeburth
requested to merge
jojungge/athena:IntrusiveInDetGeoUtils
into
main
1 year ago
Overview
15
Commits
1
Pipelines
0
Changes
7
Expand
Replace ref & unref by the GeoIntrusivePtrs
Edited
1 year ago
by
Johannes Junggeburth
0
0
Merge request reports
Compare
main
version 4
5563eada
1 year ago
version 3
c2d708c6
1 year ago
version 2
db7c1e50
1 year ago
version 1
6984d386
1 year ago
main (base)
and
latest version
latest version
8a881b8d
1 commit,
1 year ago
version 4
5563eada
4 commits,
1 year ago
version 3
c2d708c6
3 commits,
1 year ago
version 2
db7c1e50
2 commits,
1 year ago
version 1
6984d386
1 commit,
1 year ago
7 files
+
35
−
172
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
InnerDetector/InDetDetDescr/InDetGeoModelUtils/InDetGeoModelUtils/GeoNodePtr.h
+
4
−
56
Options
/*
Copyright (C) 2002-202
0
CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-202
4
CERN for the benefit of the ATLAS collaboration
*/
#ifndef _GeoNodePtr_H_
#define _GeoNodePtr_H_
#include
<iostream>
// Smart pointer for reference counted GeoModel objects
template
<
class
T
>
class
GeoNodePtr
{
static
T
*
ref
(
T
*
obj
)
{
if
(
obj
)
obj
->
ref
();
return
obj
;}
static
T
*
unref
(
T
*
obj
)
{
if
(
obj
)
obj
->
unref
();
return
obj
;}
public
:
using
T_Ptr
=
T
*
;
using
T_ConstPtr
=
const
T
*
;
GeoNodePtr
()
=
default
;
GeoNodePtr
(
T
*
obj
)
:
m_obj
(
ref
(
obj
))
{
}
~
GeoNodePtr
()
{
unref
(
m_obj
);
}
// copy
GeoNodePtr
(
const
GeoNodePtr
<
T
>
&
node_ptr
)
:
m_obj
(
ref
(
node_ptr
->
m_obj
()
)
)
{
}
GeoNodePtr
<
T
>
&
operator
=
(
const
GeoNodePtr
<
T
>
&
node_ptr
)
{
if
(
node_ptr
->
m_obj
!=
m_obj
)
{
unref
(
m_obj
);
m_obj
=
ref
(
node_ptr
->
m_obj
);
}
return
*
this
;
}
GeoNodePtr
<
T
>
&
operator
=
(
T
*
obj
)
{
if
(
obj
!=
m_obj
)
{
unref
(
m_obj
);
m_obj
=
ref
(
obj
);
}
return
*
this
;
}
// move
GeoNodePtr
(
GeoNodePtr
<
T
>
&&
node_ptr
)
:
m_obj
(
node_ptr
->
m_obj
)
{
node_ptr
->
m_obj
=
nullptr
;
}
GeoNodePtr
<
T
>
&
operator
=
(
GeoNodePtr
<
T
>
&&
node_ptr
)
{
m_obj
=
node_ptr
->
m_obj
;
node_ptr
->
m_obj
=
nullptr
;
return
*
this
;
}
operator
bool
()
const
{
return
m_obj
!=
nullptr
;
}
operator
T_Ptr
()
{
return
m_obj
;
}
T_ConstPtr
get
()
const
{
return
m_obj
;
}
T
*
operator
->
()
{
assert
(
m_obj
);
return
m_obj
;
}
const
T
*
operator
->
()
const
{
assert
(
m_obj
);
return
m_obj
;
}
private
:
T
*
m_obj
=
nullptr
;
};
#include
"GeoModelKernel/GeoIntrusivePtr.h"
template
<
class
T
>
using
GeoNodePtr
=
GeoIntrusivePtr
<
T
>
;
#endif
Loading