The Gaudi Framework  v33r1 (b1225454)
SVectorAsProperty.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 #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, const std::string& 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
T copy(T... args)
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:291
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
T end(T... args)
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
STL class.
int N
Definition: IOTest.py:110
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
T size(T... args)
T begin(T... args)
string s
Definition: gaudirun.py:328
constexpr static const auto FAILURE
Definition: StatusCode.h:101
bool isFailure() const
Definition: StatusCode.h:145
STL class.
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1