The Gaudi Framework  master (37c0b60a)
SVectorAsProperty.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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 #ifndef GAUDIKERNEL_GENVCTPARSERS_H
12 #define GAUDIKERNEL_GENVCTPARSERS_H 1
13 // ============================================================================
14 // Include files
15 // ============================================================================
16 // STD & STL
17 // ============================================================================
18 #include <algorithm>
19 #include <vector>
20 // ============================================================================
21 // GaudiKernel
22 // ============================================================================
24 // ============================================================================
25 // ROOT/SVector
26 // ============================================================================
27 #include <Math/SVector.h>
28 // ============================================================================
39 // ============================================================================
40 namespace Gaudi {
41  // ==========================================================================
42  namespace Parsers {
43  // ========================================================================
51  template <class SCALAR, unsigned int N>
52  StatusCode parse( ROOT::Math::SVector<SCALAR, N>& result, std::string_view input ) {
54  StatusCode sc = parse( tmp, input );
55  if ( sc.isFailure() ) { return sc; } // RETURN
56  if ( N != tmp.size() ) { return StatusCode::FAILURE; } // RETURN
57 #ifdef WIN32
58 // Disable warning
59 // C4996: 'std::copy': Function call with parameters that may be unsafe
60 // The parameters are checked
61 # pragma warning( push )
62 # pragma warning( disable : 4996 )
63 #endif
64  std::copy( tmp.begin(), tmp.end(), result.begin() );
65 #ifdef WIN32
66 # pragma warning( pop )
67 #endif
68  return StatusCode::SUCCESS;
69  }
70  // ========================================================================
71  } // namespace Parsers
72  // ==========================================================================
73 } // end of namespace Gaudi
74 // ============================================================================
75 namespace Gaudi {
76  // ==========================================================================
77  namespace Utils {
78  // ========================================================================
79  template <class SCALAR>
80  std::ostream& toStream( const SCALAR&, std::ostream& );
81  // ========================================================================
86  template <class SCALAR, unsigned int N>
87  std::ostream& toStream( const ROOT::Math::SVector<SCALAR, N>& obj, std::ostream& s ) {
88  s << "( ";
89  for ( auto cur = obj.begin(); obj.end() != cur; ++cur ) {
90  if ( obj.begin() != cur ) { s << " , "; }
91  toStream( *cur, s );
92  }
93  return s << " )";
94  }
95  // ========================================================================
96  } // namespace Utils
97  // ==========================================================================
98 } // end of namespace Gaudi
99 // ============================================================================
100 // The END
101 // ============================================================================
102 #endif // GAUDIKERNEL_GENVCTPARSERS_H
IOTest.N
N
Definition: IOTest.py:112
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
gaudirun.s
string s
Definition: gaudirun.py:346
std::vector< double >
std::vector::size
T size(T... args)
StatusCode
Definition: StatusCode.h:65
std::ostream
STL class.
std::copy
T copy(T... args)
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
CommonParsers.h
std::vector::begin
T begin(T... args)
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:299
std::vector::end
T end(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101