// // ******************************************************************** // * 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: G4ParticleTableIterator.hh,v 1.5 2001/07/11 10:01:58 gunter Exp $ // GEANT4 tag $Name: geant4-05-00 $ // // // ------------------------------------------------------------ // GEANT 4 class header file // // History: first implementation, based on object model of // 28 Oct 1999, H.Kurashige // ------------------------------------------------------------ #ifndef G4ParticleTableIterator_h #define G4ParticleTableIterator_h 1 #include "g4std/map" template < class K, class V > class G4ParticleTableIterator { public: typedef G4std::map > Map; G4ParticleTableIterator( Map &adict): it(adict.begin()), mydict(&adict), defined(false) {} G4bool operator++ () { if(!defined) return false; it++; return it!=mydict->end() ? true : false; } G4bool operator()() { if(defined) { return operator++(); } else { defined=true; it=mydict->begin(); return it!=mydict->end() ? true : false; } } void reset (){defined=false;} K* key() const { return &((*it).first); } V value() const { return (*it).second; } private: typename Map::iterator it; Map * mydict; G4bool defined; }; #endif