Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:35

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_STDARRAYASPROPERTY_H
0012 #define GAUDIKERNEL_STDARRAYASPROPERTY_H 1
0013 // ============================================================================
0014 // Include files
0015 // ============================================================================
0016 // STD & STL
0017 // ============================================================================
0018 #include "GaudiKernel/ToStream.h"
0019 #include <algorithm>
0020 #include <array>
0021 // ============================================================================
0022 /** @file
0023  *  Collection of utilities, which allows to use class std::array
0024  *  as property for Gaudi-components
0025  *
0026  *  @attention this file must be "included" before Gaudi/Property.h
0027  *
0028  *  @author Alexander Mazurov alexander.mazurov@cern.ch
0029  *  @date 2015-02-23
0030  *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0031  *  @date 2009-09-16
0032  */
0033 // ============================================================================
0034 #include <Gaudi/Parsers/CommonParsers.h>
0035 // ============================================================================
0036 namespace Gaudi {
0037   // ==========================================================================
0038   namespace Parsers {
0039     // ========================================================================
0040     /** parse class std::array from the string
0041      *  @param result (OUTPUT) the actual result
0042      *  @param input  (INPUT)  the input string
0043      *  @return status code
0044      *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
0045      *  @date 2009-09-16
0046      */
0047     template <class TYPE, std::size_t N>
0048     StatusCode parse( std::array<TYPE, N>& result, const std::string& input ) {
0049       std::vector<TYPE> tmp;
0050       StatusCode        sc = parse( tmp, input );
0051       if ( sc.isFailure() ) return sc;
0052       if ( N != tmp.size() ) return StatusCode::FAILURE;
0053       std::copy( tmp.begin(), tmp.end(), result.begin() );
0054       return StatusCode::SUCCESS;
0055     }
0056     // ========================================================================
0057   } // namespace Parsers
0058   // ==========================================================================
0059 } //                                                     end of namespace Gaudi
0060 // ============================================================================
0061 // The END
0062 // ============================================================================
0063 #endif // GAUDIKERNEL_STDARRAYASPROPERTY_H