CLHEP/HepPDT/DefTable.hh

00001 // $Id: DefTable.hh,v 1.2 2002/04/12 15:02:43 evc Exp $
00002 // ----------------------------------------------------------------------
00003 //
00004 // DefTable.hh
00005 // Author: Lynn Garren
00006 //
00007 // ----------------------------------------------------------------------
00008 #ifndef DEFTABLE_HH
00009 #define DEFTABLE_HH
00010 
00011 #include "CLHEP/config/CLHEP.h"
00012 #include <string>
00013 #include <map>
00014 
00015 namespace HepPDT {
00016 
00021 class DefTable  {
00022   typedef  std::map<std::string,double>            TempDefMap;
00023 
00024 public:
00025   typedef  TempDefMap::const_iterator  const_iterator;
00026   typedef  TempDefMap::iterator        iterator;
00027 
00028   DefTable( );
00029   ~DefTable()  { ; }
00030 
00031   // --- mutator
00032   //
00033   void addDefinition( std::string const & def, double val ) { tempDefines[def] = val; }
00034 
00035   // --- boolean
00036   //
00037   bool hasDefinition( std::string const & def ) const;
00038 
00039   // --- accessors
00040   //
00041   int             size()  const { return tempDefines.size(); }
00042   double          definition( std::string const & def );
00043   void            writeDefinitions() const;     // intended for diagnostic use
00044 
00045   iterator        begin()       { return tempDefines.begin(); }
00046   const_iterator  begin() const { return tempDefines.begin(); }
00047 
00048   iterator        end()       { return tempDefines.end(); }
00049   const_iterator  end() const { return tempDefines.end(); }
00050 
00051 private:
00052   TempDefMap           tempDefines;     // hold EvtGen "Define" info
00053 
00054   // forbidden copy:
00055   DefTable &  operator = ( DefTable const & );
00056   DefTable( DefTable const & );
00057 
00058 };  // DefTable<>
00059 
00060 }  // namespace HepPDT
00061 
00062 #endif // DEFTABLE_HH

Class Library for High Energy Physics (version 1.8)