BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
SniperJSON Class Reference

Public Types

typedef std::vector< SniperJSON >::const_iterator vec_iterator
 
typedef std::map< std::string, SniperJSON >::const_iterator map_iterator
 

Public Member Functions

 SniperJSON ()
 
 SniperJSON (const std::string &jstr)
 
bool isScalar () const
 
bool isVector () const
 
bool isMap () const
 
template<typename T >
get () const
 
bool push_back (const SniperJSON &var)
 
bool insert (const std::string &key, const SniperJSON &val)
 
void reset ()
 
int size () const
 
vec_iterator vec_begin () const
 
vec_iterator vec_end () const
 
SniperJSONoperator[] (int index)
 
const SniperJSONoperator[] (int index) const
 
map_iterator map_begin () const
 
map_iterator map_end () const
 
map_iterator find (const std::string &key) const
 
SniperJSONoperator[] (const std::string &key)
 
const SniperJSONoperator[] (const std::string &key) const
 

Static Public Member Functions

static SniperJSON load (std::istream &is)
 
static SniperJSON loads (const std::string &jstr)
 

Detailed Description

Definition at line 8 of file OfflineRevise.cxx.

Member Typedef Documentation

◆ map_iterator

typedef std::map<std::string,SniperJSON>::const_iterator SniperJSON::map_iterator

Definition at line 12 of file OfflineRevise.cxx.

◆ vec_iterator

typedef std::vector<SniperJSON>::const_iterator SniperJSON::vec_iterator

Definition at line 11 of file OfflineRevise.cxx.

Constructor & Destructor Documentation

◆ SniperJSON() [1/2]

SniperJSON::SniperJSON ( )

Definition at line 256 of file OfflineRevise.cxx.

257 : m_type(0)
258{
259}

Referenced by loads().

◆ SniperJSON() [2/2]

SniperJSON::SniperJSON ( const std::string &  jstr)

Definition at line 261 of file OfflineRevise.cxx.

262 : m_type(0)
263{
264 StrCursor cursor = 0;
265 init(jstr, cursor);
266
267 cursor = jstr.find_first_not_of(SniperJSON::SPACES, cursor);
268 if (cursor != std::string::npos)
269 {
270 throw Exception(jstr, cursor);
271 }
272}

Member Function Documentation

◆ find()

map_iterator SniperJSON::find ( const std::string &  key) const
inline

Definition at line 64 of file OfflineRevise.cxx.

64{ return m_jmap.find(key); }
*************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
Definition: Taupair.h:42

◆ get()

template<typename T >
T SniperJSON::get

Definition at line 142 of file OfflineRevise.cxx.

143{
144 T v;
145 toCppVar(v);
146 return v;
147}
**********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
Definition: KarLud.h:35

Referenced by OfflineRevise::OfflineRevise().

◆ insert()

bool SniperJSON::insert ( const std::string &  key,
const SniperJSON val 
)

Definition at line 291 of file OfflineRevise.cxx.

292{
293 if (m_type == 1 || m_type == 0)
294 {
295 std::string _key = '"' + key + '"';
296 m_jmap.insert(std::make_pair(_key, val));
297 m_type = 1;
298 return true;
299 }
300 return false;
301}

◆ isMap()

bool SniperJSON::isMap ( ) const
inline

Definition at line 27 of file OfflineRevise.cxx.

27{ return m_type == 1; }

◆ isScalar()

bool SniperJSON::isScalar ( ) const
inline

Definition at line 21 of file OfflineRevise.cxx.

21{ return m_type > 2; }

◆ isVector()

bool SniperJSON::isVector ( ) const
inline

Definition at line 24 of file OfflineRevise.cxx.

24{ return m_type == 2; }

◆ load()

SniperJSON SniperJSON::load ( std::istream &  is)
static

Definition at line 335 of file OfflineRevise.cxx.

336{
337 std::ostringstream oss;
338 oss << is.rdbuf();
339
340 return loads(oss.str());
341}
static SniperJSON loads(const std::string &jstr)

Referenced by OfflineRevise::OfflineRevise().

◆ loads()

SniperJSON SniperJSON::loads ( const std::string &  jstr)
static

Definition at line 343 of file OfflineRevise.cxx.

344{
345 return SniperJSON(jstr);
346}

Referenced by load().

◆ map_begin()

map_iterator SniperJSON::map_begin ( ) const
inline

Definition at line 60 of file OfflineRevise.cxx.

60{ return m_jmap.begin(); }

◆ map_end()

map_iterator SniperJSON::map_end ( ) const
inline

Definition at line 62 of file OfflineRevise.cxx.

62{ return m_jmap.end(); }

◆ operator[]() [1/4]

SniperJSON & SniperJSON::operator[] ( const std::string &  key)

Definition at line 325 of file OfflineRevise.cxx.

326{
327 return m_jmap.at('"' + key + '"');
328}

◆ operator[]() [2/4]

const SniperJSON & SniperJSON::operator[] ( const std::string &  key) const

Definition at line 330 of file OfflineRevise.cxx.

331{
332 return m_jmap.at('"' + key + '"');
333}

◆ operator[]() [3/4]

SniperJSON & SniperJSON::operator[] ( int  index)
inline

Definition at line 55 of file OfflineRevise.cxx.

55{ return m_jvec.at(index); }

◆ operator[]() [4/4]

const SniperJSON & SniperJSON::operator[] ( int  index) const
inline

Definition at line 57 of file OfflineRevise.cxx.

57{ return m_jvec.at(index); }

◆ push_back()

bool SniperJSON::push_back ( const SniperJSON var)

Definition at line 280 of file OfflineRevise.cxx.

281{
282 if (m_type == 2 || m_type == 0)
283 {
284 m_jvec.push_back(var);
285 m_type = 2;
286 return true;
287 }
288 return false;
289}

◆ reset()

void SniperJSON::reset ( )

Definition at line 303 of file OfflineRevise.cxx.

304{
305 m_type = 0;
306 m_jvar.clear();
307 m_jvec.clear();
308 m_jmap.clear();
309}

◆ size()

int SniperJSON::size ( ) const

Definition at line 311 of file OfflineRevise.cxx.

312{
313 if (m_type == 1)
314 {
315 return m_jmap.size();
316 }
317 else if (m_type == 2)
318 {
319 return m_jvec.size();
320 }
321
322 return -1;
323}

◆ vec_begin()

vec_iterator SniperJSON::vec_begin ( ) const
inline

Definition at line 50 of file OfflineRevise.cxx.

50{ return m_jvec.begin(); }

◆ vec_end()

vec_iterator SniperJSON::vec_end ( ) const
inline

Definition at line 52 of file OfflineRevise.cxx.

52{ return m_jvec.end(); }

Referenced by OfflineRevise::OfflineRevise().


The documentation for this class was generated from the following file: