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

#include <SniperJSON.h>

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 SniperJSON.h.

Member Typedef Documentation

◆ map_iterator

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

Definition at line 12 of file SniperJSON.h.

◆ vec_iterator

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

Definition at line 11 of file SniperJSON.h.

Constructor & Destructor Documentation

◆ SniperJSON() [1/2]

SniperJSON::SniperJSON ( )

Definition at line 9 of file SniperJSON.cxx.

10 : m_type(0)
11{
12}

Referenced by loads().

◆ SniperJSON() [2/2]

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

Definition at line 14 of file SniperJSON.cxx.

15 : m_type(0)
16{
17 StrCursor cursor = 0;
18 init(jstr, cursor);
19
20 cursor = jstr.find_first_not_of(SniperJSON::SPACES, cursor);
21 if (cursor != std::string::npos)
22 {
23 throw Exception(jstr, cursor);
24 }
25}

Member Function Documentation

◆ find()

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

Definition at line 64 of file SniperJSON.h.

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 SniperJSON.h.

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 44 of file SniperJSON.cxx.

45{
46 if (m_type == 1 || m_type == 0)
47 {
48 std::string _key = '"' + key + '"';
49 m_jmap.insert(std::make_pair(_key, val));
50 m_type = 1;
51 return true;
52 }
53 return false;
54}

◆ isMap()

bool SniperJSON::isMap ( ) const
inline

Definition at line 27 of file SniperJSON.h.

27{ return m_type == 1; }

◆ isScalar()

bool SniperJSON::isScalar ( ) const
inline

Definition at line 21 of file SniperJSON.h.

21{ return m_type > 2; }

◆ isVector()

bool SniperJSON::isVector ( ) const
inline

Definition at line 24 of file SniperJSON.h.

24{ return m_type == 2; }

◆ load()

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

Definition at line 88 of file SniperJSON.cxx.

89{
90 std::ostringstream oss;
91 oss << is.rdbuf();
92
93 return loads(oss.str());
94}
static SniperJSON loads(const std::string &jstr)
Definition: SniperJSON.cxx:96

Referenced by RawDataInputSvc::initialize(), RawEventReader::initialize(), and MixerAlg::initialize().

◆ loads()

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

Definition at line 96 of file SniperJSON.cxx.

97{
98 return SniperJSON(jstr);
99}

Referenced by load().

◆ map_begin()

map_iterator SniperJSON::map_begin ( ) const
inline

Definition at line 60 of file SniperJSON.h.

60{ return m_jmap.begin(); }

◆ map_end()

map_iterator SniperJSON::map_end ( ) const
inline

Definition at line 62 of file SniperJSON.h.

62{ return m_jmap.end(); }

◆ operator[]() [1/4]

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

Definition at line 78 of file SniperJSON.cxx.

79{
80 return m_jmap.at('"' + key + '"');
81}

◆ operator[]() [2/4]

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

Definition at line 83 of file SniperJSON.cxx.

84{
85 return m_jmap.at('"' + key + '"');
86}

◆ operator[]() [3/4]

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

Definition at line 55 of file SniperJSON.h.

55{ return m_jvec.at(index); }

◆ operator[]() [4/4]

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

Definition at line 57 of file SniperJSON.h.

57{ return m_jvec.at(index); }

◆ push_back()

bool SniperJSON::push_back ( const SniperJSON var)

Definition at line 33 of file SniperJSON.cxx.

34{
35 if (m_type == 2 || m_type == 0)
36 {
37 m_jvec.push_back(var);
38 m_type = 2;
39 return true;
40 }
41 return false;
42}

◆ reset()

void SniperJSON::reset ( )

Definition at line 56 of file SniperJSON.cxx.

57{
58 m_type = 0;
59 m_jvar.clear();
60 m_jvec.clear();
61 m_jmap.clear();
62}

◆ size()

int SniperJSON::size ( ) const

Definition at line 64 of file SniperJSON.cxx.

65{
66 if (m_type == 1)
67 {
68 return m_jmap.size();
69 }
70 else if (m_type == 2)
71 {
72 return m_jvec.size();
73 }
74
75 return -1;
76}

◆ vec_begin()

vec_iterator SniperJSON::vec_begin ( ) const
inline

Definition at line 50 of file SniperJSON.h.

50{ return m_jvec.begin(); }

Referenced by MdcConverter::init().

◆ vec_end()

vec_iterator SniperJSON::vec_end ( ) const
inline

Definition at line 52 of file SniperJSON.h.

52{ return m_jvec.end(); }

Referenced by MdcConverter::init(), and OfflineRevise::OfflineRevise().


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