00001 //-------------------------------------------------------------------------- 00002 // 00003 // Environment: 00004 // This software is part of the EvtGen package developed jointly 00005 // for the BaBar and CLEO collaborations. If you use all or part 00006 // of it, please give an appropriate acknowledgement. 00007 // 00008 // Copyright Information: See EvtGen/COPYRIGHT 00009 // Copyright (C) 1998 Caltech, UCSB 00010 // 00011 // Module: EvtSymTable.cc 00012 // 00013 // Description: Class to hold the symbols that are defined 00014 // in the DECAY files. 00015 // Modification history: 00016 // 00017 // RYD May 8, 1997 Module created 00018 // 00019 //------------------------------------------------------------------------ 00020 // 00021 #include "EvtGenBase/EvtPatches.hh" 00022 #include <iostream> 00023 #include <fstream> 00024 #include <stdlib.h> 00025 #include <ctype.h> 00026 #include "EvtGenBase/EvtSymTable.hh" 00027 #include "EvtGenBase/EvtReport.hh" 00028 #include <string> 00029 using std::endl; 00030 using std::fstream; 00031 00032 std::map<std::string,std::string> EvtSymTable::_symMap; 00033 00034 00035 EvtSymTable::~EvtSymTable(){} 00036 00037 EvtSymTable::EvtSymTable() { 00038 00039 } 00040 00041 void EvtSymTable::Define(const std::string& symname,std::string d) { 00042 00043 if ( _symMap.find(symname)!=_symMap.end() ) { 00044 report(INFO,"EvtGen") << "Symbol:"<<symname.c_str()<< 00045 " redefined, old value:"<<_symMap[symname].c_str()<<" new value:"<<d.c_str()<<endl; 00046 _symMap[symname]=d; 00047 return; 00048 } 00049 00050 _symMap[symname]=d; 00051 return; 00052 } 00053 00054 //double EvtSymTable::Get(const std::string& symname,int& ierr) { 00055 std::string EvtSymTable::Get(const std::string& symname,int& ierr) { 00056 00057 ierr=0; 00058 00059 if ( _symMap.find(symname)!=_symMap.end() ) return _symMap[symname]; 00060 00061 // If no matching symbol found just return the string 00062 00063 return symname; 00064 } 00065