Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
BoostArrayAsProperty.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_BOOSTARRAYASPROPERTY_H
2 #define GAUDIKERNEL_BOOSTARRAYASPROPERTY_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <algorithm>
9 // ============================================================================
10 // Boost
11 // ============================================================================
12 #include "boost/array.hpp"
13 // ============================================================================
23 // ============================================================================
24 // 1) Streamers : value -> string
25 // ============================================================================
26 namespace Gaudi {
27  // ==========================================================================
28  namespace Utils {
29  // ========================================================================
30  template <class ITERATOR>
31  inline std::ostream& toStream( ITERATOR first, // begin of the sequence
32  ITERATOR last, // end of the sequence
33  std::ostream& s, // the stream
34  const std::string& open, // opening
35  const std::string& close, // closing
36  const std::string& delim ); // delimiter
37  // ========================================================================
46  template <class TYPE, std::size_t N>
47  inline std::ostream& toStream( const boost::array<TYPE, N>& obj, std::ostream& s ) {
48  return toStream( obj.begin(), obj.end(), s, "( ", " )", " , " );
49  }
50  // ========================================================================
51  } // namespace Utils
52  // ==========================================================================
53 } // end of namespace Gaudi
54 // ============================================================================
55 // 2) Parsers: string -> value
56 // ============================================================================
57 // GaudiKernel
58 // ============================================================================
60 // ============================================================================
61 namespace Gaudi {
62  // ==========================================================================
63  namespace Parsers {
64  // ========================================================================
72  template <class TYPE, std::size_t N>
73  StatusCode parse( boost::array<TYPE, N>& result, const std::string& input ) {
74  typedef std::vector<TYPE> _Vct;
75  // create the temporaty vector
76  _Vct tmp;
77  // parse the string
78  StatusCode sc = parse( tmp, input );
79  if ( sc.isFailure() ) { return sc; } // RETURN
80  if ( N != tmp.size() ) { return StatusCode( StatusCode::FAILURE, true ); } // RETURN
81  // copy vector into array
82  std::copy( tmp.begin(), tmp.end(), result.begin() );
83  //
84  return StatusCode::SUCCESS;
85  }
86  // ========================================================================
87  } // namespace Parsers
88  // ==========================================================================
89 } // end of namespace Gaudi
90 // ============================================================================
91 // The END
92 // ============================================================================
93 #endif // GAUDIKERNEL_BOOSTARRAYASPROPERTY_H
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:284
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
The declaration of major parsing functions used e.g for (re)implementation of new extended properties...
bool isFailure() const
Definition: StatusCode.h:130
STL class.
int N
Definition: IOTest.py:99
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode parse(DataObjID &dest, const std::string &src)
Definition: DataObjID.cpp:46
STL class.
string s
Definition: gaudirun.py:312
constexpr static const auto FAILURE
Definition: StatusCode.h:86
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1