| The Gaudi Framework v29r0 (ff2e7097)

- 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 <cassert>
5 #include <sstream>
6 #include <stdexcept>
7 #include <type_traits>
8
9 // TODO: fwd declare instead?
10 #include "GaudiAlg/GaudiAlgorithm.h"
11 #include "GaudiKernel/Algorithm.h"
12 #include "GaudiKernel/AnyDataHandle.h"
13 #include "GaudiKernel/DataObjectHandle.h"
14 #include "GaudiKernel/GaudiException.h"
15
16 // Boost
17 #include "boost/optional.hpp"
18
19 // Range V3
20 #include <range/v3/view/const.hpp>
21 #include <range/v3/view/zip.hpp>
22
23 namespace Gaudi
24 {
25 namespace Functional
26 {
27 namespace details
28 {
29
30 // CRJ : Stuff for zipping
31 namespace zip
32 {
33
35 template <typename OS, typename Arg>
36 void printSizes( OS& out, Arg&& arg )
37 {
38 out << "SizeOf'" << System::typeinfoName( typeid( Arg ) ) << "'=" << std::forward<Arg>( arg ).size();
39 }
40
42 template <typename OS, typename Arg, typename... Args>
43 void printSizes( OS& out, Arg&& arg, Args&&... args )
44 {
45 printSizes( out, arg );
46 out << ", ";
47 printSizes( out, args... );
48 }
49
51 template <typename A>
52 inline bool check_sizes( const A& ) noexcept
53 {
54 return true;
55 }
56
58 template <typename A, typename B>
59 inline bool check_sizes( const A& a, const B& b ) noexcept
60 {
61 return a.size() == b.size();
62 }
63
65 template <typename A, typename B, typename... C>
66 inline bool check_sizes( const A& a, const B& b, const C&... c ) noexcept
67 {
68 return ( check_sizes( a, b ) && check_sizes( b, c... ) );
69 }
70
72 template <typename... Args>
73 inline decltype( auto ) verifySizes( Args&... args )
74 {
75 if ( UNLIKELY( !check_sizes( args... ) ) ) {
76 std::ostringstream mess;
77 mess << "Zipped containers have different sizes : ";
78 printSizes( mess, args... );
79 throw GaudiException( mess.str(), "Gaudi::Functional::details::zip::verifySizes", StatusCode::FAILURE );
80 }
81 }
82
84 template <typename... Args>
85 inline decltype( auto ) range( Args&&... args )
86 {
87 // assert( check_sizes( args... ) );
88 verifySizes( args... );
89 return ranges::view::zip( std::forward<Args>( args )... );
90 }
91
93 template <typename... Args>
94 inline decltype( auto ) const_range( Args&&... args )
95 {
96 // assert( check_sizes( args... ) );
97 verifySizes( args... );
98 return ranges::view::const_( ranges::view::zip( std::forward<Args>( args )... ) );
99 }
100 }
101
102 // implementation of C++17 std::as_const, see http://en.cppreference.com/w/cpp/utility/as_const
103 template <typename T>
104 constexpr typename std::add_const<T>::type& as_const( T& t ) noexcept
105 {
106 return t;
107 }
108
109 template <typename T>
110 void as_const( T&& t ) = delete;
111
113
114 template <typename Out1, typename Out2,
115 typename = typename std::enable_if<std::is_constructible<Out1, Out2>::value>::type>
116 Out1* put( DataObjectHandle<Out1>& out_handle, Out2&& out )
117 {
118 return out_handle.put( new Out1( std::forward<Out2>( out ) ) );
119 }
120
121 template <typename Out1, typename Out2,
122 typename = typename std::enable_if<std::is_constructible<Out1, Out2>::value>::type>
123 void put( AnyDataHandle<Out1>& out_handle, Out2&& out )
124 {
125 out_handle.put( std::forward<Out2>( out ) );
126 }
127
128 // optional put
129 template <typename OutHandle, typename Out>
130 void put( OutHandle& out_handle, boost::optional<Out>&& out )
131 {
132 if ( out ) put( out_handle, std::move( *out ) );
133 }
135 // adapt to differences between eg. std::vector (which has push_back) and KeyedContainer (which has insert)
136 // adapt to getting a T, and a container wanting T* by doing new T{ std::move(out) }
137 // adapt to getting a boost::optional<T>
138
139 constexpr struct insert_t {
140 // for Container<T*>, return T
141 template <typename Container>
142 using c_remove_ptr_t = typename std::remove_pointer<typename Container::value_type>::type;
143
144 template <typename Container, typename Value>
145 auto operator()( Container& c, Value&& v ) const -> decltype( c.push_back( v ) )
146 {
147 return c.push_back( std::forward<Value>( v ) );
148 }
149
150 template <typename Container, typename Value>
151 auto operator()( Container& c, Value&& v ) const -> decltype( c.insert( v ) )
152 {
153 return c.insert( std::forward<Value>( v ) );
154 }
155
156 // Container<T*> with T&& as argument
157 template <typename Container,
158 typename = typename std::enable_if<std::is_pointer<typename Container::value_type>::value>::type>
159 auto operator()( Container& c, c_remove_ptr_t<Container>&& v ) const
160 {
161 return operator()( c, new c_remove_ptr_t<Container>{std::move( v )} );
162 }
163
164 template <typename Container, typename Value>
165 void operator()( Container& c, boost::optional<Value>&& v ) const
166 {
167 if ( v ) operator()( c, std::move( *v ) );
168 }
169 } insert{};
170
172
173 constexpr struct deref_t {
174 template <typename In, typename = typename std::enable_if<!std::is_pointer<In>::value>::type>
175 In& operator()( In& in ) const
176 {
177 return in;
178 }
179
180 template <typename In>
181 In& operator()( In* in ) const
182 {
183 assert( in != nullptr );
184 return *in;
185 }
186 } deref{};
187
189
190 namespace details2
191 {
192 template <typename T>
193 struct remove_optional {
194 typedef T type;
195 };
196 template <typename T>
197 struct remove_optional<boost::optional<T>> {
198 typedef T type;
199 };
200 // template< typename T > struct remove_optional< std::optional<T> > {typedef T type;};
201 }
202 template <typename T>
203 using remove_optional_t = typename details2::remove_optional<T>::type;
204 template <typename T>
205 struct is_optional : std::false_type {
206 };
207 template <typename T>
208 struct is_optional<boost::optional<T>> : std::true_type {
209 };
210 // C++17: template <typename T> constexpr bool is_optional_v = is_optional<T>::value;
211
213 // if Container is a pointer, then we're optional items
214 namespace details2
215 {
216 template <typename Container, typename Value>
217 void push_back( Container& c, const Value& v, std::true_type )
218 {
219 c.push_back( v );
220 }
221 template <typename Container, typename Value>
222 void push_back( Container& c, const Value& v, std::false_type )
223 {
224 c.push_back( &v );
225 }
226
227 template <typename In>
228 struct get_from_handle {
229 template <template <typename> class Handle, typename I,
230 typename = typename std::enable_if<std::is_convertible<I, In>::value>::type>
231 auto operator()( const Handle<I>& h ) -> const In&
232 {
233 return *h.get();
234 }
235 template <template <typename> class Handle, typename I,
236 typename = typename std::enable_if<std::is_convertible<I*, In>::value>::type>
237 auto operator()( const Handle<I>& h ) -> const In
238 {
239 return h.getIfExists();
240 } // In is-a pointer
241 };
242
243 template <typename T>
244 T* deref_if( T* const t, std::false_type )
245 {
246 return t;
247 }
248 template <typename T>
249 T& deref_if( T* const t, std::true_type )
250 {
251 return *t;
252 }
253 }
254
255 template <typename Container>
256 class vector_of_const_
257 {
258 static constexpr bool is_optional = std::is_pointer<Container>::value;
259 using val_t = std::add_const_t<std::remove_pointer_t<Container>>;
260 using ptr_t = std::add_pointer_t<val_t>;
261 using ref_t = std::add_lvalue_reference_t<val_t>;
262 using ContainerVector = std::vector<ptr_t>;
263 ContainerVector m_containers;
264
265 public:
266 using value_type = std::conditional_t<is_optional, ptr_t, val_t>;
267 using size_type = typename ContainerVector::size_type;
268 class iterator
269 {
270 typename ContainerVector::const_iterator m_i;
271 friend class vector_of_const_;
272 iterator( typename ContainerVector::const_iterator iter ) : m_i( iter ) {}
273 using ret_t = std::conditional_t<is_optional, ptr_t, ref_t>;
274
275 public:
276 friend bool operator!=( const iterator& lhs, const iterator& rhs ) { return lhs.m_i != rhs.m_i; }
277 ret_t operator*() const { return details2::deref_if( *m_i, std::integral_constant<bool, !is_optional>{} ); }
278 iterator& operator++()
279 {
280 ++m_i;
281 return *this;
282 }
283 iterator& operator--()
284 {
285 --m_i;
286 return *this;
287 }
288 bool is_null() const { return !*m_i; }
289 explicit operator bool() const { return !is_null(); }
290 };
291 vector_of_const_() = default;
292 void reserve( size_type size ) { m_containers.reserve( size ); }
293 template <typename T> // , typename = std::is_convertible<T,std::conditional_t<is_optional,ptr_t,val_t>>
294 void push_back( T&& container )
295 {
296 details2::push_back( m_containers, std::forward<T>( container ),
297 std::integral_constant<bool, is_optional>{} );
298 } // note: does not copy its argument, so we're not really a container...
299 iterator begin() const { return m_containers.begin(); }
300 iterator end() const { return m_containers.end(); }
301 size_type size() const { return m_containers.size(); }
302 const Container& operator[]( size_type i ) const { return *m_containers[i]; }
303 const Container& at( size_type i ) const
304 {
305 if ( i >= size() ) throw std::out_of_range{"vector_of_const_::at"};
306 return *m_containers[i];
307 }
308 bool is_null( size_type i ) const { return !m_containers[i]; }
309 };
310
312
313 // detect whether a traits class defines the requested type,
314 // if so, use it,
315 // otherwise use the default
316 //
317 // based on http://en.cppreference.com/w/cpp/experimental/is_detected
318 // and the libstdc++ source, specificially libstdc++-v3/include/std/type_traits
319
320 namespace detail2
321 {
322 #ifdef HAVE_CPP17
323 template <typename...>
324 using void_t = void;
325 #else
326 template <typename...>
327 struct void_t_ {
328 using type = void;
329 };
330 template <typename... T>
331 using void_t = typename void_t_<T...>::type;
332 #endif
333
335 template <typename Default, typename AlwaysVoid, template <typename...> class Op, typename... Args>
336 struct detector {
337 using type = Default;
338 };
339
341 template <typename Default, template <typename...> class Op, typename... Args>
342 struct detector<Default, void_t<Op<Args...>>, Op, Args...> {
343 using type = Op<Args...>;
344 };
345 }
346
347 // Op<Args...> if that is a valid type, otherwise Default.
348 template <typename Default, template <typename...> class Op, typename... Args>
349 using detected_or_t = typename detail2::detector<Default, void, Op, Args...>::type;
350
351 // Op<Args...> if that is a valid type, otherwise Default<Args...>.
352 template <template <typename...> class Default, template <typename...> class Op, typename Tr, typename T>
353 using detected_or_t_ = detected_or_t<Default<Tr, T>, Op, Tr, T>;
354
356 namespace detail2
357 { // utilities for detected_or_t{,_} usage
358
359 template <typename Tr>
360 using BaseClass_ = typename Tr::BaseClass;
361 template <typename Tr, typename T>
362 using defaultHandle_ = typename std::conditional<std::is_base_of<DataObject, T>::value, DataObjectHandle<T>,
363 AnyDataHandle<T>>::type;
364 template <typename Tr, typename T>
365 using OutputHandle_ = typename Tr::template OutputHandle<T>;
366 template <typename Tr, typename T>
367 using InputHandle_ = typename Tr::template InputHandle<T>;
368 }
369
370 // check whether Traits::BaseClass is a valid type,
371 // if so, define BaseClass_t<Traits> as being Traits::BaseClass
372 // else define as being GaudiAlgorithm
373 template <typename Tr>
374 using BaseClass_t = detected_or_t<GaudiAlgorithm, detail2::BaseClass_, Tr>;
375
376 // check whether Traits::{Input,Output}Handle<T> is a valid type,
377 // if so, define {Input,Output}Handle_t<Traits,T> as being Traits::{Input,Output}Handle<T>
378 // else define as being DataObjectHandle<T> if T derives from DataObject, else
379 // AnyDataHandle<T>
380 template <typename Tr, typename T>
381 using OutputHandle_t = detected_or_t_<detail2::defaultHandle_, detail2::OutputHandle_, Tr, T>;
382 template <typename Tr, typename T>
383 using InputHandle_t = detected_or_t_<detail2::defaultHandle_, detail2::InputHandle_, Tr, T>;
384
386
387 namespace details2
388 {
389 template <std::size_t N, typename Tuple>
390 using element_t = typename std::tuple_element<N, Tuple>::type;
391
392 template <typename Tuple, typename KeyValues, std::size_t... I>
393 Tuple make_tuple_of_handles_helper( IDataHandleHolder* o, const KeyValues& initvalue, Gaudi::DataHandle::Mode m,
394 std::index_sequence<I...> )
395 {
396 return std::make_tuple( element_t<I, Tuple>{std::get<I>( initvalue ).second, m, o}... );
397 }
398 template <typename KeyValues, typename Properties, std::size_t... I>
399 void declare_tuple_of_properties_helper( Algorithm& owner, const KeyValues& inputs, Properties& props,
400 std::index_sequence<I...> )
401 {
402 (void)std::initializer_list<int>{
403 ( owner.declareProperty( std::get<I>( inputs ).first, std::get<I>( props ) ), 0 )...};
404 }
405 }
406
407 template <typename Tuple, typename KeyValues>
408 Tuple make_tuple_of_handles( IDataHandleHolder* owner, const KeyValues& initvalue, Gaudi::DataHandle::Mode mode )
409 {
410 return details2::make_tuple_of_handles_helper<Tuple>(
411 owner, initvalue, mode, std::make_index_sequence<std::tuple_size<Tuple>::value>{} );
412 }
413
414 template <typename KeyValues, typename Properties>
415 void declare_tuple_of_properties( Algorithm& owner, const KeyValues& inputs, Properties& props )
416 {
417 constexpr auto N = std::tuple_size<KeyValues>::value;
418 static_assert( N == std::tuple_size<Properties>::value, "Inconsistent lengths" );
419 details2::declare_tuple_of_properties_helper( owner, inputs, props, std::make_index_sequence<N>{} );
420 }
421
422 template <typename Handles>
423 Handles make_vector_of_handles( IDataHandleHolder* owner, const std::vector<std::string>& init,
424 Gaudi::DataHandle::Mode mode )
425 {
426 Handles handles;
427 handles.reserve( init.size() );
428 std::transform( init.begin(), init.end(), std::back_inserter( handles ),
429 [&]( const std::string& loc ) -> typename Handles::value_type {
430 return {loc, mode, owner};
431 } );
432 return handles;
433 }
434
436
437 template <typename OutputSpec, typename InputSpec, typename Traits_>
438 class DataHandleMixin;
439
440 template <typename... Out, typename... In, typename Traits_>
441 class DataHandleMixin<std::tuple<Out...>, std::tuple<In...>, Traits_> : public BaseClass_t<Traits_>
442 {
443 static_assert( std::is_base_of<Algorithm, BaseClass_t<Traits_>>::value,
444 "BaseClass must inherit from Algorithm" );
445
446 public:
447 using KeyValue = std::pair<std::string, std::string>;
448 constexpr static std::size_t N_in = sizeof...( In );
449 constexpr static std::size_t N_out = sizeof...( Out );
450
451 // generic constructor: N -> M
452 DataHandleMixin( const std::string& name, ISvcLocator* pSvcLocator, const std::array<KeyValue, N_in>& inputs,
453 const std::array<KeyValue, N_out>& outputs )
454 : BaseClass_t<Traits_>( name, pSvcLocator )
455 , m_inputs( make_tuple_of_handles<decltype( m_inputs )>( this, inputs, Gaudi::DataHandle::Reader ) )
456 , m_outputs( make_tuple_of_handles<decltype( m_outputs )>( this, outputs, Gaudi::DataHandle::Writer ) )
457 {
458 declare_tuple_of_properties( *this, inputs, m_inputs );
459 declare_tuple_of_properties( *this, outputs, m_outputs );
460 // make sure this algorithm is seen as reentrant by Gaudi
461 BaseClass_t<Traits_>::setProperty( "Cardinality", 0 );
462 }
463
464 // special cases: forward to the generic case...
465 // 1 -> 1
466 DataHandleMixin( const std::string& name, ISvcLocator* locator, const KeyValue& input, const KeyValue& output )
467 : DataHandleMixin( name, locator, std::array<KeyValue, 1>{input}, std::array<KeyValue, 1>{output} )
468 {
469 }
470 // 1 -> N
471 DataHandleMixin( const std::string& name, ISvcLocator* locator, const KeyValue& input,
472 const std::array<KeyValue, N_out>& outputs )
473 : DataHandleMixin( name, locator, std::array<KeyValue, 1>{input}, outputs )
474 {
475 }
476 // N -> 1
477 DataHandleMixin( const std::string& name, ISvcLocator* locator, const std::array<KeyValue, N_in>& inputs,
478 const KeyValue& output )
479 : DataHandleMixin( name, locator, inputs, std::array<KeyValue, 1>{output} )
480 {
481 }
482
483 template <std::size_t N = 0>
484 const std::string& inputLocation() const
485 {
486 return std::get<N>( m_inputs ).objKey();
487 }
488 unsigned int inputLocationSize() const { return std::tuple_size<decltype( m_inputs )>::value; }
489
490 template <std::size_t N = 0>
491 const std::string& outputLocation() const
492 {
493 return std::get<N>( m_outputs ).objKey();
494 }
495 unsigned int outputLocationSize() const { return std::tuple_size<decltype( m_outputs )>::value; }
496
497 protected:
498 std::tuple<details::InputHandle_t<Traits_, In>...> m_inputs;
499 std::tuple<details::OutputHandle_t<Traits_, Out>...> m_outputs;
500 };
501
502 template <typename... In, typename Traits_>
503 class DataHandleMixin<void, std::tuple<In...>, Traits_> : public BaseClass_t<Traits_>
504 {
505 static_assert( std::is_base_of<Algorithm, BaseClass_t<Traits_>>::value,
506 "BaseClass must inherit from Algorithm" );
507
508 public:
509 using KeyValue = std::pair<std::string, std::string>;
510 constexpr static std::size_t N_in = sizeof...( In );
511
512 // generic constructor: N -> 0
513 DataHandleMixin( const std::string& name, ISvcLocator* pSvcLocator, const std::array<KeyValue, N_in>& inputs )
514 : BaseClass_t<Traits_>( name, pSvcLocator )
515 , m_inputs( make_tuple_of_handles<decltype( m_inputs )>( this, inputs, Gaudi::DataHandle::Reader ) )
516 {
517 declare_tuple_of_properties( *this, inputs, m_inputs );
518 // make sure this algorithm is seen as reentrant by Gaudi
519 BaseClass_t<Traits_>::setProperty( "Cardinality", 0 );
520 }
521
522 // special cases: forward to the generic case...
523 // 1 -> 0
524 DataHandleMixin( const std::string& name, ISvcLocator* locator, const KeyValue& input )
525 : DataHandleMixin( name, locator, std::array<KeyValue, 1>{input} )
526 {
527 }
528
529 template <std::size_t N = 0>
530 const std::string& inputLocation() const
531 {
532 return std::get<N>( m_inputs ).objKey();
533 }
534 unsigned int inputLocationSize() const { return std::tuple_size<decltype( m_inputs )>::value; }
535
536 protected:
537 std::tuple<details::InputHandle_t<Traits_, In>...> m_inputs;
538 };
539
540 template <typename... Out, typename Traits_>
541 class DataHandleMixin<std::tuple<Out...>, void, Traits_> : public BaseClass_t<Traits_>
542 {
543 static_assert( std::is_base_of<Algorithm, BaseClass_t<Traits_>>::value,
544 "BaseClass must inherit from Algorithm" );
545
546 public:
547 using KeyValue = std::pair<std::string, std::string>;
548 constexpr static std::size_t N_out = sizeof...( Out );
549
550 // generic constructor: 0 -> N
551 DataHandleMixin( const std::string& name, ISvcLocator* pSvcLocator, const std::array<KeyValue, N_out>& outputs )
552 : BaseClass_t<Traits_>( name, pSvcLocator )
553 , m_outputs( make_tuple_of_handles<decltype( m_outputs )>( this, outputs, Gaudi::DataHandle::Writer ) )
554 {
555 declare_tuple_of_properties( *this, outputs, m_outputs );
556 // make sure this algorithm is seen as reentrant by Gaudi
557 BaseClass_t<Traits_>::setProperty( "Cardinality", 0 );
558 }
559
560 // 0 -> 1
561 DataHandleMixin( const std::string& name, ISvcLocator* locator, const KeyValue& output )
562 : DataHandleMixin( name, locator, std::array<KeyValue, 1>{output} )
563 {
564 }
565
566 template <std::size_t N = 0>
567 const std::string& outputLocation() const
568 {
569 return std::get<N>( m_outputs ).objKey();
570 }
571 unsigned int outputLocationSize() const { return std::tuple_size<decltype( m_outputs )>::value; }
572
573 protected:
574 std::tuple<details::OutputHandle_t<Traits_, Out>...> m_outputs;
575 };
576
578 template <typename Fun, typename Container, typename... Args>
579 constexpr void applyPostProcessing( const Fun&, Container&, Args... )
580 {
581 static_assert( sizeof...( Args ) == 0, "Args should not be used!" );
582 }
583
584 template <typename Fun, typename Container>
585 auto applyPostProcessing( const Fun& fun, Container& c ) -> decltype( fun.postprocess( c ), void() )
586 {
587 fun.postprocess( c );
588 }
589
591 }
592 }
593 }
594
595 #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:551
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:513
Gaudi::Functional::details::insert_t::operator()
auto operator()(Container &c, Value &&v) const -> decltype(c.insert(v))
Definition: FunctionalDetails.h:151
Gaudi::Functional::details::details2::remove_optional< boost::optional< T > >::type
T type
Definition: FunctionalDetails.h:198
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:1173
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:393
Gaudi::Functional::details::is_optional
Definition: FunctionalDetails.h:205
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
std::out_of_range
STL class.
Algorithm.h
Gaudi::Functional::details::as_const
constexpr std::add_const< T >::type & as_const(T &t) noexcept
Definition: FunctionalDetails.h:104
Gaudi::Functional::details::deref_t::operator()
In & operator()(In *in) const
Definition: FunctionalDetails.h:181
Gaudi::Functional::details::OutputHandle_t
detected_or_t_< detail2::defaultHandle_, detail2::OutputHandle_, Tr, T > OutputHandle_t
Definition: FunctionalDetails.h:381
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
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:477
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:292
gaudirun.c
c
Definition: gaudirun.py:407
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:423
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:276
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
StatusCode::FAILURE
Definition: StatusCode.h:31
Gaudi::Functional::details::declare_tuple_of_properties
void declare_tuple_of_properties(Algorithm &owner, const KeyValues &inputs, Properties &props)
Definition: FunctionalDetails.h:415
Gaudi::Functional::details::deref_t
Definition: FunctionalDetails.h:173
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::inputLocationSize
unsigned int inputLocationSize() const
Definition: FunctionalDetails.h:534
Gaudi::Functional::details::vector_of_const_::iterator::operator++
iterator & operator++()
Definition: FunctionalDetails.h:278
std::is_pointer
Gaudi::Functional::details::BaseClass_t
detected_or_t< GaudiAlgorithm, detail2::BaseClass_, Tr > BaseClass_t
Definition: FunctionalDetails.h:374
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
Gaudi::Functional::details::details2::declare_tuple_of_properties_helper
void declare_tuple_of_properties_helper(Algorithm &owner, const KeyValues &inputs, Properties &props, std::index_sequence< I... >)
Definition: FunctionalDetails.h:399
gaudirun.args
args
Definition: gaudirun.py:244
Gaudi::Functional::details::insert_t::operator()
auto operator()(Container &c, c_remove_ptr_t< Container > &&v) const
Definition: FunctionalDetails.h:159
gaudirun.output
output
Definition: gaudirun.py:404
Gaudi::Functional::details::zip::printSizes
void printSizes(OS &out, Arg &&arg)
Print the parameter.
Definition: FunctionalDetails.h:36
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:491
Gaudi::Functional::details::vector_of_const_::iterator::m_i
ContainerVector::const_iterator m_i
Definition: FunctionalDetails.h:270
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:452
Gaudi::Functional::details::detail2::InputHandle_
typename Tr::template InputHandle< T > InputHandle_
Definition: FunctionalDetails.h:367
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:466
Gaudi::Functional::details::vector_of_const_::val_t
std::add_const_t< std::remove_pointer_t< Container >> val_t
Definition: FunctionalDetails.h:259
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:142
Gaudi::Functional::details::vector_of_const_::is_null
bool is_null(size_type i) const
Definition: FunctionalDetails.h:308
std
STL namespace.
Gaudi::Functional::void
class MergingTransformer< Out(const vector_of_const_< In > void
Definition: MergingTransformer.h:23
std::make_tuple
T make_tuple(T...args)
Gaudi::Functional::details::insert_t::operator()
auto operator()(Container &c, Value &&v) const -> decltype(c.push_back(v))
Definition: FunctionalDetails.h:145
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:484
Gaudi::Functional::details::detail2::void_t_::type
void type
Definition: FunctionalDetails.h:328
std::size_t
Gaudi::Functional::details::details2::push_back
void push_back(Container &c, const Value &v, std::true_type)
Definition: FunctionalDetails.h:217
Properties
std::vector< Gaudi::Details::PropertyBase * > Properties
Definition: PropertyMgr.h:134
Gaudi::Functional::details::vector_of_const_::iterator::iterator
iterator(typename ContainerVector::const_iterator iter)
Definition: FunctionalDetails.h:272
Gaudi::Functional::details::details2::get_from_handle
Definition: FunctionalDetails.h:228
Gaudi::Functional::details::vector_of_const_::ref_t
std::add_lvalue_reference_t< val_t > ref_t
Definition: FunctionalDetails.h:261
Gaudi::Functional::details::insert_t
Definition: FunctionalDetails.h:139
Gaudi::Functional::details::details2::deref_if
T * deref_if(T *const t, std::false_type)
Definition: FunctionalDetails.h:244
Gaudi::Functional::details::detail2::void_t
typename void_t_< T... >::type void_t
Definition: FunctionalDetails.h:331
Gaudi::Functional::details::vector_of_const_::operator[]
const Container & operator[](size_type i) const
Definition: FunctionalDetails.h:302
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:256
Gaudi::Functional::details::details2::remove_optional
Definition: FunctionalDetails.h:193
Gaudi::Units::second
constexpr double second
Definition: SystemOfUnits.h:123
std::string
STL class.
Gaudi::Functional::details::vector_of_const_::iterator::operator*
ret_t operator*() const
Definition: FunctionalDetails.h:277
Gaudi::Functional::details::vector_of_const_::value_type
std::conditional_t< is_optional, ptr_t, val_t > value_type
Definition: FunctionalDetails.h:266
Gaudi::Functional::details::vector_of_const_::iterator
Definition: FunctionalDetails.h:268
Gaudi::Functional::details::vector_of_const_::size
size_type size() const
Definition: FunctionalDetails.h:301
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:336
IDataHandleHolder
Definition: IDataHandleHolder.h:14
IOTest.N
int N
Definition: IOTest.py:101
Gaudi::Functional::details::vector_of_const_::m_containers
ContainerVector m_containers
Definition: FunctionalDetails.h:263
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::inputLocation
const std::string & inputLocation() const
Definition: FunctionalDetails.h:530
BrunelScenarioForwardScheduler.inputs
inputs
Definition: BrunelScenarioForwardScheduler.py:133
Gaudi::Functional::details::DataHandleMixin
Definition: FunctionalDetails.h:438
Gaudi::Functional::details::applyPostProcessing
constexpr void applyPostProcessing(const Fun &, Container &, Args...)
Definition: FunctionalDetails.h:579
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:471
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::outputLocation
const std::string & outputLocation() const
Definition: FunctionalDetails.h:567
HiveAlgSequencer.h
h
Definition: HiveAlgSequencer.py:24
Gaudi::Functional::details::deref_t::operator()
In & operator()(In &in) const
Definition: FunctionalDetails.h:175
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:94
std::ostringstream
STL class.
GaudiException.h
gaudirun.type
type
Definition: gaudirun.py:133
Gaudi::Functional::details::details2::get_from_handle::operator()
auto operator()(const Handle< I > &h) -> const In &
Definition: FunctionalDetails.h:231
DataObjectHandle::put
T * put(T *object)
Register object in transient store.
Definition: DataObjectHandle.h:154
Gaudi::Functional::details::remove_optional_t
typename details2::remove_optional< T >::type remove_optional_t
Definition: FunctionalDetails.h:203
Gaudi::DataHandle
Definition: DataHandle.h:28
Gaudi::Functional::details::details2::get_from_handle::operator()
auto operator()(const Handle< I > &h) -> const In
Definition: FunctionalDetails.h:237
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::DataHandleMixin
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &output)
Definition: FunctionalDetails.h:561
std::ostringstream::str
T str(T...args)
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&...args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:85
Gaudi::Functional::details::make_tuple_of_handles
Tuple make_tuple_of_handles(IDataHandleHolder *owner, const KeyValues &initvalue, Gaudi::DataHandle::Mode mode)
Definition: FunctionalDetails.h:408
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, std::tuple< In... >, Traits_ >::outputLocationSize
unsigned int outputLocationSize() const
Definition: FunctionalDetails.h:495
GaudiMath::Integration::Default
Definition: Integration.h:36
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:488
Gaudi::Functional::details::detail2::defaultHandle_
typename std::conditional< std::is_base_of< DataObject, T >::value, DataObjectHandle< T >, AnyDataHandle< T >>::type defaultHandle_
Definition: FunctionalDetails.h:363
std::add_const
std::tuple
std::pair
std::remove_pointer
Gaudi::Functional::details::zip::verifySizes
decltype(auto) verifySizes(Args &...args)
Verify the data container sizes have the same sizes.
Definition: FunctionalDetails.h:73
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
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:343
Gaudi::Functional::details::detail2::void_t_
Definition: FunctionalDetails.h:327
Gaudi::Functional::details::vector_of_const_::iterator::operator--
iterator & operator--()
Definition: FunctionalDetails.h:283
Gaudi::Functional::m_inputs
std::vector< InputHandle_t< In > > m_inputs
Definition: MergingTransformer.h:45
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:28
std::vector< ptr_t >
Gaudi::Functional::details::vector_of_const_::iterator::ret_t
std::conditional_t< is_optional, ptr_t, ref_t > ret_t
Definition: FunctionalDetails.h:273
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:353
Gaudi::Functional::details::insert_t::operator()
void operator()(Container &c, boost::optional< Value > &&v) const
Definition: FunctionalDetails.h:165
Gaudi::Functional::details::details2::remove_optional::type
T type
Definition: FunctionalDetails.h:194
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:52
Gaudi::Functional::details::DataHandleMixin< void, std::tuple< In... >, Traits_ >::m_inputs
std::tuple< details::InputHandle_t< Traits_, In >... > m_inputs
Definition: FunctionalDetails.h:537
Gaudi::Functional::details::vector_of_const_::push_back
void push_back(T &&container)
Definition: FunctionalDetails.h:294
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:303
Gaudi::Functional::details::details2::element_t
typename std::tuple_element< N, Tuple >::type element_t
Definition: FunctionalDetails.h:390
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::m_outputs
std::tuple< details::OutputHandle_t< Traits_, Out >... > m_outputs
Definition: FunctionalDetails.h:574
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
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:524
Gaudi::Functional::details::detail2::OutputHandle_
typename Tr::template OutputHandle< T > OutputHandle_
Definition: FunctionalDetails.h:365
Gaudi::Functional::Traits_
struct[[deprecated("use MergingTransformer instead")]] Traits_
Definition: ListTransformer.h:14
Algorithm::declareProperty
Gaudi::Details::PropertyBase * declareProperty(const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
Definition: Algorithm.h:370
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:260
Gaudi::Functional::details::detail2::BaseClass_
typename Tr::BaseClass BaseClass_
Definition: FunctionalDetails.h:360
Gaudi::DataHandle::Mode
Mode
Definition: DataHandle.h:31
Gaudi::Functional::details::InputHandle_t
detected_or_t_< detail2::defaultHandle_, detail2::InputHandle_, Tr, T > InputHandle_t
Definition: FunctionalDetails.h:383
Gaudi::Functional::details::detail2::detector::type
Default type
Definition: FunctionalDetails.h:337
Gaudi::Functional::details::vector_of_const_::iterator::is_null
bool is_null() const
Definition: FunctionalDetails.h:288
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:94
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:498
Gaudi::Functional::details::details2::deref_if
T & deref_if(T *const t, std::true_type)
Definition: FunctionalDetails.h:249
Gaudi::Functional::details::vector_of_const_::end
iterator end() const
Definition: FunctionalDetails.h:300
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1
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:499
compareOutputFiles.Reader
def Reader(readerType, filename, qacross, qToEngine)
Definition: compareOutputFiles.py:129
std::initializer_list
Gaudi::Functional::details::put
Out1 * put(DataObjectHandle< Out1 > &out_handle, Out2 &&out)
Definition: FunctionalDetails.h:116
Gaudi::Functional::details::details2::push_back
void push_back(Container &c, const Value &v, std::false_type)
Definition: FunctionalDetails.h:222
Gaudi::Functional::details::detected_or_t
typename detail2::detector< Default, void, Op, Args... >::type detected_or_t
Definition: FunctionalDetails.h:349
Gaudi::Functional::KeyValues
std::pair< std::string, std::vector< std::string >> KeyValues
Definition: MergingTransformer.h:30
GaudiPython.GaudiAlgs.Tuple
Tuple
Definition: GaudiAlgs.py:1130
std::vector::reserve
T reserve(T...args)
Gaudi::Functional::details::vector_of_const_::size_type
typename ContainerVector::size_type size_type
Definition: FunctionalDetails.h:267
Gaudi::Functional::details::vector_of_const_::begin
iterator begin() const
Definition: FunctionalDetails.h:299
DataObjectHandle.h
Gaudi::Functional::details::DataHandleMixin< std::tuple< Out... >, void, Traits_ >::outputLocationSize
unsigned int outputLocationSize() const
Definition: FunctionalDetails.h:571