80#include <system_error>
87template <
class VALTYPE>
134template <
class VALTYPE>
174template <
class KEYTYPE,
class VALTYPE>
182 typedef typename std::map<key_type, value_type>
map_type;
215 std::cout <<
"G4Cache id: " <<
id << std::endl;
236 std::cout <<
"Copy constructor with id: " <<
id << std::endl;
252 std::cout <<
"Assignement operator with id: " <<
id << std::endl;
265 std::cout <<
"G4Cache id: " <<
id << std::endl;
273 std::cout <<
"~G4Cache id: " <<
id << std::endl;
290 }
catch(std::system_error& e)
294 G4cout <<
"Non-critical error: mutex lock failure in ~G4Cache<"
296 <<
"If the RunManagerKernel has been deleted, it failed to "
297 <<
"delete an allocated resource" <<
G4endl
298 <<
"and this destructor is being called after the statics "
299 <<
"were destroyed." <<
G4endl;
300 G4cout <<
"Exception: [code: " << e.code() <<
"] caught: " << e.what()
305 G4bool last = (dstrctr == instancesctr);
306 theCache.Destroy(
id, last);
309 instancesctr.store(0);
349 std::cout <<
"~G4VectorCache "
351 <<
" with size: " << Size() <<
"->";
353 std::cout <<
operator[](i) <<
",";
354 std::cout <<
"<-" << std::endl;
370 for(
G4int idx = 0; idx < nElems; ++idx)
422template <
class K,
class V>
427 <<
" with size: " << Size() <<
"->";
428 for(
iterator it = Begin(); it != End(); ++it)
429 std::cout << it->first <<
":" << it->second <<
",";
430 std::cout <<
"<-" << std::endl;
434template <
class K,
class V>
436 const K& k,
const V& v)
447template <
class K,
class V>
452template <
class K,
class V>
458template <
class K,
class V>
464template <
class K,
class V>
467 return (Find(k) != End());
470template <
class K,
class V>
473 return Find(k)->second;
476template <
class K,
class V>
482template <
class K,
class V>
G4Mutex & G4TypeMutex(const unsigned int &_n=0)
G4GLOB_DLL std::ostream G4cout
VALTYPE & GetCache(unsigned int id) const
void Initialize(unsigned int id)
G4CacheReference< value_type > theCache
const G4int & GetId() const
G4Cache(const G4Cache &rhs)
value_type & GetCache() const
void Put(const value_type &val) const
static std::atomic< unsigned int > instancesctr
G4Cache(const value_type &v)
static std::atomic< unsigned int > dstrctr
G4Cache & operator=(const G4Cache &rhs)
map_type::iterator iterator
std::map< key_type, value_type > map_type
value_type & Get(const key_type &k)
std::pair< iterator, G4bool > Insert(const key_type &k, const value_type &v)
iterator Find(const key_type &k)
size_type Erase(const key_type &k)
G4bool Has(const key_type &k)
value_type & operator[](const key_type &k)
map_type::size_type size_type
map_type::const_iterator const_iterator
value_type & operator[](const G4int &idx)
G4VectorCache(G4int nElems, value_type *vals)
vector_type::iterator iterator
G4VectorCache(G4int nElems)
vector_type::const_iterator const_iterator
std::vector< value_type > vector_type
void Push_back(const value_type &val)
vector_type::size_type size_type
const char * name(G4int ptype)