evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
EvtSymTable.cpp
Go to the documentation of this file.
1 
2 /***********************************************************************
3 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4 * *
5 * This file is part of EvtGen. *
6 * *
7 * EvtGen is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * EvtGen is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19 ***********************************************************************/
20 
22 
23 #include "EvtGenBase/EvtPatches.hh"
24 #include "EvtGenBase/EvtReport.hh"
25 
26 #include <ctype.h>
27 #include <fstream>
28 #include <iostream>
29 #include <stdlib.h>
30 #include <string>
31 using std::endl;
32 using std::fstream;
33 
34 std::map<std::string, std::string> EvtSymTable::_symMap;
35 
37 {
38 }
39 
40 void EvtSymTable::define( const std::string& symname, std::string d )
41 {
42  if ( _symMap.find( symname ) != _symMap.end() ) {
43  EvtGenReport( EVTGEN_INFO, "EvtGen" )
44  << "Symbol:" << symname.c_str()
45  << " redefined, old value:" << _symMap[symname].c_str()
46  << " new value:" << d.c_str() << endl;
47  _symMap[symname] = d;
48  return;
49  }
50 
51  _symMap[symname] = d;
52  return;
53 }
54 
55 std::string EvtSymTable::get( const std::string& symname, int& ierr )
56 {
57  ierr = 0;
58 
59  if ( _symMap.find( symname ) != _symMap.end() )
60  return _symMap[symname];
61 
62  // If no matching symbol found just return the string
63 
64  return symname;
65 }
static void define(const std::string &name, std::string d)
Definition: EvtSymTable.cpp:40
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=0)
Definition: EvtReport.cpp:33
static std::string get(const std::string &name, int &ierr)
Definition: EvtSymTable.cpp:55
static std::map< std::string, std::string > _symMap
Definition: EvtSymTable.hh:40