The Gaudi Framework
master (37c0b60a)
BoostArrayAsProperty.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#ifndef GAUDIKERNEL_BOOSTARRAYASPROPERTY_H
12
#define GAUDIKERNEL_BOOSTARRAYASPROPERTY_H 1
13
// ============================================================================
14
// Include files
15
// ============================================================================
16
// STD & STL
17
// ============================================================================
18
#include <algorithm>
19
// ============================================================================
20
// Boost
21
// ============================================================================
22
#include <boost/array.hpp>
23
// ============================================================================
33
// ============================================================================
34
// 1) Streamers : value -> string
35
// ============================================================================
36
namespace
Gaudi
{
37
// ==========================================================================
38
namespace
Utils {
39
// ========================================================================
40
template
<
class
ITERATOR>
41
inline
std::ostream
&
toStream
( ITERATOR first,
// begin of the sequence
42
ITERATOR last,
// end of the sequence
43
std::ostream
&
s
,
// the stream
44
const
std::string
& open,
// opening
45
const
std::string
& close,
// closing
46
const
std::string
& delim );
// delimiter
47
// ========================================================================
56
template
<
class
TYPE, std::
size_t
N>
57
inline
std::ostream
&
toStream
(
const
boost::array<TYPE, N>& obj,
std::ostream
&
s
) {
58
return
toStream
( obj.begin(), obj.end(),
s
,
"( "
,
" )"
,
" , "
);
59
}
60
// ========================================================================
61
}
// namespace Utils
62
// ==========================================================================
63
}
// end of namespace Gaudi
64
// ============================================================================
65
// 2) Parsers: string -> value
66
// ============================================================================
67
// GaudiKernel
68
// ============================================================================
69
#include <
Gaudi/Parsers/CommonParsers.h
>
70
// ============================================================================
71
namespace
Gaudi
{
72
// ==========================================================================
73
namespace
Parsers {
74
// ========================================================================
82
template
<
class
TYPE, std::
size_t
N>
83
StatusCode
parse
( boost::array<TYPE, N>& result, std::string_view input ) {
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; }
90
if
(
N
!= tmp.size() ) {
return
StatusCode::FAILURE
; }
91
// copy vector into array
92
std::copy
( tmp.begin(), tmp.end(), result.begin() );
93
//
94
return
StatusCode::SUCCESS
;
95
}
96
// ========================================================================
97
}
// namespace Parsers
98
// ==========================================================================
99
}
// end of namespace Gaudi
100
// ============================================================================
101
// The END
102
// ============================================================================
103
#endif // GAUDIKERNEL_BOOSTARRAYASPROPERTY_H
std::string
STL class.
IOTest.N
N
Definition:
IOTest.py:112
Gaudi::Parsers::parse
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.
Definition:
DODBasicMapper.cpp:21
gaudirun.s
string s
Definition:
gaudirun.py:346
std::vector
STL class.
StatusCode
Definition:
StatusCode.h:65
std::ostream
STL class.
std::copy
T copy(T... args)
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition:
__init__.py:1
StatusCode::isFailure
bool isFailure() const
Definition:
StatusCode.h:129
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:100
CommonParsers.h
Gaudi::Utils::toStream
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:299
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition:
StatusCode.h:101
GaudiKernel
include
GaudiKernel
BoostArrayAsProperty.h
Generated on Thu Dec 19 2024 15:35:00 for The Gaudi Framework by
1.8.18