The Gaudi Framework
master (53dee381)
Toggle main menu visibility
Loading...
Searching...
No Matches
ParsersVct.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#include <
Gaudi/Parsers/Factory.h
>
12
#include <
GaudiKernel/ToStream.h
>
13
#include <
GaudiKernel/VectorsAsProperty.h
>
14
#include <format>
15
16
namespace
{
17
typedef
std::map<std::string, double> MAP;
18
19
template
<
unsigned
int
N>
20
inline
MAP::const_iterator find(
const
MAP& m,
const
std::string ( &keys )[N] ) {
21
for
(
unsigned
int
i = 0; i <
N
; ++i ) {
22
auto
found =
m
.find( keys[i] );
23
if
(
m
.end() != found ) {
return
found; }
24
}
25
return
m
.end();
26
}
27
}
// namespace
28
namespace
Gaudi
{
29
namespace
Parsers
{
30
template
<
typename
T1,
typename
T2>
31
inline
StatusCode
parse_
(
ROOT::Math::PositionVector3D<T1, T2>
& result, std::string_view input ) {
32
Skipper
skipper;
33
typename
Grammar_<IteratorT, ROOT::Math::PositionVector3D<T1, T2>
,
Skipper
>::Grammar g;
34
IteratorT
iter = input.begin(), end = input.end();
35
if
( qi::phrase_parse( iter, end, g, skipper, result ) ) {
return
StatusCode::SUCCESS
; }
36
//@attention always
37
return
StatusCode::SUCCESS
;
38
}
39
40
StatusCode
parse
( Gaudi::XYZPoint& result, std::string_view input ) {
return
parse_
( result, input ); }
41
42
/* parse 3D-vector
43
* @param result (output) the parsed vector
44
* @param input (input) the input string
45
* @return status code
46
* @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
47
* @date 2009-09-05
48
*/
49
StatusCode
parse
( Gaudi::XYZVector& result, std::string_view input ) {
50
51
Gaudi::XYZPoint point;
52
StatusCode
sc =
parse
( point, input );
53
if
( sc.
isFailure
() ) {
return
sc; }
54
result = point;
55
return
StatusCode::SUCCESS
;
56
}
57
58
StatusCode
parse
( Gaudi::LorentzVector& result, std::string_view input ) {
return
parse_
( result, input ); }
59
60
/* parse the vector of points
61
* @param resut (OUTPUT) the parser vector
62
* @param input (INPIUT) the string to be parsed
63
* @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
64
* @date 2009-09-05
65
*/
66
StatusCode
parse
( std::vector<Gaudi::XYZPoint>& result, std::string_view input ) {
67
result.clear();
68
return
parse_
( result, input );
69
}
70
/* parse the vector of vectors
71
* @param resut (OUTPUT) the parser vector
72
* @param input (INPIUT) the string to be parsed
73
* @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
74
* @date 2009-09-05
75
*/
76
StatusCode
parse
( std::vector<Gaudi::XYZVector>& result, std::string_view input ) {
77
result.clear();
78
return
parse_
( result, input );
79
}
80
81
/* parse the vector of vectors
82
* @param resut (OUTPUT) the parser vector
83
* @param input (INPIUT) the string to be parsed
84
* @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
85
* @date 2009-09-05
86
*/
87
StatusCode
parse
( std::vector<Gaudi::LorentzVector>& result, std::string_view input ) {
88
return
parse_
( result, input );
89
}
90
}
// namespace Parsers
91
}
// namespace Gaudi
92
std::ostream&
Gaudi::Utils::toStream
(
const
Gaudi::XYZPoint& obj, std::ostream& s ) {
93
return
s << std::format(
"( {} , {} , {} )"
, obj.X(), obj.Y(), obj.Z() );
94
}
95
std::ostream&
Gaudi::Utils::toStream
(
const
Gaudi::XYZVector& obj, std::ostream& s ) {
96
return
s << std::format(
"( {} , {} , {} )"
, obj.X(), obj.Y(), obj.Z() );
97
}
98
std::ostream&
Gaudi::Utils::toStream
(
const
Gaudi::LorentzVector& obj, std::ostream& s ) {
99
return
s << std::format(
"( {} , {} , {} , {} )"
, obj.Px(), obj.Py(), obj.Pz(), obj.E() );
100
}
Factory.h
ToStream.h
implementation of various functions for streaming.
VectorsAsProperty.h
Declaration of parsing functions for various ROOT::Math objects to allow their usage as properties fo...
ROOT::Math::PositionVector3D
Definition
IMagneticFieldSvc.h:22
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::isFailure
bool isFailure() const
Definition
StatusCode.h:118
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
Gaudi::Parsers
Definition
DODBasicMapper.cpp:17
Gaudi::Parsers::Skipper
SkipperGrammar< IteratorT > Skipper
Definition
Factory.h:20
Gaudi::Parsers::parse
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.
Definition
DODBasicMapper.cpp:21
Gaudi::Parsers::IteratorT
std::string_view::const_iterator IteratorT
Definition
Factory.h:19
Gaudi::Parsers::parse_
StatusCode parse_(ResultT &result, std::string_view input)
Definition
Factory.h:22
Gaudi::Units::m
constexpr double m
Definition
SystemOfUnits.h:107
Gaudi::Utils::toStream
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Definition
ToStream.h:307
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
IOTest.N
int N
Definition
IOTest.py:112
Gaudi::Parsers::Grammar_
Definition
Grammars.h:55
GaudiKernel
src
Lib
ParsersVct.cpp
Generated on
for The Gaudi Framework by
1.17.0