12 typedef std::map<std::string, SniperJSON>::const_iterator
map_iterator;
27 bool isMap()
const {
return m_type == 1; }
78 typedef std::string::size_type StrCursor;
85 std::vector<SniperJSON> m_jvec;
87 std::map<std::string, SniperJSON> m_jmap;
90 static const std::string SPACES;
92 static const std::string DELIMITS;
95 SniperJSON(
const std::string &jstr, StrCursor &cursor);
98 void init(
const std::string &jstr, StrCursor &cursor);
101 char getValidChar(
const std::string &jstr, StrCursor &cursor);
104 void readObjectMap(
const std::string &jstr, StrCursor &cursor);
107 void readArrayVec(
const std::string &jstr, StrCursor &cursor);
110 void readStringStr(
const std::string &jstr, StrCursor &cursor);
113 void readScalarStr(
const std::string &jstr, StrCursor &cursor);
116 template <
typename T>
117 inline void toCppVar(T &var)
const;
120 template <
typename T>
121 inline void toCppVar(std::vector<T> &var)
const;
124 template <
typename K,
typename V>
125 inline void toCppVar(std::map<K, V> &var)
const;
128 class Exception :
public std::exception
131 Exception(
const std::string &msg);
132 Exception(
const std::string &jstr,
int cursor);
133 virtual ~Exception() throw();
134 const
char *what() const throw();
150inline void SniperJSON::toCppVar(T &var)
const
154 std::stringstream ss;
165 std::string(
"cannot set <") +
typeid(T).name() +
"> with '" + m_jvar +
"'");
169inline void SniperJSON::toCppVar<bool>(
bool &var)
const
173 if (m_jvar ==
"true")
178 else if (m_jvar ==
"false")
185 throw Exception(std::string(
"cannot set <bool> with '") + m_jvar +
"'");
189inline void SniperJSON::toCppVar<std::string>(std::string &var)
const
193 var = m_jvar.substr(1, m_jvar.size() - 2);
197 throw Exception(std::string(
"cannot set <std::string> with '") + m_jvar +
"'");
201inline void SniperJSON::toCppVar(std::vector<T> &var)
const
205 for (
vec_iterator it = m_jvec.begin(); it != m_jvec.end(); ++it)
207 var.push_back(it->get<T>());
212 throw Exception(std::string(
"not a valid vector"));
225 template<
typename,
typename>
232template <
typename K,
typename V>
233inline void SniperJSON::toCppVar(std::map<K, V> &var)
const
237 for (
map_iterator it = m_jmap.begin(); it != m_jmap.end(); ++it)
239 var.insert(std::make_pair(
243 it->second.get<V>()));
248 throw Exception(std::string(
"not a valid map"));
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
bool insert(const std::string &key, const SniperJSON &val)
static SniperJSON loads(const std::string &jstr)
map_iterator find(const std::string &key) const
map_iterator map_begin() const
std::vector< SniperJSON >::const_iterator vec_iterator
bool push_back(const SniperJSON &var)
static SniperJSON load(std::istream &is)
SniperJSON & operator[](int index)
vec_iterator vec_end() const
map_iterator map_end() const
vec_iterator vec_begin() const
const SniperJSON & operator[](int index) const
std::map< std::string, SniperJSON >::const_iterator map_iterator