]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 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 | std::map<std::string,std::string> EvtSymTable::_symMap; | |
33 | ||
34 | ||
35 | EvtSymTable::~EvtSymTable(){} | |
36 | ||
37 | EvtSymTable::EvtSymTable() { | |
38 | ||
39 | } | |
40 | ||
41 | void EvtSymTable::define(const std::string& symname,std::string d) { | |
42 | ||
43 | if ( _symMap.find(symname)!=_symMap.end() ) { | |
44 | report(INFO,"EvtGen") << "Symbol:"<<symname.c_str()<< | |
45 | " redefined, old value:"<<_symMap[symname].c_str()<<" new value:"<<d.c_str()<<endl; | |
46 | _symMap[symname]=d; | |
47 | return; | |
48 | } | |
49 | ||
50 | _symMap[symname]=d; | |
51 | return; | |
52 | } | |
53 | ||
54 | std::string EvtSymTable::get(const std::string& symname,int& ierr) { | |
55 | ||
56 | ierr=0; | |
57 | ||
58 | if ( _symMap.find(symname)!=_symMap.end() ) return _symMap[symname]; | |
59 | ||
60 | // If no matching symbol found just return the string | |
61 | ||
62 | return symname; | |
63 | } | |
64 |