The Gaudi Framework  v29r0 (ff2e7097)
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 // ============================================================================
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>
44  StatusCode parse( ROOT::Math::SVector<SCALAR, N>& result, const std::string& input )
45  {
47  StatusCode sc = parse( tmp, input );
48  if ( sc.isFailure() ) {
49  return sc;
50  } // RETURN
51  if ( N != tmp.size() ) {
52  return StatusCode::FAILURE;
53  } // RETURN
54 #ifdef WIN32
55 // Disable warning
56 // C4996: 'std::copy': Function call with parameters that may be unsafe
57 // The parameters are checked
58 #pragma warning( push )
59 #pragma warning( disable : 4996 )
60 #endif
61  std::copy( tmp.begin(), tmp.end(), result.begin() );
62 #ifdef WIN32
63 #pragma warning( pop )
64 #endif
65  return StatusCode::SUCCESS;
66  }
67  // ========================================================================
68  } // end of namespace Gaudi::Parsers
69  // ==========================================================================
70 } // end of namespace Gaudi
71 // ============================================================================
72 namespace Gaudi
73 {
74  // ==========================================================================
75  namespace Utils
76  {
77  // ========================================================================
78  template <class SCALAR>
79  std::ostream& toStream( const SCALAR&, std::ostream& );
80  // ========================================================================
85  template <class SCALAR, unsigned int N>
86  std::ostream& toStream( const ROOT::Math::SVector<SCALAR, N>& obj, std::ostream& s )
87  {
88  s << "( ";
89  for ( auto cur = obj.begin(); obj.end() != cur; ++cur ) {
90  if ( obj.begin() != cur ) {
91  s << " , ";
92  }
93  toStream( *cur, s );
94  }
95  return s << " )";
96  }
97  // ========================================================================
98  } // end of namespace Gaudi::Utils
99  // ==========================================================================
100 } // end of namespace Gaudi
101 // ============================================================================
102 // The END
103 // ============================================================================
104 #endif // GAUDIKERNEL_GENVCTPARSERS_H
105 // ============================================================================
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:86
STL class.
int N
Definition: IOTest.py:101
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
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:253
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1