Geant4.10
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4.10.00.p01
source
processes
electromagnetic
dna
management
src
G4ITType.cc
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
// $Id: G4ITType.cc 74551 2013-10-14 12:59:14Z gcosmo $
27
//
28
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29
//
30
// History:
31
// -----------
32
// 10 Oct 2011 M.Karamitros created
33
//
34
// -------------------------------------------------------------------
35
36
#include "
G4ITType.hh
"
37
#include "
G4AutoLock.hh
"
38
39
/*G4ThreadLocal*/
G4ITTypeManager
* G4ITTypeManager::fgInstance = 0;
40
G4ThreadLocal
G4ITTypeManager
* G4ITTypeManager::fgInstance_local = 0;
41
42
G4Mutex
deleteMutex
=
G4MUTEX_INITIALIZER
;
43
G4Mutex
ressourceMutex
=
G4MUTEX_INITIALIZER
;
44
45
// static method
46
size_t
G4ITType::size
()
47
{
48
return
G4ITTypeManager::Instance
()->
size
();
49
}
50
51
G4ITType
&
G4ITType::operator=
(
const
G4ITType
& rhs)
52
{
53
if
(
this
== &rhs)
return
*
this
;
54
fValue = rhs.fValue;
55
return
*
this
;
56
}
57
58
G4ITTypeManager
*
G4ITTypeManager::Instance
()
59
{
60
if
(fgInstance == 0)
61
{
62
fgInstance =
new
G4ITTypeManager
();
63
}
64
return
fgInstance;
65
}
66
67
void
G4ITTypeManager::DeleteInstance
()
68
{
69
G4AutoLock
lock(&
deleteMutex
);
70
if
(fgInstance)
71
{
72
delete
fgInstance ;
73
fgInstance = 0;
74
}
75
}
76
77
void
G4ITTypeManager::ReserveRessource
()
78
{
79
G4AutoLock
lock(&
ressourceMutex
);
80
fRessource++;
81
}
82
83
void
G4ITTypeManager::ReleaseRessource
()
84
{
85
G4AutoLock
lock(&
ressourceMutex
);
86
fRessource--;
87
88
if
(fRessource <= 0)
DeleteInstance
();
89
}
90
91
G4ITTypeManager::G4ITTypeManager()
92
{ fLastType = 0;}
93
94
G4ITTypeManager::~G4ITTypeManager()
95
{;}
96
97
size_t
G4ITTypeManager::size
()
const
98
{
99
return
fLastType;
100
}
101
102
G4ITType
G4ITTypeManager::NewType
()
103
{
104
G4ITType
newType = fLastType;
105
fLastType++;
106
return
newType;
107
}
G4ITType.hh
deleteMutex
G4Mutex deleteMutex
Definition:
G4ITType.cc:42
G4ITType
Definition:
G4ITType.hh:51
G4ITTypeManager::NewType
G4ITType NewType()
Definition:
G4ITType.cc:102
G4ITTypeManager::DeleteInstance
static void DeleteInstance()
Definition:
G4ITType.cc:67
G4ThreadLocal
#define G4ThreadLocal
Definition:
tls.hh:52
G4MUTEX_INITIALIZER
#define G4MUTEX_INITIALIZER
Definition:
G4Threading.hh:158
G4ITType::operator=
G4ITType & operator=(const G4ITType &rhs)
Definition:
G4ITType.cc:51
G4ITTypeManager::Instance
static G4ITTypeManager * Instance()
Definition:
G4ITType.cc:58
G4ImpMutexAutoLock
Definition:
G4AutoLock.hh:108
ressourceMutex
G4Mutex ressourceMutex
Definition:
G4ITType.cc:43
G4ITType::size
static size_t size()
Definition:
G4ITType.cc:46
G4ITTypeManager::size
size_t size() const
Definition:
G4ITType.cc:97
G4ITTypeManager::ReserveRessource
void ReserveRessource()
Definition:
G4ITType.cc:77
G4Mutex
G4int G4Mutex
Definition:
G4Threading.hh:156
G4ITTypeManager::ReleaseRessource
void ReleaseRessource()
Definition:
G4ITType.cc:83
G4ITTypeManager
Definition:
G4ITType.hh:84
G4AutoLock.hh
Generated on Wed Apr 30 2014 15:54:51 for Geant4.10 by
1.8.7