34 #define INCLXX_IN_GEANT4_MODE 1
45 #ifndef G4INCLALLOCATIONPOOL_HH
46 #define G4INCLALLOCATIONPOOL_HH
48 #if defined(INCL_USE_ALLOCATION_POOL) || defined(INCLXX_IN_GEANT4_MODE)
67 return static_cast<T*>(::
operator new(
sizeof(T)));
103 #define INCL_DECLARE_ALLOCATION_POOL(T) \
105 static void *operator new(size_t ) { \
106 ::G4INCL::AllocationPool<T> &allocator = ::G4INCL::AllocationPool<T>::getInstance(); \
107 return allocator.getObject(); \
109 static void operator delete(void *a, size_t ) { \
110 ::G4INCL::AllocationPool<T> &allocator = ::G4INCL::AllocationPool<T>::getInstance(); \
111 allocator.recycleObject(static_cast<T *>(a)); \
114 #else // defined(INCL_USE_ALLOCATION_POOL) || defined(INCLXX_IN_GEANT4_MODE)
115 #define INCL_DECLARE_ALLOCATION_POOL(T)
118 #endif // G4INCLALLOCATIONPOOL_HH
static AllocationPool & getInstance()
virtual ~AllocationPool()
std::stack< T * > theStack
static G4ThreadLocal AllocationPool * theInstance