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 <vector>
9 #include <algorithm>
10 // ============================================================================
11 // GaudiKernel
12 // ============================================================================
13 #include "GaudiKernel/Parsers.h"
14 // ============================================================================
15 // ROOT/SVector
16 // ============================================================================
17 #include "Math/SVector.h"
18 // ============================================================================
29 // ============================================================================
30 namespace Gaudi
31 {
32  // ==========================================================================
33  namespace Parsers
34  {
35  // ========================================================================
43  template <class SCALAR, unsigned int N>
45  ( ROOT::Math::SVector<SCALAR,N>& result ,
46  const std::string& input )
47  {
49  StatusCode sc = parse ( tmp , input ) ;
50  if ( sc.isFailure() ) { return sc ; } // RETURN
51  if ( N != tmp.size() ) { return StatusCode::FAILURE ; } // RETURN
52 #ifdef WIN32
53 // Disable warning
54 // C4996: 'std::copy': Function call with parameters that may be unsafe
55 // The parameters are checked
56 #pragma warning(push)
57 #pragma warning(disable:4996)
58 #endif
59  std::copy ( tmp.begin() , tmp.end() , result.begin() ) ;
60 #ifdef WIN32
61 #pragma warning(pop)
62 #endif
63  return StatusCode::SUCCESS ;
64  }
65  // ========================================================================
66  } // end of namespace Gaudi::Parsers
67  // ==========================================================================
68 } // end of namespace Gaudi
69 // ============================================================================
70 namespace Gaudi
71 {
72  // ==========================================================================
73  namespace Utils
74  {
75  // ========================================================================
76  template <class SCALAR>
77  std::ostream& toStream ( const SCALAR& , std::ostream& ) ;
78  // ========================================================================
83  template <class SCALAR, unsigned int N>
85  ( const ROOT::Math::SVector<SCALAR,N>& obj , std::ostream& s )
86  {
87  s << "( ";
88  for ( auto cur = obj.begin() ; obj.end() != cur ; ++cur )
89  {
90  if ( obj.begin() != cur ) { s << " , "; }
91  toStream ( *cur , s ) ;
92  }
93  return s << " )";
94  }
95  // ========================================================================
96  } // end of namespace Gaudi::Utils
97  // ==========================================================================
98 } // end of namespace Gaudi
99 // ============================================================================
100 // The END
101 // ============================================================================
102 #endif // GAUDIKERNEL_GENVCTPARSERS_H
103 // ============================================================================
T copy(T...args)
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
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)
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
STL class.
int N
Definition: IOTest.py:90
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
std::ostream & toStream(const ROOT::Math::SVector< SCALAR, N > &obj, std::ostream &s)
the general streaming function for SVector using python-tupel format
T size(T...args)
T begin(T...args)
string s
Definition: gaudirun.py:245
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1