The Gaudi Framework  v30r3 (a5ef0a68)
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 "GaudiKernel/ToStream.h"
9 #include <algorithm>
10 #include <array>
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( 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  // ========================================================================
40  } // end of namespace Gaudi::Utils
41  // ==========================================================================
42 } // end of namespace Gaudi
43 // ============================================================================
44 // 2) Parsers: string -> value
45 // ============================================================================
46 // GaudiKernel
47 // ============================================================================
48 #include "GaudiKernel/Parsers.h"
49 // ============================================================================
50 namespace Gaudi
51 {
52  // ==========================================================================
53  namespace Parsers
54  {
55  // ========================================================================
63  template <class TYPE, std::size_t N>
65  {
66  typedef std::vector<TYPE> _Vct;
67  // create the temporaty vector
68  _Vct tmp;
69  // parse the string
70  StatusCode sc = parse( tmp, input );
71  if ( sc.isFailure() ) {
72  return sc;
73  } // RETURN
74  if ( N != tmp.size() ) {
75  return StatusCode( StatusCode::FAILURE, true );
76  } // RETURN
77  // copy vector into array
78  std::copy( tmp.begin(), tmp.end(), result.begin() );
79  //
80  return StatusCode::SUCCESS;
81  }
82  // ========================================================================
83  } // end of namespace Gaudi::Parsers
84  // ==========================================================================
85 } // end of namespace Gaudi
86 // ============================================================================
87 // The END
88 // ============================================================================
89 #endif // GAUDIKERNEL_STDARRAYASPROPERTY_H
90 // ============================================================================
constexpr static const auto FAILURE
Definition: StatusCode.h:88
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:303
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
bool isFailure() const
Definition: StatusCode.h:139
STL class.
int N
Definition: IOTest.py:101
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
StatusCode parse(DataObjID &dest, const std::string &src)
Definition: DataObjID.cpp:52
STL class.
T begin(T...args)
string s
Definition: gaudirun.py:253
STL class.
implementation of various functions for streaming.
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1