Line data Source code
1 : //--------------------------------------------------------------------------
2 : //
3 : // Environment:
4 : // This software is part of the EvtGen package developed jointly
5 : // for the BaBar and CLEO collaborations. If you use all or part
6 : // of it, please give an appropriate acknowledgement.
7 : //
8 : // Copyright Information: See EvtGen/COPYRIGHT
9 : // Copyright (C) 1998 Caltech, UCSB
10 : //
11 : // Module: EvtSymTable.cc
12 : //
13 : // Description: Class to hold the symbols that are defined
14 : // in the DECAY files.
15 : // Modification history:
16 : //
17 : // RYD May 8, 1997 Module created
18 : //
19 : //------------------------------------------------------------------------
20 : //
21 : #include "EvtGenBase/EvtPatches.hh"
22 : #include <iostream>
23 : #include <fstream>
24 : #include <stdlib.h>
25 : #include <ctype.h>
26 : #include "EvtGenBase/EvtSymTable.hh"
27 : #include "EvtGenBase/EvtReport.hh"
28 : #include <string>
29 : using std::endl;
30 : using std::fstream;
31 :
32 6 : std::map<std::string,std::string> EvtSymTable::_symMap;
33 :
34 :
35 0 : EvtSymTable::~EvtSymTable(){}
36 :
37 0 : EvtSymTable::EvtSymTable() {
38 :
39 0 : }
40 :
41 : void EvtSymTable::define(const std::string& symname,std::string d) {
42 :
43 0 : if ( _symMap.find(symname)!=_symMap.end() ) {
44 0 : report(Severity::Info,"EvtGen") << "Symbol:"<<symname.c_str()<<
45 0 : " redefined, old value:"<<_symMap[symname].c_str()<<" new value:"<<d.c_str()<<endl;
46 0 : _symMap[symname]=d;
47 0 : return;
48 : }
49 :
50 0 : _symMap[symname]=d;
51 0 : return;
52 0 : }
53 :
54 : std::string EvtSymTable::get(const std::string& symname,int& ierr) {
55 :
56 0 : ierr=0;
57 :
58 0 : if ( _symMap.find(symname)!=_symMap.end() ) return _symMap[symname];
59 :
60 : // If no matching symbol found just return the string
61 :
62 0 : return symname;
63 0 : }
64 :
|