The Gaudi Framework  v28r3 (cc1cf868)
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 #include "GaudiKernel/ToStream.h"
11 // ============================================================================
23 // ============================================================================
24 // 1) Streamers : value -> string
25 // ============================================================================
26 namespace Gaudi
27 {
28  // ==========================================================================
29  namespace Utils
30  {
31  // ========================================================================
32  template <class ITERATOR>
33  inline std::ostream& toStream
34  ( ITERATOR first , // begin of the sequence
35  ITERATOR last , // end of the sequence
36  std::ostream& s , // the stream
37  const std::string& open , // opening
38  const std::string& close , // closing
39  const std::string& delim ) ; // delimiter
40  // ========================================================================
41  } // end of namespace Gaudi::Utils
42  // ==========================================================================
43 } // end of namespace Gaudi
44 // ============================================================================
45 // 2) Parsers: string -> value
46 // ============================================================================
47 // GaudiKernel
48 // ============================================================================
49 #include "GaudiKernel/Parsers.h"
50 // ============================================================================
51 namespace Gaudi
52 {
53  // ==========================================================================
54  namespace Parsers
55  {
56  // ========================================================================
64  template <class TYPE, std::size_t N>
66  parse ( std::array<TYPE,N>& result , const std::string& input )
67  {
68  typedef std::vector<TYPE> _Vct ;
69  // create the temporaty vector
70  _Vct tmp ;
71  // parse the string
72  StatusCode sc = parse ( tmp , input ) ;
73  if ( sc.isFailure () ) { return sc ; } // RETURN
74  if ( N != tmp.size() )
75  { return StatusCode ( StatusCode::FAILURE , true ) ; } // RETURN
76  // copy vector into array
77  std::copy ( tmp.begin() , tmp.end() , result.begin() ) ;
78  //
79  return StatusCode::SUCCESS ;
80  }
81  // ========================================================================
82  } // end of namespace Gaudi::Parsers
83  // ==========================================================================
84 } // end of namespace Gaudi
85 // ============================================================================
86 // The END
87 // ============================================================================
88 #endif // GAUDIKERNEL_STDARRAYASPROPERTY_H
89 // ============================================================================
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:308
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
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.
implementation of various functions for streaming.
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1