// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // // $Id: G4DataVector.hh,v 1.11 2002/04/19 07:10:31 gcosmo Exp $ // GEANT4 tag $Name: geant4-05-00 $ // // // ------------------------------------------------------------ // GEANT 4 class header file // ------------------------------------------------------------ // // Class Description: // // Utility class providing similar behaviour of vector. // It includes additional methods for compatibility with Rogue Wave // collection. // #ifndef G4DataVector_h #define G4DataVector_h 1 #include "globals.hh" #include "g4std/vector" #include "G4ios.hh" #include "g4std/iostream" #include "g4std/fstream" class G4DataVector : public G4std::vector { public: // with description G4DataVector(); // Default constructor. G4DataVector(size_t capacity); // Constructor given a 'capacity' defining the initial number of elements. G4DataVector(size_t capacity, G4double value); // Constructor given a 'capacity' defining the initial number of elements // and initialising them to 'value'. virtual ~G4DataVector(); // Empty destructor inline void insertAt(size_t, const G4double&); // Insert an element at given position inline size_t index(const G4double&); // Returns back index of the element same as given value inline G4bool contains(const G4double&) const; // Returns 'true' if it contains the element same as given value inline G4bool remove(const G4double&); // Removes the first element same as given value inline size_t removeAll(const G4double&); // Remove all elements same as given value enum {T_G4DataVector = 100}; G4bool Store(G4std::ofstream& fOut, G4bool ascii=false); G4bool Retrieve(G4std::ifstream& fIn, G4bool ascii=false); // To store/retrieve persistent data to/from file streams. friend G4std::ostream& operator<<(G4std::ostream&, const G4DataVector&); }; inline void G4DataVector::insertAt(size_t pos, const G4double& a) { iterator i = begin(); for (size_t ptn=0; (ptn