| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

FunctionalDetails.h
Go to the documentation of this file.
1 #ifndef FUNCTIONAL_DETAILS_H
2 #define FUNCTIONAL_DETAILS_H
3
4 #include <type_traits>
5 #include <stdexcept>
6 #include <cassert>
7
8 // TODO: fwd declare instead?
9 #include "GaudiKernel/DataObjectHandle.h"
10 #include "GaudiKernel/AnyDataHandle.h"
11 #include "GaudiKernel/GaudiException.h"
12 #include "GaudiAlg/GaudiAlgorithm.h"
13
14 // Boost
15 #include "boost/optional.hpp"
16
17 // Range V3
18 #include <range/v3/view/zip.hpp>
19 #include <range/v3/view/const.hpp>
20
21 namespace Gaudi { namespace Functional { namespace details {
22
23 // CRJ : Stuff for zipping
24 namespace zip
25 {
26
28 template < typename A >
29 inline bool check_sizes( const A& ) noexcept { return true; }
30
32 template < typename A, typename B >
33 inline bool check_sizes( const A& a, const B& b ) noexcept
34 {
35 return a.size() == b.size();
36 }
37
39 template < typename A, typename B, typename... C >
40 inline bool check_sizes( const A& a, const B& b, const C& ... c ) noexcept
41 {
42 return ( check_sizes(a,b) && check_sizes(b,c...) );
43 }
44
46 template< typename... Args >
47 inline decltype(auto) verifySizes( Args&... args )
48 {
49 if ( UNLIKELY( !check_sizes( args... ) ) )
50 { throw GaudiException( "Zipped containers have different sizes.",
51 "Gaudi::Functional::details::zip::verifySizes",
52 StatusCode::FAILURE ); }
53 }
54
56 template< typename... Args >
57 inline decltype(auto) range( Args&& ... args )
58 {
59 //assert( check_sizes( args... ) );
60 verifySizes( args... );
61 return ranges::view::zip( std::forward<Args>(args)... );
62 }
63
65 template< typename... Args >
66 inline decltype(auto) const_range( Args&& ... args )
67 {
68 //assert( check_sizes( args... ) );
69 verifySizes( args... );
70 return ranges::view::const_( ranges::view::zip( std::forward<Args>(args)... ) );
71 }
72
73 }
74
75 // implementation of C++17 std::as_const, see http://en.cppreference.com/w/cpp/utility/as_const
76 template <typename T>
77 constexpr typename std::add_const<T>::type& as_const(T& t) noexcept
78 { return t; }
79
80 template <typename T>
81 void as_const(T&& t) = delete;
82
84
85 template <typename Out1, typename Out2,
86 typename = typename std::enable_if<std::is_constructible<Out1,Out2>::value>::type>
87 Out1* put( DataObjectHandle<Out1>& out_handle, Out2&& out ) {
88 return out_handle.put( new Out1( std::forward<Out2>(out) ) );
89 }
90
91 template <typename Out1, typename Out2,
92 typename = typename std::enable_if<std::is_constructible<Out1,Out2>::value>::type>
93 void put( AnyDataHandle<Out1>& out_handle, Out2&& out ) {
94 out_handle.put( std::forward<Out2>(out) );
95 }
96
97 // optional put
98 template <typename OutHandle, typename Out>
99 void put( OutHandle& out_handle, boost::optional<Out>&& out) {
100 if (out) put(out_handle,std::move(*out));
101 }
103 // adapt to differences between eg. std::vector (which has push_back) and KeyedContainer (which has insert)
104 // adapt to getting a T, and a container wanting T* by doing new T{ std::move(out) }
105 // adapt to getting a boost::optional<T>
106
107 constexpr struct insert_t {
108 // for Container<T*>, return T
109 template <typename Container>
110 using c_remove_ptr_t = typename std::remove_pointer<typename Container::value_type>::type;
111
112 template <typename Container, typename Value>
113 auto operator()(Container& c, Value&& v) const -> decltype( c.push_back(v) ) { return c.push_back( std::forward<Value>(v) ); }
114
115 template <typename Container, typename Value>
116 auto operator()(Container& c, Value&& v) const -> decltype( c.insert(v) ) { return c.insert( std::forward<Value>(v) ); }
117
118 // Container<T*> with T&& as argument
119 template <typename Container, typename = typename std::enable_if< std::is_pointer<typename Container::value_type>::value >::type >
120 auto operator()(Container& c, c_remove_ptr_t<Container>&& v) const
121 { return operator()( c, new c_remove_ptr_t<Container>{ std::move(v) } ); }
122
123 template <typename Container, typename Value>
124 void operator()(Container& c, boost::optional<Value>&& v) const { if (v) operator()(c,std::move(*v)); }
125 } insert {};
126
128
129 constexpr struct deref_t {
130 template <typename In, typename = typename std::enable_if< !std::is_pointer<In>::value>::type>
131 In& operator()( In& in ) const { return in; }
132
133 template <typename In>
134 In& operator()( In* in ) const { assert(in!=nullptr); return *in; }
135 } deref {};
136
138
139 namespace details2 {
140 template< typename T > struct remove_optional {typedef T type;};
141 template< typename T > struct remove_optional< boost::optional<T> > {typedef T type;};
142 // template< typename T > struct remove_optional< std::optional<T> > {typedef T type;};
143
144 }
145 template <typename T> using remove_optional_t = typename details2::remove_optional<T>::type;
146 template< typename T> struct is_optional : std::false_type {};
147 template< typename T> struct is_optional< boost::optional<T> > : std::true_type {};
148 // C++17: template <typename T> constexpr bool is_optional_v = is_optional<T>::value;
149
151 // if Container is a pointer, then we're optional items
152 namespace details2 {
153 template <typename Container, typename Value>
154 void push_back(Container& c, const Value& v, std::true_type) { c.push_back(v); }
155 template <typename Container, typename Value>
156 void push_back(Container& c, const Value& v, std::false_type) { c.push_back(&v); }
157
158 template <typename In>
159 struct get_from_handle {
160 template <template <typename> class Handle, typename I, typename = typename std::enable_if< std::is_convertible<I,In>::value >::type >
161 auto operator()( const Handle<I>& h ) -> const In& { return *h.get(); }
162 template <template <typename> class Handle, typename I, typename = typename std::enable_if<std::is_convertible<I*,In>::value>::type >
163 auto operator()( const Handle<I>& h ) -> const In { return h.getIfExists(); } // In is-a pointer
164 };
165
166 template <typename T> T* deref_if(T* const t,std::false_type) { return t; }
167 template <typename T> T& deref_if(T* const t,std::true_type) { return *t; }
168 }
169
170 template <typename Container>
171 class vector_of_const_ {
172 static constexpr bool is_optional = std::is_pointer<Container>::value;
173 using val_t = std::add_const_t<std::remove_pointer_t<Container>>;
174 using ptr_t = std::add_pointer_t<val_t>;
175 using ref_t = std::add_lvalue_reference_t<val_t>;
176 using ContainerVector = std::vector<ptr_t>;
177 ContainerVector m_containers;
178 public:
179 using value_type = std::conditional_t<is_optional,ptr_t,val_t>;
180 using size_type = typename ContainerVector::size_type;
181 class iterator {
182 typename ContainerVector::const_iterator m_i;
183 friend class vector_of_const_;
184 iterator(typename ContainerVector::const_iterator iter) : m_i(iter) {}
185 using ret_t = std::conditional_t<is_optional,ptr_t,ref_t>;
186 public:
187 friend bool operator!=(const iterator& lhs, const iterator& rhs) { return lhs.m_i != rhs.m_i; }
188 ret_t operator*() const { return details2::deref_if(*m_i, std::integral_constant<bool,!is_optional>{}); }
189 iterator& operator++() { ++m_i; return *this; }
190 iterator& operator--() { --m_i; return *this; }
191 bool is_null() const { return !*m_i; }
192 explicit operator bool() const { return !is_null(); }
193 };
194 vector_of_const_() = default;
195 void reserve(size_type size) { m_containers.reserve(size); }
196 template <typename T> // , typename = std::is_convertible<T,std::conditional_t<is_optional,ptr_t,val_t>>
197 void push_back(T&& container) { details2::push_back(m_containers,std::forward<T>(container), std::integral_constant<bool,is_optional>{});} // note: does not copy its argument, so we're not really a container...
198 iterator begin() const { return m_containers.begin(); }
199 iterator end() const { return m_containers.end(); }
200 size_type size() const { return m_containers.size(); }
201 const Container& operator[](size_type i) const { return *m_containers[i]; }
202 const Container& at(size_type i) const { if (i>=size()) throw std::out_of_range{"vector_of_const_::at"} ; return *m_containers[i]; }
203 bool is_null(size_type i) const { return !m_containers[i]; }
204 };
205
207
208 // detect whether a traits class defines the requested type,
209 // if so, use it,
210 // otherwise use the default
211 //
212 // based on http://en.cppreference.com/w/cpp/experimental/is_detected
213 // and the libstdc++ source, specificially libstdc++-v3/include/std/type_traits
214
215 namespace detail2 {
216 #ifdef HAVE_CPP17
217 template<typename...> using void_t = void;
218 #else
219 template <typename...> struct void_t_ { using type = void; };
220 template <typename... T> using void_t = typename void_t_<T...>::type;
221 #endif
222
224 template<typename Default, typename AlwaysVoid,
225 template<typename...> class Op, typename... Args>
226 struct detector {
227 using type = Default;
228 };
229
231 template<typename Default,
232 template<typename...> class Op, typename... Args>
233 struct detector<Default, void_t<Op<Args...>>, Op, Args...> {
234 using type = Op<Args...>;
235 };
236 }
237
238 // Op<Args...> if that is a valid type, otherwise Default.
239 template<typename Default,
240 template<typename...> class Op, typename... Args>
241 using detected_or_t = typename detail2::detector<Default, void, Op, Args...>::type;
242
243 // Op<Args...> if that is a valid type, otherwise Default<Args...>.
244 template<template<typename...> class Default,
245 template<typename...> class Op,
246 typename Tr, typename T>
247 using detected_or_t_ = detected_or_t<Default<Tr, T>, Op, Tr, T>;
248
250 namespace detail2 { // utilities for detected_or_t{,_} usage
251
252 template <typename Tr> using BaseClass_ = typename Tr::BaseClass;
253 template <typename Tr, typename T> using defaultHandle_ = typename std::conditional< std::is_base_of<DataObject,T>::value,
254 DataObjectHandle<T>,
255 AnyDataHandle<T>>::type;
256 template <typename Tr, typename T> using OutputHandle_ = typename Tr::template OutputHandle<T>;
257 template <typename Tr, typename T> using InputHandle_ = typename Tr::template InputHandle<T>;
258 }
259
260 // check whether Traits::BaseClass is a valid type,
261 // if so, define BaseClass_t<Traits> as being Traits::BaseClass
262 // else define as being GaudiAlgorithm
263 template <typename Tr> using BaseClass_t = detected_or_t< GaudiAlgorithm, detail2::BaseClass_, Tr >;
264
265 // check whether Traits::{Input,Output}Handle<T> is a valid type,
266 // if so, define {Input,Output}Handle_t<Traits,T> as being Traits::{Input,Output}Handle<T>
267 // else define as being DataObjectHandle<T> if T derives from DataObject, else AnyDataHandle<T>
268 template <typename Tr, typename T> using OutputHandle_t = detected_or_t_< detail2::defaultHandle_, detail2::OutputHandle_, Tr, T>;
269 template <typename Tr, typename T> using InputHandle_t = detected_or_t_< detail2::defaultHandle_, detail2::InputHandle_, Tr, T>;
270
272
273 namespace details2 {
274 template <std::size_t N, typename Tuple >
275 using element_t = typename std::tuple_element<N, Tuple>::type;
276
277 template <typename Tuple, typename KeyValues, std::size_t... I>
278 Tuple make_tuple_of_handles_helper( IDataHandleHolder* o, const KeyValues& initvalue, Gaudi::DataHandle::Mode m, std::index_sequence<I...> ) {
279 return std::make_tuple( element_t<I,Tuple>{std::get<I>(initvalue).second, m, o} ... );
280 }
281 template <typename KeyValues, typename Properties, std::size_t... I>
282 void declare_tuple_of_properties_helper(GaudiAlgorithm* owner, const KeyValues& inputs, Properties& props, std::index_sequence<I...>) {
283 // note: be very careful here! Only GaudiAlgorithm has a declareProperty that works with a DataObjectHandleBase.
284 // However, Algorithm does have a template that also matches (unless it is constrained explicitly against matching)
285 // so if 'owner' is of type Algorithm instead of GaudiAlgortihm, this ends up calling the wrong declareProperty...
286 (void) std::initializer_list<int>{
287 ( owner->declareProperty( std::get<I>(inputs).first,
288 std::get<I>(props) ),0)...
289 };
290 }
291 }
292
293 template <typename Tuple, typename KeyValues >
294 Tuple make_tuple_of_handles( IDataHandleHolder* owner, const KeyValues& initvalue, Gaudi::DataHandle::Mode mode ) {
295 return details2::make_tuple_of_handles_helper<Tuple>( owner, initvalue, mode, std::make_index_sequence<std::tuple_size<Tuple>::value>{} );
296 }
297
298 template <typename KeyValues, typename Properties>
299 void declare_tuple_of_properties(GaudiAlgorithm* owner, const KeyValues& inputs, Properties& props) {
300 static_assert( std::tuple_size<KeyValues>::value == std::tuple_size<Properties>::value, "Inconsistent lengths" );
301 constexpr auto N = std::tuple_size<KeyValues>::value;
302 details2::declare_tuple_of_properties_helper( owner, inputs, props, std::make_index_sequence<N>{} );
303 }
304
305 template <typename Handles>
306 Handles make_vector_of_handles(IDataHandleHolder* owner, const std::vector<std::string>& init, Gaudi::DataHandle::Mode mode) {
307 Handles handles; handles.reserve(init.size());
308 std::transform( init.begin(), init.end(), std::back_inserter(handles),
309 [&](const std::string& loc) -> typename Handles::value_type
310 { return {loc,mode, owner}; });
311 return handles;
312 }
313
315
316
317 template <typename OutputSpec, typename InputSpec, typename Traits_> class DataHandleMixin;
318
319 template <typename... Out, typename... In, typename Traits_>
320 class DataHandleMixin<std::tuple<Out...>, std::tuple<In...>,Traits_> : public BaseClass_t<Traits_> {
321 static_assert( std::is_base_of<GaudiAlgorithm, BaseClass_t<Traits_>>::value,
322 "BaseClass must inherit from GaudiAlgorithm");
323 public:
324 using KeyValue = std::pair<std::string, std::string>;
325 constexpr static std::size_t N_in = sizeof...(In);
326 constexpr static std::size_t N_out = sizeof...(Out);
327
328 // generic constructor: N -> M
329 DataHandleMixin(const std::string& name, ISvcLocator* pSvcLocator,
330 const std::array<KeyValue,N_in>& inputs,
331 const std::array<KeyValue,N_out>& outputs)
332 : BaseClass_t<Traits_>( name , pSvcLocator ),
333 m_inputs( make_tuple_of_handles<decltype(m_inputs)>( this, inputs, Gaudi::DataHandle::Reader ) ),
334 m_outputs( make_tuple_of_handles<decltype(m_outputs)>( this, outputs, Gaudi::DataHandle::Writer ) )
335 {
336 declare_tuple_of_properties( this, inputs, m_inputs );
337 declare_tuple_of_properties( this, outputs, m_outputs );
338 // make sure this algorithm is seen as reentrant by Gaudi
339 BaseClass_t<Traits_>::setProperty("Cardinality", 0);
340 }
341
342 // special cases: forward to the generic case...
343 // 1 -> 1
344 DataHandleMixin(const std::string& name, ISvcLocator* locator,
345 const KeyValue& input,
346 const KeyValue& output)
347 : DataHandleMixin( name, locator, std::array<KeyValue,1>{ input }, std::array<KeyValue,1>{ output } )
348 { }
349 // 1 -> N
350 DataHandleMixin(const std::string& name, ISvcLocator* locator,
351 const KeyValue& input,
352 const std::array<KeyValue,N_out>& outputs)
353 : DataHandleMixin( name, locator, std::array<KeyValue,1>{ input }, outputs )
354 { }
355 // N -> 1
356 DataHandleMixin(const std::string& name, ISvcLocator* locator,
357 const std::array<KeyValue,N_in>& inputs,
358 const KeyValue& output )
359 : DataHandleMixin( name, locator, inputs, std::array<KeyValue,1>{ output } )
360 { }
361
362 template <std::size_t N=0>
363 const std::string& inputLocation() const { return std::get<N>(m_inputs).objKey(); }
364 unsigned int inputLocationSize() const { return std::tuple_size<decltype(m_inputs)>::value; }
365
366 template <std::size_t N=0>
367 const std::string& outputLocation() const { return std::get<N>(m_outputs).objKey(); }
368 unsigned int outputLocationSize() const { return std::tuple_size<decltype(m_outputs)>::value; }
369
370 protected:
371 std::tuple<details::InputHandle_t<Traits_,In>...> m_inputs;
372 std::tuple<details::OutputHandle_t<Traits_,Out>...> m_outputs;
373 };
374
375 template <typename... In, typename Traits_>
376 class DataHandleMixin<void, std::tuple<In...>,Traits_> : public BaseClass_t<Traits_> {
377 static_assert( std::is_base_of<GaudiAlgorithm, BaseClass_t<Traits_>>::value,
378 "BaseClass must inherit from GaudiAlgorithm");
379 public:
380 using KeyValue = std::pair<std::string, std::string>;
381 constexpr static std::size_t N_in = sizeof...(In);
382
383 // generic constructor: N -> 0
384 DataHandleMixin(const std::string& name, ISvcLocator* pSvcLocator,
385 const std::array<KeyValue,N_in>& inputs )
386 : BaseClass_t<Traits_>( name , pSvcLocator ),
387 m_inputs( make_tuple_of_handles<decltype(m_inputs)>( this, inputs, Gaudi::DataHandle::Reader ) )
388 {
389 declare_tuple_of_properties( this, inputs, m_inputs );
390 // make sure this algorithm is seen as reentrant by Gaudi
391 BaseClass_t<Traits_>::setProperty("Cardinality", 0);
392 }
393
394 // special cases: forward to the generic case...
395 // 1 -> 0
396 DataHandleMixin(const std::string& name, ISvcLocator* locator,
397 const KeyValue& input )
398 : DataHandleMixin( name, locator, std::array<KeyValue,1>{ input } )
399 { }
400
401 template <std::size_t N=0>
402 const std::string& inputLocation() const { return std::get<N>(m_inputs).objKey(); }
403 unsigned int inputLocationSize() const { return std::tuple_size<decltype(m_inputs)>::value; }
404
405 protected:
406 std::tuple<details::InputHandle_t<Traits_,In>...> m_inputs;
407 };
408
409 template <typename... Out, typename Traits_>
410 class DataHandleMixin<std::tuple<Out...>, void,Traits_> : public BaseClass_t<Traits_> {
411 static_assert( std::is_base_of<GaudiAlgorithm, BaseClass_t<Traits_>>::value,
412 "BaseClass must inherit from GaudiAlgorithm");
413 public:
414 using KeyValue = std::pair<std::string, std::string>;
415 constexpr static std::size_t N_out = sizeof...(Out);
416
417 // generic constructor: 0 -> N
418 DataHandleMixin(const std::string& name, ISvcLocator* pSvcLocator,
419 const std::array<KeyValue,N_out>& outputs)
420 : BaseClass_t<Traits_>( name , pSvcLocator ),
421 m_outputs( make_tuple_of_handles<decltype(m_outputs)>( this, outputs, Gaudi::DataHandle::Writer ) )
422 {
423 declare_tuple_of_properties( this, outputs, m_outputs );
424 // make sure this algorithm is seen as reentrant by Gaudi
425 BaseClass_t<Traits_>::setProperty("Cardinality", 0);
426 }
427
428 // 0 -> 1
429 DataHandleMixin(const std::string& name, ISvcLocator* locator,
430 const KeyValue& output)
431 : DataHandleMixin( name, locator, std::array<KeyValue,1>{ output } )
432 { }
433
434 template <std::size_t N=0>
435 const std::string& outputLocation() const { return std::get<N>(m_outputs).objKey(); }
436 unsigned int outputLocationSize() const { return std::tuple_size<decltype(m_outputs)>::value; }
437
438 protected:
439 std::tuple<details::OutputHandle_t<Traits_,Out>...> m_outputs;
440 };
441
443 template <typename Fun, typename Container, typename... Args >
444 constexpr void apply(const Fun&, Container&, Args... )
445 { static_assert(sizeof...(Args)==0,"Args should not be used!");}
446
447 // TODO/FIXME: overload ambiguity if output container type == input container type
448 template <typename Fun, typename Container>
449 auto apply(const Fun& fun, Container& c) -> decltype(fun(c),void())
450 { fun(c); }
451
453
454 } } }
455
456 #endif
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const std::array< KeyValue, N_out > &outputs)
Definition: FunctionalDetails.h:418
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const std::array< KeyValue, N_in > &inputs)
Definition: FunctionalDetails.h:384
Gaudi::Functional::details::details2::remove_optional< boost::optional< T > >::type
T type
Definition: FunctionalDetails.h:141
Gaudi::Utils::setProperty
StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
Definition: Property.h:1138
Gaudi::Functional::details::details2::make_tuple_of_handles_helper
Tuple make_tuple_of_handles_helper(IDataHandleHolder *o, const KeyValues &initvalue, Gaudi::DataHandle::Mode m, std::index_sequence< I... >)
Definition: FunctionalDetails.h:278
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::m_inputs
std::tuple< details::InputHandle_t< Traits_, In >... > m_inputs
Definition: FunctionalDetails.h:371
Gaudi::Functional::details::is_optional
Definition: FunctionalDetails.h:146
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::m_inputs
std::tuple< details::InputHandle_t< Traits_, In >... > m_inputs
Definition: FunctionalDetails.h:406
std::out_of_range
STL class.
Gaudi::Functional::details::as_const
constexpr std::add_const< T >::type & as_const(T &t) noexcept
Definition: FunctionalDetails.h:77
Gaudi::Functional::details::deref_t::operator()
In & operator()(In *in) const
Definition: FunctionalDetails.h:134
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *locator, const std::array< KeyValue, N_in > &inputs, const KeyValue &output)
Definition: FunctionalDetails.h:356
Gaudi::Functional::details::BaseClass_t
detected_or_t< GaudiAlgorithm, detail2::BaseClass_, Tr > BaseClass_t
Definition: FunctionalDetails.h:263
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Gaudi::Functional::details::vector_of_const_::reserve
void reserve(size_type size)
Definition: FunctionalDetails.h:195
Gaudi::Functional::details::details2::get_from_handle::operator()
auto operator()(const Handle< I > &h) -> const In &
Definition: FunctionalDetails.h:161
gaudirun.c
c
Definition: gaudirun.py:391
Gaudi::Functional::details::make_vector_of_handles
Handles make_vector_of_handles(IDataHandleHolder *owner, const std::vector< std::string > &init, Gaudi::DataHandle::Mode mode)
Definition: FunctionalDetails.h:306
boost
The namespace threadpool contains a thread pool and related utility classes.
Definition: iter_pos.hpp:13
Gaudi::Functional::details::vector_of_const_::iterator::operator!=
friend bool operator!=(const iterator &lhs, const iterator &rhs)
Definition: FunctionalDetails.h:187
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::Functional::details::deref_t
Definition: FunctionalDetails.h:129
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::inputLocationSize
unsigned int inputLocationSize() const
Definition: FunctionalDetails.h:403
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::m_outputs
std::tuple< details::OutputHandle_t< Traits_, Out >... > m_outputs
Definition: FunctionalDetails.h:439
Gaudi::Functional::details::declare_tuple_of_properties
void declare_tuple_of_properties(GaudiAlgorithm *owner, const KeyValues &inputs, Properties &props)
Definition: FunctionalDetails.h:299
Gaudi::Functional::details::vector_of_const_::iterator::operator++
iterator & operator++()
Definition: FunctionalDetails.h:189
std::is_pointer
gaudirun.args
args
Definition: gaudirun.py:236
Gaudi::Functional::details::zip::verifySizes
decltype(auto) verifySizes(Args &...args)
Verify the data container sizes have the same sizes.
Definition: FunctionalDetails.h:47
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:57
Gaudi::Functional::details::insert_t::operator()
auto operator()(Container &c, c_remove_ptr_t< Container > &&v) const
Definition: FunctionalDetails.h:120
gaudirun.output
output
Definition: gaudirun.py:388
AnyDataHandle
Definition: AnyDataHandle.h:14
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::outputLocation
const std::string & outputLocation() const
Definition: FunctionalDetails.h:367
Gaudi::Functional::details::vector_of_const_::iterator::m_i
ContainerVector::const_iterator m_i
Definition: FunctionalDetails.h:182
Gaudi::Functional::details::insert
constexpr struct Gaudi::Functional::details::insert_t insert
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const std::array< KeyValue, N_in > &inputs, const std::array< KeyValue, N_out > &outputs)
Definition: FunctionalDetails.h:329
Gaudi::Functional::details::detail2::InputHandle_
typename Tr::template InputHandle< T > InputHandle_
Definition: FunctionalDetails.h:257
GaudiAlgorithm.h
Header file for class GaudiAlgorithm.
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &input, const KeyValue &output)
Definition: FunctionalDetails.h:344
Gaudi::Functional::details::vector_of_const_::val_t
std::add_const_t< std::remove_pointer_t< Container >> val_t
Definition: FunctionalDetails.h:173
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
Gaudi::Functional::details::insert_t::c_remove_ptr_t
typename std::remove_pointer< typename Container::value_type >::type c_remove_ptr_t
Definition: FunctionalDetails.h:110
Gaudi::Functional::details::vector_of_const_::is_null
bool is_null(size_type i) const
Definition: FunctionalDetails.h:203
std
STL namespace.
Gaudi::Functional::void
class MergingTransformer< Out(const vector_of_const_< In > void
Definition: MergingTransformer.h:19
std::make_tuple
T make_tuple(T...args)
std::vector::end
T end(T...args)
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::inputLocation
const std::string & inputLocation() const
Definition: FunctionalDetails.h:363
Gaudi::Functional::details::details2::declare_tuple_of_properties_helper
void declare_tuple_of_properties_helper(GaudiAlgorithm *owner, const KeyValues &inputs, Properties &props, std::index_sequence< I... >)
Definition: FunctionalDetails.h:282
Gaudi::Functional::details::detail2::void_t_::type
void type
Definition: FunctionalDetails.h:219
std::size_t
Gaudi::Functional::details::details2::push_back
void push_back(Container &c, const Value &v, std::true_type)
Definition: FunctionalDetails.h:154
Properties
std::vector< Gaudi::Details::PropertyBase * > Properties
Definition: PropertyMgr.h:139
Gaudi::Functional::details::vector_of_const_::iterator::iterator
iterator(typename ContainerVector::const_iterator iter)
Definition: FunctionalDetails.h:184
Gaudi::Functional::details::details2::get_from_handle
Definition: FunctionalDetails.h:159
Gaudi::Functional::details::vector_of_const_::ref_t
std::add_lvalue_reference_t< val_t > ref_t
Definition: FunctionalDetails.h:175
Gaudi::Functional::details::insert_t
Definition: FunctionalDetails.h:107
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::m_outputs
std::tuple< details::OutputHandle_t< Traits_, Out >... > m_outputs
Definition: FunctionalDetails.h:372
Gaudi::Functional::details::details2::deref_if
T * deref_if(T *const t, std::false_type)
Definition: FunctionalDetails.h:166
Gaudi::Functional::details::detail2::void_t
typename void_t_< T... >::type void_t
Definition: FunctionalDetails.h:220
Gaudi::Functional::details::vector_of_const_::operator[]
const Container & operator[](size_type i) const
Definition: FunctionalDetails.h:201
Gaudi::Functional::details::deref
constexpr struct Gaudi::Functional::details::deref_t deref
std::enable_if
AnyDataHandle::put
const T * put(T &&object)
Register object in transient store.
Definition: AnyDataHandle.h:41
Gaudi::Functional::details::vector_of_const_
Definition: FunctionalDetails.h:171
Gaudi::Functional::details::details2::remove_optional
Definition: FunctionalDetails.h:140
Gaudi::Functional::details::detail2::defaultHandle_
typename std::conditional< std::is_base_of< DataObject, T >::value, DataObjectHandle< T >, AnyDataHandle< T >>::type defaultHandle_
Definition: FunctionalDetails.h:255
Gaudi::Units::second
constexpr double second
Definition: SystemOfUnits.h:122
std::string
STL class.
Gaudi::Functional::details::vector_of_const_::iterator::operator*
ret_t operator*() const
Definition: FunctionalDetails.h:188
Gaudi::Functional::details::vector_of_const_::iterator
Definition: FunctionalDetails.h:181
Gaudi::Functional::details::vector_of_const_::size
size_type size() const
Definition: FunctionalDetails.h:200
DataObjectHandle
DataObjectHandle.h GaudiKernel/DataObjectHandle.h.
Definition: AlgTool.h:27
Gaudi::Functional::details::detail2::detector
Implementation of the detection idiom (negative case).
Definition: FunctionalDetails.h:226
IDataHandleHolder
Definition: IDataHandleHolder.h:14
IOTest.N
int N
Definition: IOTest.py:90
Gaudi::Functional::details::InputHandle_t
detected_or_t_< detail2::defaultHandle_, detail2::InputHandle_, Tr, T > InputHandle_t
Definition: FunctionalDetails.h:269
Gaudi::Functional::details::vector_of_const_::m_containers
ContainerVector m_containers
Definition: FunctionalDetails.h:177
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::inputLocation
const std::string & inputLocation() const
Definition: FunctionalDetails.h:402
BrunelScenarioForwardScheduler.inputs
inputs
Definition: BrunelScenarioForwardScheduler.py:123
Gaudi::Functional::details::DataHandleMixin
Definition: FunctionalDetails.h:317
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &input, const std::array< KeyValue, N_out > &outputs)
Definition: FunctionalDetails.h:350
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::outputLocation
const std::string & outputLocation() const
Definition: FunctionalDetails.h:435
HiveAlgSequencer.h
h
Definition: HiveAlgSequencer.py:24
Gaudi::Functional::Traits_
class MergingTransformer< Out(const vector_of_const_< In > Traits_
Definition: MergingTransformer.h:19
Gaudi::Functional::details::deref_t::operator()
In & operator()(In &in) const
Definition: FunctionalDetails.h:131
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:93
GaudiException.h
gaudirun.type
type
Definition: gaudirun.py:125
DataObjectHandle::put
T * put(T *object)
Register object in transient store.
Definition: DataObjectHandle.h:117
Gaudi::Functional::details::remove_optional_t
typename details2::remove_optional< T >::type remove_optional_t
Definition: FunctionalDetails.h:145
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:94
Gaudi::DataHandle
Definition: DataHandle.h:27
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &output)
Definition: FunctionalDetails.h:429
Gaudi::Functional::details::make_tuple_of_handles
Tuple make_tuple_of_handles(IDataHandleHolder *owner, const KeyValues &initvalue, Gaudi::DataHandle::Mode mode)
Definition: FunctionalDetails.h:294
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::outputLocationSize
unsigned int outputLocationSize() const
Definition: FunctionalDetails.h:368
GaudiMath::Integration::Default
Definition: Integration.h:41
Gaudi::Functional::details::insert_t::operator()
auto operator()(Container &c, Value &&v) const -> decltype(c.insert(v))
Definition: FunctionalDetails.h:116
AnyDataHandle.h
std::move
T move(T...args)
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::inputLocationSize
unsigned int inputLocationSize() const
Definition: FunctionalDetails.h:364
std::add_const
std::tuple
std::pair
std::remove_pointer
Gaudi::Functional::details::OutputHandle_t
detected_or_t_< detail2::defaultHandle_, detail2::OutputHandle_, Tr, T > OutputHandle_t
Definition: FunctionalDetails.h:268
std::vector::size
T size(T...args)
Gaudi::Functional::details::detail2::detector< Default, void_t< Op< Args... > >, Op, Args... >::type
Op< Args... > type
Definition: FunctionalDetails.h:234
Gaudi::Functional::details::vector_of_const_::value_type
std::conditional_t< is_optional, ptr_t, val_t > value_type
Definition: FunctionalDetails.h:179
Gaudi::Functional::details::detail2::void_t_
Definition: FunctionalDetails.h:219
Gaudi::Functional::details::vector_of_const_::iterator::operator--
iterator & operator--()
Definition: FunctionalDetails.h:190
Gaudi::Functional::m_inputs
std::vector< InputHandle_t< In > > m_inputs
Definition: MergingTransformer.h:39
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:27
std::vector< ptr_t >
Gaudi::Functional::operator()
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
std::conditional
Gaudi::Functional::details::detected_or_t_
detected_or_t< Default< Tr, T >, Op, Tr, T > detected_or_t_
Definition: FunctionalDetails.h:247
Gaudi::Functional::details::insert_t::operator()
void operator()(Container &c, boost::optional< Value > &&v) const
Definition: FunctionalDetails.h:124
Gaudi::Functional::details::details2::remove_optional::type
T type
Definition: FunctionalDetails.h:140
Gaudi::Functional::details::vector_of_const_::iterator::ret_t
std::conditional_t< is_optional, ptr_t, ref_t > ret_t
Definition: FunctionalDetails.h:185
std::false_type
std::vector::begin
T begin(T...args)
Gaudi::Functional::details::zip::check_sizes
bool check_sizes(const A &) noexcept
Resolve case there is only one container in the range.
Definition: FunctionalDetails.h:29
Gaudi::Functional::details::vector_of_const_::push_back
void push_back(T &&container)
Definition: FunctionalDetails.h:197
Gaudi::Functional::details::insert_t::operator()
auto operator()(Container &c, Value &&v) const -> decltype(c.push_back(v))
Definition: FunctionalDetails.h:113
std::back_inserter
T back_inserter(T...args)
Gaudi::Functional::details::vector_of_const_::at
const Container & at(size_type i) const
Definition: FunctionalDetails.h:202
Gaudi::Functional::details::details2::element_t
typename std::tuple_element< N, Tuple >::type element_t
Definition: FunctionalDetails.h:275
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
Gaudi::Functional::details::zip::const_range
decltype(auto) const_range(Args &&...args)
Zips multiple containers together to form a single const range.
Definition: FunctionalDetails.h:66
std::is_base_of
std::array
STL class.
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &input)
Definition: FunctionalDetails.h:396
Gaudi::Functional::details::detail2::OutputHandle_
typename Tr::template OutputHandle< T > OutputHandle_
Definition: FunctionalDetails.h:256
Algorithm::declareProperty
Gaudi::Details::PropertyBase * declareProperty(const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
Definition: Algorithm.h:366
Gaudi::Functional::details::apply
constexpr void apply(const Fun &, Container &, Args...)
Definition: FunctionalDetails.h:444
std::transform
T transform(T...args)
Gaudi::Functional::details::vector_of_const_::ptr_t
std::add_pointer_t< val_t > ptr_t
Definition: FunctionalDetails.h:174
Gaudi::Functional::details::detail2::BaseClass_
typename Tr::BaseClass BaseClass_
Definition: FunctionalDetails.h:252
Gaudi::DataHandle::Mode
Mode
Definition: DataHandle.h:30
Gaudi::Functional::details::detail2::detector::type
Default type
Definition: FunctionalDetails.h:227
Gaudi::Functional::details::vector_of_const_::iterator::is_null
bool is_null() const
Definition: FunctionalDetails.h:191
Gaudi::Functional::details::details2::deref_if
T & deref_if(T *const t, std::true_type)
Definition: FunctionalDetails.h:167
Gaudi::Functional::details::vector_of_const_::end
iterator end() const
Definition: FunctionalDetails.h:199
Gaudi::Functional::details::details2::get_from_handle::operator()
auto operator()(const Handle< I > &h) -> const In
Definition: FunctionalDetails.h:163
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
compareOutputFiles.Reader
def Reader(readerType, filename, qacross, qToEngine)
Definition: compareOutputFiles.py:109
std::initializer_list
Gaudi::Functional::details::put
Out1 * put(DataObjectHandle< Out1 > &out_handle, Out2 &&out)
Definition: FunctionalDetails.h:87
Gaudi::Functional::details::details2::push_back
void push_back(Container &c, const Value &v, std::false_type)
Definition: FunctionalDetails.h:156
Gaudi::Functional::details::detected_or_t
typename detail2::detector< Default, void, Op, Args... >::type detected_or_t
Definition: FunctionalDetails.h:241
Gaudi::Functional::KeyValues
std::pair< std::string, std::vector< std::string >> KeyValues
Definition: MergingTransformer.h:25
GaudiPython.GaudiAlgs.Tuple
Tuple
Definition: GaudiAlgs.py:1041
std::vector::reserve
T reserve(T...args)
Gaudi::Functional::details::vector_of_const_::size_type
typename ContainerVector::size_type size_type
Definition: FunctionalDetails.h:180
Gaudi::Functional::details::vector_of_const_::begin
iterator begin() const
Definition: FunctionalDetails.h:198
DataObjectHandle.h
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::outputLocationSize
unsigned int outputLocationSize() const
Definition: FunctionalDetails.h:436