All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SVectorAsProperty.h
Go to the documentation of this file.
1 // $Id: $
2 // ============================================================================
3 #ifndef GAUDIKERNEL_GENVCTPARSERS_H
4 #define GAUDIKERNEL_GENVCTPARSERS_H 1
5 // ============================================================================
6 // Include files
7 // ============================================================================
8 // STD & STL
9 // ============================================================================
10 #include <vector>
11 #include <algorithm>
12 // ============================================================================
13 // GaudiKernel
14 // ============================================================================
15 #include "GaudiKernel/Parsers.h"
16 // ============================================================================
17 // ROOT/SVector
18 // ============================================================================
19 #include "Math/SVector.h"
20 // ============================================================================
31 // ============================================================================
32 namespace Gaudi
33 {
34  // ==========================================================================
35  namespace Parsers
36  {
37  // ========================================================================
45  template <class SCALAR, unsigned int N>
47  ( ROOT::Math::SVector<SCALAR,N>& result ,
48  const std::string& input )
49  {
50  std::vector<double> tmp ;
51  StatusCode sc = parse ( tmp , input ) ;
52  if ( sc.isFailure() ) { return sc ; } // RETURN
53  if ( N != tmp.size() ) { return StatusCode::FAILURE ; } // 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
87  ( const ROOT::Math::SVector<SCALAR,N>& obj , std::ostream& s )
88  {
89  s << "( ";
90  for ( typename ROOT::Math::SVector<SCALAR,N>::const_iterator cur = obj.begin() ;
91  obj.end() != cur ; ++cur )
92  {
93  if ( obj.begin() != cur ) { s << " , "; }
94  toStream ( *cur , s ) ;
95  }
96  return s << " )";
97  }
98  // ========================================================================
99  } // end of namespace Gaudi::Utils
100  // ==========================================================================
101 } // end of namespace Gaudi
102 // ============================================================================
103 // The END
104 // ============================================================================
105 #endif // GAUDIKERNEL_GENVCTPARSERS_H
106 // ============================================================================
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.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
int N
Definition: IOTest.py:90
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:341
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
string s
Definition: gaudirun.py:210
This is a number of static methods for bootstrapping the Gaudi framework.
Definition: Bootstrap.h:15