Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v28r2p1 (f1a77ff4)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
StdArrayAsProperty.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_STDARRAYASPROPERTY_H
2 #define GAUDIKERNEL_STDARRAYASPROPERTY_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <algorithm>
9 #include <array>
10 // ============================================================================
22 // ============================================================================
23 // 1) Streamers : value -> string
24 // ============================================================================
25 namespace Gaudi
26 {
27  // ==========================================================================
28  namespace Utils
29  {
30  // ========================================================================
31  template <class ITERATOR>
32  inline std::ostream& toStream
33  ( ITERATOR first , // begin of the sequence
34  ITERATOR last , // end of the sequence
35  std::ostream& s , // the stream
36  const std::string& open , // opening
37  const std::string& close , // closing
38  const std::string& delim ) ; // delimiter
39  // ========================================================================
48  template <class TYPE, std::size_t N>
49  inline std::ostream& toStream
50  ( const std::array<TYPE,N>& obj , std::ostream& s )
51  {
52  return toStream
53  ( obj.begin () , obj.end () , s , " ( " , " )" , " , " ) ;
54  }
55  // ========================================================================
56  } // end of namespace Gaudi::Utils
57  // ==========================================================================
58 } // end of namespace Gaudi
59 // ============================================================================
60 // 2) Parsers: string -> value
61 // ============================================================================
62 // GaudiKernel
63 // ============================================================================
64 #include "GaudiKernel/Parsers.h"
65 // ============================================================================
66 namespace Gaudi
67 {
68  // ==========================================================================
69  namespace Parsers
70  {
71  // ========================================================================
79  template <class TYPE, std::size_t N>
81  parse ( std::array<TYPE,N>& result , const std::string& input )
82  {
83  typedef std::vector<TYPE> _Vct ;
84  // create the temporaty vector
85  _Vct tmp ;
86  // parse the string
87  StatusCode sc = parse ( tmp , input ) ;
88  if ( sc.isFailure () ) { return sc ; } // RETURN
89  if ( N != tmp.size() )
90  { return StatusCode ( StatusCode::FAILURE , true ) ; } // RETURN
91  // copy vector into array
92  std::copy ( tmp.begin() , tmp.end() , result.begin() ) ;
93  //
94  return StatusCode::SUCCESS ;
95  }
96  // ========================================================================
97  } // end of namespace Gaudi::Parsers
98  // ==========================================================================
99 } // end of namespace Gaudi
100 // ============================================================================
101 // The END
102 // ============================================================================
103 #endif // GAUDIKERNEL_STDARRAYASPROPERTY_H
104 // ============================================================================
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:315
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
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
StatusCode parse(std::array< TYPE, N > &result, const std::string &input)
parse class std::array from the string
STL class.
T begin(T...args)
string s
Definition: gaudirun.py:245
STL class.
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1