Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
+32 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.19 2000/02/11 14:08:38 gcosmo Exp $
$Id: History,v 1.22 2000/06/26 16:25:56 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,37 @@ committal in the CVS repository !
STL Interface
-------------
June 26, 00 G.Cosmo (STLInterface-V01-01-01)
- Fixes for problem report #104:
o defs.h: defined G4RWTHROW(a) to abort() in case G4NO_STD_EXCEPTIONS
is set.
o tpsrtvec.icc, tvordvec.icc: corrected implementation of last() in case
of call to G4RWTHROW(a).
o cstring.icc: defined function G4String::strcasecompare(a,b) which will
NOT invoke the non-ANSI function strcasecmp(a,b) when G4USE_STD_NAMESPACE
is set.
- defs.h:
o fixed memory leaks in destruction of 'str' in destructors and
copy-constructors of G4RWGeneralException and G4RWBoundsErr.
March 21, 00 G.Cosmo (STLInterface-V01-01-00)
- Forced initialization of vectors' members also for ordered/sorted
collections. Even when using the access operator vector::operator[]
as left-hand operand, it requires the vector to be not empty. Removed
usage of vector::reserve(capacity).
March 10, 00 G.Cosmo
- Implemented correct behavior for vectors' default constructors, as
expected by the RW interface.
o for pointer/value ordered/sorted collections, an EMPTY STL vector is
created and the vector capacity is set to a G4RWDEFAULT_CAPACITY
using vector::reserve(capacity). No element initialisation is done.
o for pointer/value simple collections, a default constructor creating
and EMPTY vector is implemented; the constructor taking the capacity
as argument, creates an STL vector of the given capacity and explicitly
initialises its elements. Pointers are initialised to zero.
February 8, 00 G.Cosmo
- cstring.icc: fixed yet another bug in G4String::toUpper() and
G4String::toLower(). Loop over the string characters was causing
+4 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: cstring.h,v 1.7 1999/12/15 18:12:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: cstring.h,v 1.8 2000/06/26 16:25:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -156,6 +156,8 @@ public:
inline const char* data() const;
inline int strcasecompare(const char*, const char*) const;
inline unsigned int hash( caseCompare cmp = exact ) const;
inline unsigned int stlhash() const;
+25 -7
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: cstring.icc,v 1.4 2000/02/08 14:15:42 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: cstring.icc,v 1.5 2000/06/26 16:25:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -228,22 +228,40 @@ G4String::operator const char*() const
return c_str();
}
int G4String::strcasecompare(const char* s1, const char* s2) const
{
#ifndef G4USE_STD_NAMESPACE
return strcasecmp(s1,s2);
#else
char* buf1 = new char[strlen(s1)+1];
char* buf2 = new char[strlen(s2)+1];
for (size_t i=0; i<=strlen(s1); i++)
buf1[i] = tolower(s1[i]);
for (size_t j=0; j<=strlen(s2); j++)
buf2[j] = tolower(s2[j]);
int res = strcmp(buf1, buf2);
delete [] buf1;
delete [] buf2;
return res;
#endif
}
int G4String::compareTo(const char* s, caseCompare mode)
{
//GB:OSF1-cxx if(mode=exact)
if(mode==exact)
return strcmp(c_str(),s);
else
return strcasecmp(c_str(),s);
return strcasecompare(c_str(),s);
}
int G4String::compareTo(const G4String& s, caseCompare mode)
{
//GB:OSF1-cxx if(mode=exact)
if(mode==exact)
return strcmp(data(),s.data());
return strcmp(c_str(),s.c_str());
else
return strcasecmp(data(),s.data());
return strcasecompare(c_str(),s.c_str());
}
G4String& G4String::prepend (const char* str)
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: ctoken.h,v 1.5 1999/11/29 10:17:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
+11 -5
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: defs.h,v 1.7 1999/11/29 16:52:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: defs.h,v 1.8 2000/06/26 16:25:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -60,13 +60,14 @@ public:
G4RWBoundsErr(const G4RWBoundsErr&e)
{
delete [] str;
str=new char[strlen(e.str)+1];
strcpy(str,e.str);
}
~G4RWBoundsErr()
{
delete str;
delete [] str;
}
const char * why() const
@@ -92,13 +93,14 @@ public:
G4RWGeneralException(const G4RWGeneralException&e)
{
delete [] str;
str=new char[strlen(e.str)+1];
strcpy(str,e.str);
}
~G4RWGeneralException()
{
delete str;
delete [] str;
}
const char * why() const
@@ -112,6 +114,10 @@ private:
};
#define G4RWTHROW(a) throw a
#ifndef G4NO_STD_EXCEPTIONS
#define G4RWTHROW(a) throw a
#else
#define G4RWTHROW(a) abort()
#endif
#endif
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: rstream.h,v 1.4 1999/11/25 10:14:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: rw2stl_algo.h,v 1.4 1999/11/25 10:14:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: tpordvec.h,v 1.7 1999/11/26 17:17:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
+5 -4
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tpordvec.icc,v 1.2 2000/02/01 16:55:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: tpordvec.icc,v 1.4 2000/03/22 08:05:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -17,8 +17,9 @@
template<class T >
G4RWTPtrOrderedVector<T>::G4RWTPtrOrderedVector(size_t capacity)
: std_pvector(capacity,(T*)0),rwsize(0){}
: std_pvector(capacity,(T*)0),rwsize(0){} // Here Rogue-Wave would leave
// pointers T* uninitialised and
// would create an EMPTY vector!
template<class T >
G4RWTPtrOrderedVector<T>::G4RWTPtrOrderedVector(const G4RWTPtrOrderedVector<T>& v)
: std_pvector(v),rwsize(v.rwsize){}
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: tpsrtvec.h,v 1.8 1999/11/26 17:17:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
+7 -11
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tpsrtvec.icc,v 1.3 2000/02/01 16:55:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: tpsrtvec.icc,v 1.6 2000/06/26 16:25:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -17,12 +17,9 @@
template<class T>
G4RWTPtrSortedVector<T>::G4RWTPtrSortedVector(size_t n)
: std_pvector(n),rwsize(0)
{
for(int i=0;i<n;i++)
std_pvector::operator[](i)=0;
}
: std_pvector(n,(T*)0),rwsize(0){} // Here Rogue-Wave would leave
// pointers T* uninitialised and
// would create an EMPTY vector!
template<class T>
G4RWTPtrSortedVector<T>::G4RWTPtrSortedVector(const G4RWTPtrSortedVector<T>& v)
: std_pvector(v), rwsize(v.rwsize){}
@@ -171,10 +168,9 @@ T* const & G4RWTPtrSortedVector<T>::first () const
template<class T>
T* const & G4RWTPtrSortedVector<T>::last () const
{
if(rwsize)
return std_pvector::operator[](rwsize-1);
else
if(!rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrSortedVector last()",rwsize,0));
return std_pvector::operator[](rwsize-1);
}
template<class T>
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: tpvector.h,v 1.9 2000/02/11 14:09:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
+4 -4
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tpvector.icc,v 1.6 2000/02/11 14:09:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: tpvector.icc,v 1.7 2000/03/10 15:53:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -21,8 +21,8 @@ G4RWTPtrVector<T>::G4RWTPtrVector ()
template<class T>
G4RWTPtrVector<T>::G4RWTPtrVector (size_t n)
: std_pvector(n), rwsize(n){}
: std_pvector(n, (T*)0), rwsize(n){} // Here Rogue-Wave would leave
// pointers T* uninitialised.
template<class T>
G4RWTPtrVector<T>::G4RWTPtrVector (size_t n, T* const & iPtr)
: std_pvector(n, iPtr), rwsize(n){}
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tvordvec.h,v 1.7 1999/11/26 17:17:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: tvordvec.h,v 1.8 2000/03/10 15:53:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
+7 -7
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tvordvec.icc,v 1.2 2000/02/01 16:55:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: tvordvec.icc,v 1.5 2000/06/26 16:25:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -17,8 +17,9 @@
template<class T>
G4RWTValOrderedVector<T>::G4RWTValOrderedVector(size_t capacity)
: std_vector(capacity),rwsize(0){}
: std_vector(capacity, T()),rwsize(0){} // Here Rogue-Wave would leave
// members T uninitialised and
// would create an EMPTY vector!
template<class T>
G4RWTValOrderedVector<T>::G4RWTValOrderedVector(const G4RWTValOrderedVector<T>& v)
: std_vector(v),rwsize(v.rwsize){}
@@ -128,10 +129,9 @@ T G4RWTValOrderedVector<T>::first() const
template<class T>
T G4RWTValOrderedVector<T>::last() const
{
if(rwsize)
return std_vector::operator[](rwsize-1);
else
if(!rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector last",rwsize,0));
return std_vector::operator[](rwsize-1);
}
template<class T>
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tvvector.h,v 1.7 1999/11/26 17:17:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: tvvector.h,v 1.8 2000/03/10 15:53:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
+3 -3
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tvvector.icc,v 1.2 2000/02/01 16:55:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: tvvector.icc,v 1.3 2000/03/10 15:53:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -21,7 +21,7 @@ G4RWTValVector<T>::G4RWTValVector ()
template<class T>
G4RWTValVector<T>::G4RWTValVector (size_t n)
: std_vector(n), rwsize(n){}
: std_vector(n,T()), rwsize(n){}
template<class T>
G4RWTValVector<T>::G4RWTValVector (size_t n, const T& ival)