Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4INCLAllocationPool.hh File Reference

Singleton for recycling allocation of instances of a given class. More...

#include "globals.hh"
#include <stack>
#include <new>
#include <cstddef>

Go to the source code of this file.

Classes

class  G4INCL::AllocationPool< T >
 

Namespaces

namespace  G4INCL
 

Macros

#define INCLXX_IN_GEANT4_MODE   1
 
#define G4INCLALLOCATIONPOOL_HH
 
#define INCL_DECLARE_ALLOCATION_POOL(T)
 

Variables

template<typename T>
G4ThreadLocal AllocationPool< T > * G4INCL::AllocationPool< T >::theInstance = 0
 

Detailed Description

Singleton for recycling allocation of instances of a given class.

Date
2nd October 2014
Author
Davide Mancusi

Definition in file G4INCLAllocationPool.hh.

Macro Definition Documentation

◆ G4INCLALLOCATIONPOOL_HH

#define G4INCLALLOCATIONPOOL_HH

Definition at line 46 of file G4INCLAllocationPool.hh.

◆ INCL_DECLARE_ALLOCATION_POOL

#define INCL_DECLARE_ALLOCATION_POOL ( T)
Value:
public: \
static void *operator new(size_t /* s */) { \
return allocator.getObject(); \
} \
static void operator delete(void *a, size_t /* s */) { \
allocator.recycleObject(static_cast<T *>(a)); \
}
static AllocationPool & getInstance()

Definition at line 103 of file G4INCLAllocationPool.hh.

103#define INCL_DECLARE_ALLOCATION_POOL(T) \
104 public: \
105 static void *operator new(size_t /* s */) { \
106 ::G4INCL::AllocationPool<T> &allocator = ::G4INCL::AllocationPool<T>::getInstance(); \
107 return allocator.getObject(); \
108 } \
109 static void operator delete(void *a, size_t /* s */) { \
110 ::G4INCL::AllocationPool<T> &allocator = ::G4INCL::AllocationPool<T>::getInstance(); \
111 allocator.recycleObject(static_cast<T *>(a)); \
112 }

◆ INCLXX_IN_GEANT4_MODE

#define INCLXX_IN_GEANT4_MODE   1

Definition at line 34 of file G4INCLAllocationPool.hh.