Import Geant4 1.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:34:16 +02:00
parent ca1c8cb059
commit 103bda00c8
2654 changed files with 29719 additions and 20203 deletions
+21 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.16 1999/11/29 10:17:36 gcosmo Exp $
$Id: History,v 1.19 2000/02/11 14:08:38 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,26 @@ committal in the CVS repository !
STL Interface
-------------
February 8, 00 G.Cosmo
- cstring.icc: fixed yet another bug in G4String::toUpper() and
G4String::toLower(). Loop over the string characters was causing
bounds overflow.
- tpvector[.h.icc]: added resize(size_t) method which was missing!
January 28, 00 G.Cosmo (STLInterface-V01-00-00)
- Fixed bug in G4String::toUpper().
(bug was introduced inadvertently on 20-Oct-1999).
- Added checks for bound-overflows in G4RWTPtrSortedVector::find().
- Fixed bound-check for operators () and [] in most collections:
() access operators DO NOT perform bound-checking (except if G4DEBUG set);
[] access operators DO perform bound-checking.
- tpvector[.h.icc]: changed 'unsigned int' to 'size_t' in constructors.
Added 'rwsize' and bound-checking for operator[].
- tvvector.icc: added call to std_vector() in default constructor.
- tpordvec.icc: added std_pvector:: scope for calls to [] operator,
where missing.
- tvordvec.icc: added std_vector:: scope for calls to [] operator,
where missing.
November 29, 99 G.Cosmo
- Removed references to g4std/string, now removed since not anymore
+3 -6
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.6 1999/11/29 10:17:39 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: cstring.h,v 1.7 1999/12/15 18:12:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -29,10 +29,7 @@
#include <string>
#include "G4Types.hh"
#include "g4rw/defs.h"
#ifdef __KCC
#include <istream>
#endif
#include "g4std/iostream"
#ifdef WIN32
#define strcasecmp _stricmp
+5 -5
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.2 1999/11/26 17:17:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: cstring.icc,v 1.4 2000/02/08 14:15:42 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -363,7 +363,7 @@ G4String G4String::strip (int stripType, char c)
void G4String::toLower ( void )
{
for (int i=0; i<=size();i++)
for (int i=0; i<size();i++)
{
//GB:HP-UX-aCC,Linux-KCC
std_string::operator[](i) = tolower(std_string::operator[](i));
@@ -373,10 +373,10 @@ void G4String::toLower ( void )
void G4String::toUpper ( void )
{
for (int i=0; i<=size();i++)
for (int i=0; i<size();i++)
{
//GB:HP-UX-aCC,Linux-KCC
std_string::operator[](i) = tolower(std_string::operator[](i));
std_string::operator[](i) = toupper(std_string::operator[](i));
//at(i) = toupper(at(i));
}
}
+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-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: defs.h,v 1.7 1999/11/29 16:52:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
+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-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -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-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
+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-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
+17 -12
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.1 1999/11/25 10:14:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: tpordvec.icc,v 1.2 2000/02/01 16:55:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -38,17 +38,23 @@ G4RWTPtrOrderedVector<T>::operator=(const G4RWTPtrOrderedVector<T>& v)
template<class T >
T*& G4RWTPtrOrderedVector<T>::operator()(size_t i)
{
//if(i>=rwsize)
// G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector ()",rwsize,i));
if(i<std_pvector::size() && rwsize<=i) rwsize=i+1;
// temporarly commented; to allow use as left-value rwsize is increased
// #ifdef G4DEBUG
// if(i>=rwsize)
// G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector []",rwsize,i));
// #endif
if(rwsize<=i && i<std_pvector::size())
rwsize=i+1;
return std_pvector::operator[](i);
}
template<class T >
T* const& G4RWTPtrOrderedVector<T>::operator()(size_t i) const
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector const ()",rwsize,i));
#ifdef G4DEBUG
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector []",rwsize,i));
#endif
return std_pvector::operator[](i);
}
@@ -57,7 +63,6 @@ T*& G4RWTPtrOrderedVector<T>::operator[](size_t i)
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector []",rwsize,i));
//if(i<std_pvector::size() && rwsize<=i) rwsize=i+1;
return std_pvector::operator[](i);
}
@@ -66,7 +71,7 @@ T* const& G4RWTPtrOrderedVector<T>::operator[](size_t i) const
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector const []",rwsize,i));
return std_pvector::operator[](i);
return std_pvector::operator[](i);
}
template<class T >
@@ -199,7 +204,7 @@ T* G4RWTPtrOrderedVector<T>::removeAt( size_t i )
for(j=0;j<rwsize && j<i;j++) it++;
if(it!=std_pvector::end())
{
T* tmp = operator[](i);
T* tmp = std_pvector::operator[](i);
std_pvector::erase(it);
rwsize--;
return tmp;
@@ -313,7 +318,7 @@ T*& G4RWTPtrOrderedVector<T>::at ( size_t i )
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector at",rwsize,i));
return operator()(i);
return std_pvector::operator[](i);
}
template<class T>
@@ -321,7 +326,7 @@ T*const& G4RWTPtrOrderedVector<T>::at ( size_t i ) const
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrOrderedVector const at",rwsize,i));
return operator()(i);
return std_pvector::operator[](i);
}
template<class T>
+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-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
+8 -6
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.2 1999/11/25 13:41:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: tpsrtvec.icc,v 1.3 2000/02/01 16:55:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -50,6 +50,10 @@ T* const& G4RWTPtrSortedVector<T>::operator [] (size_t n) const
template<class T>
T* const& G4RWTPtrSortedVector<T>::operator () (size_t n) const
{
#ifdef G4DEBUG
if(n>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrSortedVector",rwsize,n));
#endif
return std_pvector::operator[](n);
}
@@ -58,8 +62,6 @@ T*& G4RWTPtrSortedVector<T>::at(size_t n )
{
if(n>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrSortedVector",rwsize,n));
if(n<std_pvector::size() && rwsize<=n)
rwsize=n+1;
return std_pvector::operator[](n);
}
@@ -91,7 +93,7 @@ void G4RWTPtrSortedVector<T>::clearAndDestroy ()
template<class T>
T* G4RWTPtrSortedVector<T>::find (const T* a) const
{
if(!a || std_pvector::empty()) return 0;
if(!a || std_pvector::empty() || (rwsize==0)) return 0;
//We are sorted, so try a n log n search
int t,d;
int u=rwsize,l=0;
@@ -107,7 +109,7 @@ T* G4RWTPtrSortedVector<T>::find (const T* a) const
}
while(d>0);
if(*(*this)[u]==*a)
if ((u<rwsize) && (*(*this)[u]==*a))
return (*this)[u];
else
return 0;
+9 -4
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: tpvector.h,v 1.7 1999/11/26 17:17:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: tpvector.h,v 1.9 2000/02/11 14:09:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -39,8 +39,8 @@ class G4RWTPtrVector : public G4std::vector<T*>
public:
G4RWTPtrVector ();
G4RWTPtrVector (unsigned int);
G4RWTPtrVector (unsigned int, T* const &);
G4RWTPtrVector (size_t);
G4RWTPtrVector (size_t, T* const &);
G4RWTPtrVector (const G4RWTPtrVector<T>&);
virtual ~G4RWTPtrVector();
@@ -54,6 +54,11 @@ public:
inline T* const * data() const;
inline size_t length();
inline void reshape(size_t);
void resize(size_t);
private:
size_t rwsize;
};
+42 -9
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.4 1999/11/25 10:14:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: tpvector.icc,v 1.6 2000/02/11 14:09:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -17,19 +17,19 @@
template<class T>
G4RWTPtrVector<T>::G4RWTPtrVector ()
: std_pvector(){}
: std_pvector(), rwsize(0){}
template<class T>
G4RWTPtrVector<T>::G4RWTPtrVector (unsigned int n)
: std_pvector(n){}
G4RWTPtrVector<T>::G4RWTPtrVector (size_t n)
: std_pvector(n), rwsize(n){}
template<class T>
G4RWTPtrVector<T>::G4RWTPtrVector (unsigned int n, T* const & iPtr)
: std_pvector(n, iPtr){}
G4RWTPtrVector<T>::G4RWTPtrVector (size_t n, T* const & iPtr)
: std_pvector(n, iPtr), rwsize(n){}
template<class T>
G4RWTPtrVector<T>::G4RWTPtrVector (const G4RWTPtrVector<T>& iPtr)
: std_pvector(iPtr){}
: std_pvector(iPtr), rwsize(iPtr.rwsize){}
template<class T>
G4RWTPtrVector<T>::~G4RWTPtrVector(){}
@@ -37,9 +37,10 @@ G4RWTPtrVector<T>::~G4RWTPtrVector(){}
template<class T>
G4RWTPtrVector<T>& G4RWTPtrVector<T>::operator = (T* p)
{
rwsize=0;
for(iterator i = std_pvector::begin(); i != std_pvector::end(); ++i)
{
*i = p;
*i = p; rwsize++;
}
return *this;
}
@@ -47,12 +48,23 @@ G4RWTPtrVector<T>& G4RWTPtrVector<T>::operator = (T* p)
template<class T>
T* G4RWTPtrVector<T>::operator () ( size_t n ) const
{
#ifdef G4DEBUG
if(n>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrVector operator()",rwsize,n));
#endif
return std_pvector::operator[](n);
}
template<class T>
T*& G4RWTPtrVector<T>::operator () ( size_t n )
{
// temporarly commented; to allow use as left-value rwsize is increased
// #ifdef G4DEBUG
// if(n>=rwsize)
// G4RWTHROW(G4RWBoundsErr("G4RWTPtrVector operator()",rwsize,n));
// #endif
if(rwsize<=n && n<std_pvector::size())
rwsize=n+1;
return std_pvector::operator[](n);
}
@@ -61,12 +73,16 @@ T*& G4RWTPtrVector<T>::operator () ( size_t n )
template<class T>
T* G4RWTPtrVector<T>::operator [] ( size_t n ) const
{
if(n>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrVector",rwsize,n));
return std_pvector::operator[](n);
}
template<class T>
T*& G4RWTPtrVector<T>::operator [] ( size_t n )
{
if(n>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTPtrVector",rwsize,n));
return std_pvector::operator[](n);
}
@@ -82,8 +98,25 @@ size_t G4RWTPtrVector<T>::length()
return std_pvector::size();
}
template<class T>
void G4RWTPtrVector<T>::resize ( size_t n )
{
if(n>std_pvector::size())
{
int e=n-std_pvector::size();
for(int i=0;i<e;i++)
std_pvector::push_back(0);
}
else
{
std_pvector::resize(n);
}
rwsize=n;
}
template<class T>
void G4RWTPtrVector<T>::reshape( size_t n )
{
std_pvector::resize(n);
rwsize=n;
}
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: tvordvec.h,v 1.7 1999/11/26 17:17:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
+15 -12
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.1 1999/11/25 10:14:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: tvordvec.icc,v 1.2 2000/02/01 16:55:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -38,9 +38,12 @@ G4RWTValOrderedVector<T>::operator=(const G4RWTValOrderedVector<T>& v)
template<class T>
T& G4RWTValOrderedVector<T>::operator()(size_t i)
{
//if(i>=rwsize)
// G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector ()",rwsize,i));
if(i<std_vector::size() && rwsize<=i)
// temporarly commented; to allow use as left-value rwsize is increased
// #ifdef G4DEBUG
// if(i>=rwsize)
// G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector ()",rwsize,i));
// #endif
if(rwsize<=i && i<std_vector::size())
rwsize=i+1;
return std_vector::operator[](i);
}
@@ -48,8 +51,10 @@ T& G4RWTValOrderedVector<T>::operator()(size_t i)
template<class T>
const T& G4RWTValOrderedVector<T>::operator()(size_t i) const
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector const()",rwsize,i));
#ifdef G4DEBUG
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector const()",rwsize,i));
#endif
return std_vector::operator[](i);
}
@@ -58,8 +63,6 @@ T& G4RWTValOrderedVector<T>::operator[](size_t i)
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector []",rwsize,i));
//if(i<std_vector::size() && rwsize<=i)
// rwsize=i+1;
return std_vector::operator[](i);
}
@@ -76,7 +79,7 @@ T& G4RWTValOrderedVector<T>::at(size_t n)
{
if(n>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector at",rwsize,n));
return operator()(n);
return std_vector::operator[](n);
}
template<class T>
@@ -84,7 +87,7 @@ T G4RWTValOrderedVector<T>::at(size_t n ) const
{
if(n>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector const at",rwsize,n));
return operator()(n);
return std_vector::operator[](n);
}
template<class T>
@@ -199,7 +202,7 @@ T G4RWTValOrderedVector<T>::removeAt( size_t i )
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValOrderedVector removeAt",rwsize,i));
T tmp = operator[](i);
T tmp = std_vector::operator[](i);
iterator it=std_vector::begin();
int j;
for(j=0;j<rwsize && j<i;j++) it++;
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: tvvector.h,v 1.7 1999/11/26 17:17:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
+13 -8
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.1 1999/11/25 10:14:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-00 $
// $Id: tvvector.icc,v 1.2 2000/02/01 16:55:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
//
//
//---------------------------------------------------------------
@@ -17,7 +17,7 @@
template<class T>
G4RWTValVector<T>::G4RWTValVector ()
: rwsize(0){}
: std_vector(), rwsize(0){}
template<class T>
G4RWTValVector<T>::G4RWTValVector (size_t n)
@@ -52,9 +52,12 @@ size_t G4RWTValVector<T>::length() const
template<class T>
T& G4RWTValVector<T>::operator()(size_t i)
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValVector operator()",rwsize,i));
if(i<std_vector::size() && rwsize<i)
// temporarly commented; to allow use as left-value rwsize is increased
// #ifdef G4DEBUG
// if(i>=rwsize)
// G4RWTHROW(G4RWBoundsErr("G4RWTValVector operator()",rwsize,i));
// #endif
if(rwsize<=i && i<std_vector::size())
rwsize=i+1;
return std_vector::operator[](i);
}
@@ -62,6 +65,10 @@ T& G4RWTValVector<T>::operator()(size_t i)
template<class T>
const T& G4RWTValVector<T>::operator()(size_t i) const
{
#ifdef G4DEBUG
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValVector operator()",rwsize,i));
#endif
return std_vector::operator[](i);
}
@@ -70,8 +77,6 @@ T& G4RWTValVector<T>::operator[](size_t i)
{
if(i>=rwsize)
G4RWTHROW(G4RWBoundsErr("G4RWTValVector operator[]",rwsize,i));
if(i<std_vector::size() && rwsize<i)
rwsize=i+1;
return std_vector::operator[](i);
}
@@ -0,0 +1 @@
#include <fstream.h>