ROOT
Version v6.32
master
v6.34
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
Reference Guide
▼
ROOT
ROOT Reference Documentation
Tutorials
►
Functional Parts
►
Namespaces
►
All Classes
▼
Files
▼
File List
►
bindings
►
core
►
documentation
▼
geom
►
gdml
▼
geom
doc
►
inc
▼
src
►
TGDMLMatrix.cxx
TGeoArb8.cxx
TGeoAtt.cxx
TGeoBBox.cxx
TGeoBoolNode.cxx
TGeoBranchArray.cxx
►
TGeoBuilder.cxx
TGeoCache.cxx
TGeoCompositeShape.cxx
TGeoCone.cxx
►
TGeoElement.cxx
TGeoEltu.cxx
TGeoExtension.cxx
TGeoGlobalMagField.cxx
►
TGeoHalfSpace.cxx
►
TGeoHelix.cxx
TGeoHype.cxx
►
TGeoManager.cxx
►
TGeoMaterial.cxx
►
TGeoMatrix.cxx
►
TGeoMedium.cxx
►
TGeoNavigator.cxx
TGeoNode.cxx
►
TGeoOpticalSurface.cxx
►
TGeoPara.cxx
TGeoParaboloid.cxx
TGeoParallelWorld.cxx
TGeoPatternFinder.cxx
TGeoPcon.cxx
TGeoPgon.cxx
►
TGeoPhysicalNode.cxx
►
TGeoPolygon.cxx
►
TGeoRegion.cxx
TGeoScaledShape.cxx
TGeoShape.cxx
TGeoShapeAssembly.cxx
TGeoSphere.cxx
TGeoStateInfo.cxx
►
TGeoTessellated.cxx
TGeoTorus.cxx
►
TGeoTrd1.cxx
►
TGeoTrd2.cxx
TGeoTube.cxx
►
TGeoVector3.cxx
TGeoVolume.cxx
TGeoVoxelFinder.cxx
TGeoXtru.cxx
TVirtualGeoConverter.cxx
TVirtualGeoPainter.cxx
TVirtualGeoTrack.cxx
►
TVirtualMagField.cxx
►
geombuilder
►
geompainter
►
vecgeom
►
webviewer
►
graf2d
►
graf3d
►
gui
►
hist
►
html
►
io
►
main
►
math
►
montecarlo
►
net
►
proof
►
roofit
►
sql
►
tmva
►
tree
►
tutorials
►
v6-32-00-patches
►
File Members
Release Notes
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
TGeoExtension.cxx
Go to the documentation of this file.
1
// Author: Andrei.Gheata@cern.ch 29/05/2013
2
// Following proposal by Markus Frank
3
4
/*************************************************************************
5
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
#include "
TGeoExtension.h
"
13
#include "
Rtypes.h
"
14
#include <cassert>
15
16
ClassImp
(
TGeoExtension
);
17
18
/** \class TGeoExtension
19
\ingroup Geometry_classes
20
21
ABC for user objects attached to TGeoVolume or TGeoNode.
22
Provides interface for getting a reference (grab) and
23
releasing the extension object (release), allowing for
24
derived classes to implement reference counted sharing.
25
The user who should attach extensions to logical volumes
26
or nodes BEFORE applying misalignment information so that
27
these will be available to all copies.
28
*/
29
30
ClassImp
(
TGeoRCExtension
);
31
32
/** \class TGeoRCExtension
33
\ingroup Geometry_classes
34
35
Reference counted extension which has a pointer to and
36
owns a user defined TObject. This class can be used as
37
model for a reference counted derivation from TGeoExtension.
38
39
Note: Creating a TGeoRCExtension with new() automatically grabs it, but the
40
creator has to Release it before the pointer gets out of scope.
41
The following sequence is valid:
42
43
~~~ {.cpp}
44
// producer:
45
TGeoRCExtension *ext = new TGeoRCExtension();
46
some_TGeoVolume->SetUserExtension(ext);
47
ext->Release();
48
// user:
49
TGeoRCExtension *ext = dynamic_cast<TGeoRCExtension*>(some_TGeoVolume->GrabUserExtension());
50
// ... use extension
51
ext->Release();
52
~~~
53
54
The extension is going to be released by the TGeoVolume holder at the destruction
55
or when calling SetUserExtension(0).
56
57
The following usage is not correct:
58
59
~~~ {.cpp}
60
some_TGeoVolume->SetUserExtension(new TGeoRCExtension())
61
~~~
62
63
since the producer code does not release the extension.
64
One cannot call directly "delete ext" nor allocate an extension on the stack,
65
since the destructor is protected. Use Release instead.
66
*/
67
68
void
TGeoRCExtension::Release
()
const
69
{
70
assert
(
fRC
> 0);
71
fRC
--;
72
if
(
fRC
== 0)
73
delete
this
;
74
}
Rtypes.h
ClassImp
#define ClassImp(name)
Definition
Rtypes.h:377
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
TGeoExtension.h
TGeoExtension
ABC for user objects attached to TGeoVolume or TGeoNode.
Definition
TGeoExtension.h:17
TGeoRCExtension
Reference counted extension which has a pointer to and owns a user defined TObject.
Definition
TGeoExtension.h:33
TGeoRCExtension::fRC
Int_t fRC
Definition
TGeoExtension.h:55
TGeoRCExtension::Release
void Release() const override
Definition
TGeoExtension.cxx:68
geom
geom
src
TGeoExtension.cxx
ROOT v6-32 - Reference Guide Generated on Wed Apr 2 2025 08:24:22 (GVA Time) using Doxygen 1.10.0