Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -23,86 +23,46 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4OrderedTable
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
// ------------------------------------------------------------
|
||||
// Sep. 1996 : M.Maire
|
||||
// Jan. 2001 : H.Kurashige
|
||||
// - G4ValVector is replaced with G4DataVector
|
||||
// - Migrated to std::vector<G4DataVector*>.
|
||||
// Sep. 2001 : H.Kurashige
|
||||
// - Add
|
||||
// G4bool Store(const G4String&, G4bool)
|
||||
// G4bool Retrieve(const G4String&, G4bool);
|
||||
// ostream& operator<<(ostream&, G4OrderedTable&)
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// Utility class, defining an ordered collection of vectors
|
||||
// of <G4double>.
|
||||
// Utility class, defining an ordered collection of vectors of <G4double>.
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Author: M.Maire (LAPP), September 1996
|
||||
// Revisions: H.Kurashige (Kobe Univ.), January-September 2001
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4OrderedTable_hh
|
||||
#define G4OrderedTable_hh 1
|
||||
|
||||
#ifndef G4OrderedTable_h
|
||||
#define G4OrderedTable_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include <vector>
|
||||
class G4DataVector;
|
||||
|
||||
class G4OrderedTable : public std::vector<G4DataVector*>
|
||||
{
|
||||
|
||||
public: // with description
|
||||
|
||||
G4OrderedTable();
|
||||
// Deafult constructor.
|
||||
|
||||
explicit G4OrderedTable(size_t cap);
|
||||
// Constructor given a 'capacity' defining the initial
|
||||
// number of elements (NULL pointers are filled up)
|
||||
|
||||
virtual ~G4OrderedTable();
|
||||
// Empty Destructor
|
||||
|
||||
inline void clearAndDestroy();
|
||||
// Removes all elements and deletes all non-NULL pointers
|
||||
|
||||
G4bool Store(const G4String& filename, G4bool ascii=false);
|
||||
// Stores OrderedTable in a file (returns false in case of failure).
|
||||
|
||||
G4bool Retrieve(const G4String& filename, G4bool ascii=false);
|
||||
// Retrieves OrderedTable from a file (returns false in case of failure).
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, G4OrderedTable& table);
|
||||
|
||||
};
|
||||
|
||||
typedef G4OrderedTable::iterator G4OrderedTableIterator;
|
||||
|
||||
#include "G4DataVector.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
inline
|
||||
void G4OrderedTable::clearAndDestroy()
|
||||
class G4OrderedTable : public std::vector<G4DataVector*>
|
||||
{
|
||||
G4DataVector* a = 0;
|
||||
while (size()>0)
|
||||
{
|
||||
a = back();
|
||||
pop_back();
|
||||
for (iterator i=begin(); i!=end(); i++)
|
||||
{
|
||||
if (*i==a)
|
||||
{
|
||||
erase(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if ( a ) { delete a; }
|
||||
}
|
||||
}
|
||||
public:
|
||||
G4OrderedTable();
|
||||
// Default constructor
|
||||
|
||||
explicit G4OrderedTable(std::size_t cap);
|
||||
// Constructor given a 'capacity' defining the initial
|
||||
// number of elements (NULL pointers are filled up)
|
||||
|
||||
virtual ~G4OrderedTable();
|
||||
// Empty Destructor
|
||||
|
||||
void clearAndDestroy();
|
||||
// Removes all elements and deletes all non-NULL pointers
|
||||
|
||||
G4bool Store(const G4String& filename, G4bool ascii = false);
|
||||
// Stores OrderedTable in a file (returns false in case of failure)
|
||||
|
||||
G4bool Retrieve(const G4String& filename, G4bool ascii = false);
|
||||
// Retrieves OrderedTable from a file (returns false in case of failure)
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, G4OrderedTable& table);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user