Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v28r2p1 (f1a77ff4)
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  // ==========================================================================
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  // ========================================================================
49  template <class TYPE, std::size_t N>
50  inline std::ostream& toStream
51  ( const boost::array<TYPE,N>& obj , std::ostream& s )
52  {
53  return toStream
54  ( obj.begin () , obj.end () , s , "( " , " )" , " , " ) ;
55  }
56  // ========================================================================
57  } // end of namespace Gaudi::Utils
58  // ==========================================================================
59 } // end of namespace Gaudi
60 // ============================================================================
61 // 2) Parsers: string -> value
62 // ============================================================================
63 // GaudiKernel
64 // ============================================================================
65 #include "GaudiKernel/Parsers.h"
66 // ============================================================================
67 namespace Gaudi
68 {
69  // ==========================================================================
70  namespace Parsers
71  {
72  // ========================================================================
80  template <class TYPE, std::size_t N>
82  parse ( boost::array<TYPE,N>& result , const std::string& input )
83  {
84  typedef std::vector<TYPE> _Vct ;
85  // create the temporaty vector
86  _Vct tmp ;
87  // parse the string
88  StatusCode sc = parse ( tmp , input ) ;
89  if ( sc.isFailure () ) { return sc ; } // RETURN
90  if ( N != tmp.size() )
91  { return StatusCode ( StatusCode::FAILURE , true ) ; } // RETURN
92  // copy vector into array
93  std::copy ( tmp.begin() , tmp.end() , result.begin() ) ;
94  //
95  return StatusCode::SUCCESS ;
96  }
97  // ========================================================================
98  } // end of namespace Gaudi::Parsers
99  // ==========================================================================
100 } // end of namespace Gaudi
101 // ============================================================================
102 // The END
103 // ============================================================================
104 #endif // GAUDIKERNEL_BOOSTARRAYASPROPERTY_H
105 // ============================================================================
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...
StatusCode parse(boost::array< TYPE, N > &result, const std::string &input)
parse class boost::array from the string
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
STL class.
string s
Definition: gaudirun.py:245
STL class.
Helper functions to set/get the application return code.
Definition: __init__.py:1