75 template<
class VALTYPE>
85 inline VALTYPE&
GetCache(
unsigned int id)
const;
102 template<
class VALTYPE>
109 inline VALTYPE*&
GetCache(
unsigned int id)
const;
144 cout<<
"Generic template"<<endl;
149 if ( cache->size() <= id )
150 cache->resize(
id+1,static_cast<V*>(0));
151 if ( (*cache)[
id] == 0 ) (*cache)[id]=
new V;
160 cout<<
"Destroying element"<<
id<<
" is last?"<<last<<endl;
162 if ( cache->size() <
id && (*cache)[id] ) {
176 return *(cache->operator[](id));
188 cout<<
"Pointer template"<<endl;
191 cache =
new cache_container;
192 if ( cache->size() <= id )
193 cache->resize(
id+1,static_cast<V*>(0));
203 cout<<
"Destroying element"<<
id<<
" is last?"<<last<<
"-Pointer template specialization-"<<endl;
205 if ( cache->size() <
id && (*cache)[id] ) {
220 return (cache->operator[](
id));
230 cout<<
"Specialized template for G4double"<<endl;
234 if (
cache->size() <= id )
235 cache->resize(
id+1,static_cast<G4double>(0));
239 if (
cache && last ) {
241 cout<<
"Destroying element"<<
id<<
" is last?"<<last<<
"-Pointer template specialization-"<<endl;
249 return cache->operator[](id);
std::vector< VALTYPE * > cache_container
void Initialize(unsigned int id)
static G4ThreadLocal cache_container * cache
std::vector< VALTYPE * > cache_container
static G4ThreadLocal cache_container * cache
std::vector< G4double > cache_container
static G4ThreadLocal std::vector< G4double > * cache
VALTYPE & GetCache(unsigned int id) const
void Destroy(unsigned int id, G4bool last)