![]() |
|
|||
File indexing completed on 2025-02-21 10:00:36
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef GAUDIKERNEL_GENVCTPARSERS_H 0012 #define GAUDIKERNEL_GENVCTPARSERS_H 1 0013 // ============================================================================ 0014 // Include files 0015 // ============================================================================ 0016 // STD & STL 0017 // ============================================================================ 0018 #include <algorithm> 0019 #include <vector> 0020 // ============================================================================ 0021 // GaudiKernel 0022 // ============================================================================ 0023 #include <Gaudi/Parsers/CommonParsers.h> 0024 // ============================================================================ 0025 // ROOT/SVector 0026 // ============================================================================ 0027 #include "Math/SVector.h" 0028 // ============================================================================ 0029 /** @file 0030 * Declaration of parsing functions for generic vectors to allow 0031 * their usage as properties for Gaudi components 0032 * 0033 * @attention! this file must be included *BEFORE* * 0034 * any direct or indirect inclusion of GaudiKernel/ToStream.h 0035 * 0036 * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl 0037 * @date 2009-09-05 0038 */ 0039 // ============================================================================ 0040 namespace Gaudi { 0041 // ========================================================================== 0042 namespace Parsers { 0043 // ======================================================================== 0044 /** parse SVector 0045 * @param result (output) the parsed vector 0046 * @param input (input) the input string 0047 * @return status code 0048 * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl 0049 * @date 2009-09-05 0050 */ 0051 template <class SCALAR, unsigned int N> 0052 StatusCode parse( ROOT::Math::SVector<SCALAR, N>& result, const std::string& input ) { 0053 std::vector<double> tmp; 0054 StatusCode sc = parse( tmp, input ); 0055 if ( sc.isFailure() ) { return sc; } // RETURN 0056 if ( N != tmp.size() ) { return StatusCode::FAILURE; } // RETURN 0057 #ifdef WIN32 0058 // Disable warning 0059 // C4996: 'std::copy': Function call with parameters that may be unsafe 0060 // The parameters are checked 0061 # pragma warning( push ) 0062 # pragma warning( disable : 4996 ) 0063 #endif 0064 std::copy( tmp.begin(), tmp.end(), result.begin() ); 0065 #ifdef WIN32 0066 # pragma warning( pop ) 0067 #endif 0068 return StatusCode::SUCCESS; 0069 } 0070 // ======================================================================== 0071 } // namespace Parsers 0072 // ========================================================================== 0073 } // end of namespace Gaudi 0074 // ============================================================================ 0075 namespace Gaudi { 0076 // ========================================================================== 0077 namespace Utils { 0078 // ======================================================================== 0079 template <class SCALAR> 0080 std::ostream& toStream( const SCALAR&, std::ostream& ); 0081 // ======================================================================== 0082 /** the general streaming function for SVector using python-tupel format 0083 * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl 0084 * @date 2009-10-07 0085 */ 0086 template <class SCALAR, unsigned int N> 0087 std::ostream& toStream( const ROOT::Math::SVector<SCALAR, N>& obj, std::ostream& s ) { 0088 s << "( "; 0089 for ( auto cur = obj.begin(); obj.end() != cur; ++cur ) { 0090 if ( obj.begin() != cur ) { s << " , "; } 0091 toStream( *cur, s ); 0092 } 0093 return s << " )"; 0094 } 0095 // ======================================================================== 0096 } // namespace Utils 0097 // ========================================================================== 0098 } // end of namespace Gaudi 0099 // ============================================================================ 0100 // The END 0101 // ============================================================================ 0102 #endif // GAUDIKERNEL_GENVCTPARSERS_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |