ROOT
6.07/01
Reference Guide
ROOT Home Page
Main Page
Tutorials
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
geom
geom
src
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
14
ClassImp
(
TGeoExtension
)
15
16
//______________________________________________________________________________
17
// TGeoExtension - ABC for user objects attached to TGeoVolume or TGeoNode.
18
// Provides interface for getting a reference (grab) and
19
// releasing the extension object (release), allowing for
20
// derived classes to implement reference counted sharing.
21
// The user who should attach extensions to logical volumes
22
// or nodes BEFORE applying misalignment information so that
23
// these will be available to all copies.
24
//______________________________________________________________________________
25
26
ClassImp
(
TGeoRCExtension
)
27
28
//______________________________________________________________________________
29
// TGeoRCExtension - Reference counted extension which has a pointer to and
30
// owns a user defined TObject. This class can be used as
31
// model for a reference counted derivation from TGeoExtension.
32
//______________________________________________________________________________
33
34
// Note: Creating a TGeoRCExtension with new() automatically grabs it, but the
35
// creator has to Release it before the pointer gets out of scope.
36
// The following sequence is valid:
37
//
38
// // producer:
39
// TGeoRCExtension *ext = new TGeoRCExtension();
40
// some_TGeoVolume->SetUserExtension(ext);
41
// ext->Release();
42
// // user:
43
// TGeoRCExtension *ext = dynamic_cast<TGeoRCExtension*>(some_TGeoVolume->GrabUserExtension());
44
// // ... use extension
45
// ext->Release();
46
//
47
// The extension is going to be released by the TGeoVolume holder at the destruction
48
// or when calling SetUserExtension(0).
49
//
50
// The following usage is not correct:
51
//
52
// some_TGeoVolume->SetUserExtension(new TGeoRCExtension())
53
//
54
// since the producer code does not release the extension.
55
// One cannot call directly "delete ext" nor allocate an extension on the stack,
56
// since the destructor is protected. Use Release instead.
TGeoExtension.h
TGeoExtension
Definition:
TGeoExtension.h:31
ClassImp
#define ClassImp(name)
Definition:
Rtypes.h:279
TGeoRCExtension
Definition:
TGeoExtension.h:56