Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Allocator.hh,v 1.12 2003/03/25 14:56:17 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4Allocator.hh,v 1.14 2004/05/14 17:40:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -61,6 +61,14 @@ class G4Allocator
|
||||
// Malloc and Free methods to be used when overloading
|
||||
// new and delete operators in the client <Type> object
|
||||
|
||||
inline void ResetStorage();
|
||||
// Returns allocated storage to the free store, resets
|
||||
// allocator and page sizes.
|
||||
// Note: contents in memory are lost using this call !
|
||||
|
||||
inline int GetAllocatedSize();
|
||||
// Returns the size of the total memory allocated
|
||||
|
||||
private:
|
||||
|
||||
void AddNewPage();
|
||||
@@ -149,8 +157,8 @@ void G4Allocator<Type>::FreeSingle(Type* anElement)
|
||||
|
||||
// The gcc-3.1 compiler will complain and not correctly handle offsets
|
||||
// computed from non-POD types. Pointers to member data should be used
|
||||
// instead. This advanced C++ feature seems not to work on earlier
|
||||
// versions of the same compiler.
|
||||
// instead. This C++ feature seems not to work on earlier versions of
|
||||
// the same compiler.
|
||||
//
|
||||
#if (__GNUC__==3) && (__GNUC_MINOR__>0)
|
||||
Type G4AllocatorUnit<Type>::*pOffset = &G4AllocatorUnit<Type>::fElement;
|
||||
@@ -194,6 +202,54 @@ void G4Allocator<Type>::AddNewPage()
|
||||
fFreeList = &aPage->fUnits[0];
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// ResetStorage
|
||||
// ************************************************************
|
||||
//
|
||||
template <class Type>
|
||||
void G4Allocator<Type>::ResetStorage()
|
||||
{
|
||||
// Clear all allocated storage and return it to the free store
|
||||
//
|
||||
G4AllocatorPage<Type> * aPage;
|
||||
G4AllocatorPage<Type> * aNextPage;
|
||||
|
||||
aPage = fPages;
|
||||
while (aPage != 0)
|
||||
{
|
||||
aNextPage = aPage->fNext;
|
||||
free(aPage->fUnits);
|
||||
delete aPage;
|
||||
aPage = aNextPage;
|
||||
}
|
||||
|
||||
// Reset unit&page size and allocate a single page
|
||||
//
|
||||
fPages = 0;
|
||||
fFreeList = 0;
|
||||
fUnitSize = sizeof(G4AllocatorUnit<Type>);
|
||||
fPageSize = ( (fUnitSize < 512) ? 1024 : (fUnitSize*10) );
|
||||
AddNewPage();
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// GetAllocatedSize
|
||||
// ************************************************************
|
||||
//
|
||||
template <class Type>
|
||||
int G4Allocator<Type>::GetAllocatedSize()
|
||||
{
|
||||
G4AllocatorPage<Type> * aPage = fPages;
|
||||
int count = 0;
|
||||
|
||||
while (aPage != 0)
|
||||
{
|
||||
aPage = aPage->fNext;
|
||||
count++;
|
||||
}
|
||||
return count*fPageSize;
|
||||
}
|
||||
|
||||
// ************************************************************
|
||||
// AddNewElement
|
||||
// ************************************************************
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Types.hh,v 1.7 2003/06/17 08:14:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4Types.hh,v 1.9 2004/06/09 07:30:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
// GEANT4 native types
|
||||
@@ -32,11 +32,26 @@
|
||||
#ifndef G4TYPES_HH
|
||||
#define G4TYPES_HH
|
||||
|
||||
// Disable warning C4786 on WIN32 architectures: identifier was truncated
|
||||
// to '255' characters in the debug information
|
||||
//
|
||||
#ifdef WIN32
|
||||
// Disable warning C4786 on WIN32 architectures:
|
||||
// identifier was truncated to '255' characters
|
||||
// in the debug information
|
||||
//
|
||||
#pragma warning ( disable : 4786 )
|
||||
//
|
||||
// Define DLL export macro for WIN32 systems for
|
||||
// importing/exporting external symbols to DLLs
|
||||
//
|
||||
#if defined G4LIB_BUILD_DLL
|
||||
#define G4DLLEXPORT __declspec( dllexport )
|
||||
#define G4DLLIMPORT __declspec( dllimport )
|
||||
#else
|
||||
#define G4DLLEXPORT
|
||||
#define G4DLLIMPORT
|
||||
#endif
|
||||
#else
|
||||
#define G4DLLEXPORT
|
||||
#define G4DLLIMPORT
|
||||
#endif
|
||||
|
||||
// Disable deprecated warnings for usage of strstream on Linux
|
||||
@@ -45,7 +60,7 @@
|
||||
#if (__GNUC__==3) && (__GNUC_MINOR__>0)
|
||||
#undef __DEPRECATED
|
||||
#endif
|
||||
|
||||
|
||||
#include <CLHEP/config/CLHEP.h>
|
||||
#include <complex>
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ios.hh,v 1.7 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4ios.hh,v 1.9 2004/06/09 07:30:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
@@ -36,20 +36,15 @@
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
#if defined(OO_DDL_TRANSLATION)
|
||||
/*
|
||||
* stdlib needs to be included before iostream.h
|
||||
* during oddlx runs to work around a parser
|
||||
* problem of AIX ooddlx v4.0.2 with some versions of
|
||||
* AIX system header files.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
extern std::ostream G4cout;
|
||||
extern std::ostream G4cerr;
|
||||
#if defined G4IOS_EXPORT
|
||||
extern G4DLLEXPORT std::ostream G4cout;
|
||||
extern G4DLLEXPORT std::ostream G4cerr;
|
||||
#else
|
||||
extern G4DLLIMPORT std::ostream G4cout;
|
||||
extern G4DLLIMPORT std::ostream G4cerr;
|
||||
#endif
|
||||
|
||||
#define G4cin std::cin
|
||||
#define G4endl std::endl
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4strstreambuf.hh,v 1.10 2003/06/06 16:17:14 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02-patch-01 $
|
||||
// $Id: G4strstreambuf.hh,v 1.12 2004/06/09 07:30:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
@@ -40,8 +40,14 @@
|
||||
#include "G4coutDestination.hh"
|
||||
|
||||
class G4strstreambuf;
|
||||
extern G4strstreambuf G4coutbuf;
|
||||
extern G4strstreambuf G4cerrbuf;
|
||||
|
||||
#if defined G4IOS_EXPORT
|
||||
extern G4DLLEXPORT G4strstreambuf G4coutbuf;
|
||||
extern G4DLLEXPORT G4strstreambuf G4cerrbuf;
|
||||
#else
|
||||
extern G4DLLIMPORT G4strstreambuf G4coutbuf;
|
||||
extern G4DLLIMPORT G4strstreambuf G4cerrbuf;
|
||||
#endif
|
||||
|
||||
class G4strstreambuf : public std::streambuf
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user