The Gaudi Framework  master (37c0b60a)
Factory.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 #pragma once
12 // ============================================================================
13 // Include files
14 // ============================================================================
15 // STD & STL
16 // ============================================================================
17 #include <map>
18 #include <string>
19 #include <vector>
20 // ============================================================================
21 // Boost:
22 // ============================================================================
23 #include <boost/mpl/assert.hpp>
24 #include <boost/type_traits.hpp>
25 // ============================================================================
26 // Gaudi
27 // ============================================================================
28 #include <Gaudi/Parsers/Grammars.h>
29 #include <GaudiKernel/StatusCode.h>
30 // ============================================================================
31 namespace Gaudi {
32  namespace Parsers {
33  // ========================================================================
34  typedef std::string_view::const_iterator IteratorT;
35  // typedef boost::spirit::ascii::space_type Skipper;
37  // ========================================================================
38  template <typename ResultT>
39  inline StatusCode parse_( ResultT& result, std::string_view input ) {
40  Skipper skipper;
42  IteratorT iter = input.begin(), end = input.end();
43  return ( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ? StatusCode::SUCCESS
45  }
46  //=========================================================================
47  template <>
48  inline StatusCode parse_( std::string& result, std::string_view input ) {
49  Skipper skipper;
51  IteratorT iter = input.begin(), end = input.end();
52  if ( !( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ) ) { result = input; }
53  //@attention always
54  return StatusCode::SUCCESS;
55  }
56  //=========================================================================
57  template <typename ResultT>
58  inline StatusCode parse( ResultT& result, std::string_view input ) {
59  return parse_( result, input );
60  }
61  //=========================================================================
62  } // namespace Parsers
63 } // namespace Gaudi
std::string
STL class.
Gaudi::Parsers::IteratorT
std::string_view::const_iterator IteratorT
Definition: Factory.h:34
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
Grammars.h
Gaudi::Parsers::parse_
StatusCode parse_(ResultT &result, std::string_view input)
Definition: Factory.h:39
StatusCode.h
StatusCode
Definition: StatusCode.h:65
gaudirun.g
dictionary g
Definition: gaudirun.py:582
Gaudi::Parsers::SkipperGrammar
Definition: Grammar.h:51
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::Parsers::Skipper
SkipperGrammar< IteratorT > Skipper
Definition: Factory.h:36
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
Gaudi::Parsers::Grammar_
Definition: Grammars.h:68
IOTest.end
end
Definition: IOTest.py:125
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101