The Gaudi Framework  v32r2 (46d42edc)
SVectorAsProperty.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_GENVCTPARSERS_H
2 #define GAUDIKERNEL_GENVCTPARSERS_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <algorithm>
9 #include <vector>
10 // ============================================================================
11 // GaudiKernel
12 // ============================================================================
14 // ============================================================================
15 // ROOT/SVector
16 // ============================================================================
17 #include "Math/SVector.h"
18 // ============================================================================
29 // ============================================================================
30 namespace Gaudi {
31  // ==========================================================================
32  namespace Parsers {
33  // ========================================================================
41  template <class SCALAR, unsigned int N>
42  StatusCode parse( ROOT::Math::SVector<SCALAR, N>& result, const std::string& input ) {
44  StatusCode sc = parse( tmp, input );
45  if ( sc.isFailure() ) { return sc; } // RETURN
46  if ( N != tmp.size() ) { return StatusCode::FAILURE; } // RETURN
47 #ifdef WIN32
48 // Disable warning
49 // C4996: 'std::copy': Function call with parameters that may be unsafe
50 // The parameters are checked
51 # pragma warning( push )
52 # pragma warning( disable : 4996 )
53 #endif
54  std::copy( tmp.begin(), tmp.end(), result.begin() );
55 #ifdef WIN32
56 # pragma warning( pop )
57 #endif
58  return StatusCode::SUCCESS;
59  }
60  // ========================================================================
61  } // namespace Parsers
62  // ==========================================================================
63 } // end of namespace Gaudi
64 // ============================================================================
65 namespace Gaudi {
66  // ==========================================================================
67  namespace Utils {
68  // ========================================================================
69  template <class SCALAR>
70  std::ostream& toStream( const SCALAR&, std::ostream& );
71  // ========================================================================
76  template <class SCALAR, unsigned int N>
77  std::ostream& toStream( const ROOT::Math::SVector<SCALAR, N>& obj, std::ostream& s ) {
78  s << "( ";
79  for ( auto cur = obj.begin(); obj.end() != cur; ++cur ) {
80  if ( obj.begin() != cur ) { s << " , "; }
81  toStream( *cur, s );
82  }
83  return s << " )";
84  }
85  // ========================================================================
86  } // namespace Utils
87  // ==========================================================================
88 } // end of namespace Gaudi
89 // ============================================================================
90 // The END
91 // ============================================================================
92 #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:284
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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:100
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
T size(T... args)
T begin(T... args)
string s
Definition: gaudirun.py:318
constexpr static const auto FAILURE
Definition: StatusCode.h:86
bool isFailure() const
Definition: StatusCode.h:130
STL class.
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1