The Gaudi Framework  v33r0 (d5ea422b)
FunctionalDetails.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 FUNCTIONAL_DETAILS_H
12 #define FUNCTIONAL_DETAILS_H
13 
14 #include <cassert>
15 #include <sstream>
16 #include <stdexcept>
17 #include <type_traits>
18 
19 // TODO: fwd declare instead?
21 #include "GaudiKernel/Algorithm.h"
25 #include "GaudiKernel/detected.h"
26 
27 // Range V3
28 #include <range/v3/version.hpp>
29 #include <range/v3/view/const.hpp>
30 #include <range/v3/view/zip.hpp>
31 // upstream has renamed namespace ranges::view ranges::views
32 #if RANGE_V3_VERSION < 900
33 namespace ranges::views {
34  using namespace ranges::view;
35 }
36 #endif
37 
38 #if defined( __clang__ ) && ( __clang_major__ < 9 )
39 # define GF_SUPPRESS_SPURIOUS_CLANG_WARNING_BEGIN \
40  _Pragma( "clang diagnostic push" ) _Pragma( "clang diagnostic ignored \"-Wunused-lambda-capture\"" )
41 # define GF_SUPPRESS_SPURIOUS_CLANG_WARNING_END _Pragma( "clang diagnostic pop" )
42 #else
43 # define GF_SUPPRESS_SPURIOUS_CLANG_WARNING_BEGIN
44 # define GF_SUPPRESS_SPURIOUS_CLANG_WARNING_END
45 #endif
46 
48 
49  // CRJ : Stuff for zipping
50  namespace zip {
51 
53  template <typename OS, typename Arg>
54  void printSizes( OS& out, Arg&& arg ) {
55  out << "SizeOf'" << System::typeinfoName( typeid( Arg ) ) << "'=" << std::forward<Arg>( arg ).size();
56  }
57 
59  template <typename OS, typename Arg, typename... Args>
60  void printSizes( OS& out, Arg&& arg, Args&&... args ) {
61  printSizes( out, arg );
62  out << ", ";
63  printSizes( out, args... );
64  }
65 
67  template <typename A>
68  inline bool check_sizes( const A& ) noexcept {
69  return true;
70  }
71 
73  template <typename A, typename B>
74  inline bool check_sizes( const A& a, const B& b ) noexcept {
75  return a.size() == b.size();
76  }
77 
79  template <typename A, typename B, typename... C>
80  inline bool check_sizes( const A& a, const B& b, const C&... c ) noexcept {
81  return ( check_sizes( a, b ) && check_sizes( b, c... ) );
82  }
83 
85  template <typename... Args>
86  inline decltype( auto ) verifySizes( Args&... args ) {
87  if ( UNLIKELY( !check_sizes( args... ) ) ) {
88  std::ostringstream mess;
89  mess << "Zipped containers have different sizes : ";
90  printSizes( mess, args... );
91  throw GaudiException( mess.str(), "Gaudi::Functional::details::zip::verifySizes", StatusCode::FAILURE );
92  }
93  }
94 
96  template <typename... Args>
97  inline decltype( auto ) range( Args&&... args ) {
98 #ifndef NDEBUG
99  verifySizes( args... );
100 #endif
101  return ranges::views::zip( std::forward<Args>( args )... );
102  }
103 
105  template <typename... Args>
106  inline decltype( auto ) const_range( Args&&... args ) {
107 #ifndef NDEBUG
108  verifySizes( args... );
109 #endif
110  return ranges::views::const_( ranges::views::zip( std::forward<Args>( args )... ) );
111  }
112  } // namespace zip
113 
115  namespace details2 {
116  // note: boost::optional in boost 1.66 does not have 'has_value()'...
117  // that requires boost 1.68 or later... so for now, use operator bool() instead ;-(
118  template <typename T>
119  using is_optional_ = decltype( bool{std::declval<T>()}, std::declval<T>().value() );
120  } // namespace details2
121  template <typename Arg>
122  constexpr bool is_optional_v = Gaudi::cpp17::is_detected_v<details2::is_optional_, Arg>;
123 
124  template <typename Arg>
125  using require_is_optional = std::enable_if_t<is_optional_v<Arg>>;
126 
127  template <typename Arg>
128  using require_is_not_optional = std::enable_if_t<!is_optional_v<Arg>>;
129 
130  template <typename T>
131  using remove_optional_t = std::conditional_t<is_optional_v<T>, typename T::value_type, T>;
132 
133  constexpr struct invoke_optionally_t {
134  template <typename F, typename Arg, typename = require_is_not_optional<Arg>>
135  decltype( auto ) operator()( F&& f, Arg&& arg ) const {
136  return std::invoke( std::forward<F>( f ), std::forward<Arg>( arg ) );
137  }
138  template <typename F, typename Arg, typename = require_is_optional<Arg>>
139  void operator()( F&& f, Arg&& arg ) const {
140  if ( arg ) std::invoke( std::forward<F>( f ), *std::forward<Arg>( arg ) );
141  }
142  } invoke_optionally{};
144 
145  template <typename Out1, typename Out2,
146  typename = std::enable_if_t<std::is_constructible_v<Out1, Out2> && std::is_base_of_v<DataObject, Out1>>>
147  Out1* put( const DataObjectHandle<Out1>& out_handle, Out2&& out ) {
148  return out_handle.put( std::make_unique<Out1>( std::forward<Out2>( out ) ) );
149  }
150 
151  template <typename Out1, typename Out2, typename = std::enable_if_t<std::is_constructible_v<Out1, Out2>>>
152  void put( const DataObjectHandle<AnyDataWrapper<Out1>>& out_handle, Out2&& out ) {
153  out_handle.put( std::forward<Out2>( out ) );
154  }
155 
156  // optional put
157  template <typename OutHandle, typename OptOut, typename = require_is_optional<OptOut>>
158  void put( const OutHandle& out_handle, OptOut&& out ) {
159  if ( out ) put( out_handle, *std::forward<OptOut>( out ) );
160  }
162  // adapt to differences between eg. std::vector (which has push_back) and KeyedContainer (which has insert)
163  // adapt to getting a T, and a container wanting T* by doing new T{ std::move(out) }
164  // adapt to getting a optional<T>
165 
166  constexpr struct insert_t {
167  // for Container<T*>, return T
168  template <typename Container>
169  using c_remove_ptr_t = std::remove_pointer_t<typename Container::value_type>;
170 
171  template <typename Container, typename Value>
172  auto operator()( Container& c, Value&& v ) const -> decltype( c.push_back( v ) ) {
173  return c.push_back( std::forward<Value>( v ) );
174  }
175 
176  template <typename Container, typename Value>
177  auto operator()( Container& c, Value&& v ) const -> decltype( c.insert( v ) ) {
178  return c.insert( std::forward<Value>( v ) );
179  }
180 
181  // Container<T*> with T&& as argument
182  template <typename Container, typename Value,
183  typename = std::enable_if_t<std::is_pointer_v<typename Container::value_type>>,
184  typename = std::enable_if_t<std::is_convertible_v<Value, c_remove_ptr_t<Container>>>>
185  auto operator()( Container& c, Value&& v ) const {
186  return operator()( c, new c_remove_ptr_t<Container>{std::forward<Value>( v )} );
187  }
188 
189  } insert{};
190 
192 
193  constexpr struct deref_t {
194  template <typename In, typename = std::enable_if_t<!std::is_pointer_v<In>>>
195  const In& operator()( const In& in ) const {
196  return in;
197  }
198 
199  template <typename In>
200  const In& operator()( const In* in ) const {
201  assert( in != nullptr );
202  return *in;
203  }
204  } deref{};
205 
207  // if Container is a pointer, then we're optional items
208  namespace details2 {
209  template <typename Container, typename Value>
210  void push_back( Container& c, const Value& v, std::true_type ) {
211  c.push_back( v );
212  }
213  template <typename Container, typename Value>
214  void push_back( Container& c, const Value& v, std::false_type ) {
215  c.push_back( &v );
216  }
217 
218  template <typename In>
220  template <template <typename> class Handle, typename I, typename = std::enable_if_t<std::is_convertible_v<I, In>>>
221  auto operator()( const Handle<I>& h ) -> const In& {
222  return *h.get();
223  }
224  template <template <typename> class Handle, typename I,
225  typename = std::enable_if_t<std::is_convertible_v<I*, In>>>
226  auto operator()( const Handle<I>& h ) -> const In {
227  return h.getIfExists();
228  } // In is-a pointer
229  };
230 
231  template <typename T>
232  T* deref_if( T* const t, std::false_type ) {
233  return t;
234  }
235  template <typename T>
236  T& deref_if( T* const t, std::true_type ) {
237  return *t;
238  }
239  } // namespace details2
240 
241  template <typename Container>
243  static constexpr bool is_pointer = std::is_pointer_v<Container>;
244  using val_t = std::add_const_t<std::remove_pointer_t<Container>>;
245  using ptr_t = std::add_pointer_t<val_t>;
246  using ref_t = std::add_lvalue_reference_t<val_t>;
249 
250  public:
251  using value_type = std::conditional_t<is_pointer, ptr_t, val_t>;
252  using size_type = typename ContainerVector::size_type;
253  class iterator {
254  using it_t = typename ContainerVector::const_iterator;
256  friend class vector_of_const_;
257  iterator( it_t iter ) : m_i( iter ) {}
258  using ret_t = std::conditional_t<is_pointer, ptr_t, ref_t>;
259 
260  public:
261  using iterator_category = typename it_t::iterator_category;
262  using value_type = typename it_t::iterator_category;
263  using reference = typename it_t::reference;
264  using pointer = typename it_t::pointer;
265  using difference_type = typename it_t::difference_type;
266 
267  friend bool operator!=( const iterator& lhs, const iterator& rhs ) { return lhs.m_i != rhs.m_i; }
268  friend bool operator==( const iterator& lhs, const iterator& rhs ) { return lhs.m_i == rhs.m_i; }
269  friend auto operator-( const iterator& lhs, const iterator& rhs ) { return lhs.m_i - rhs.m_i; }
270  ret_t operator*() const { return details2::deref_if( *m_i, std::bool_constant<!is_pointer>{} ); }
272  ++m_i;
273  return *this;
274  }
276  --m_i;
277  return *this;
278  }
279  bool is_null() const { return !*m_i; }
280  explicit operator bool() const { return !is_null(); }
281  };
282  vector_of_const_() = default;
283  void reserve( size_type size ) { m_containers.reserve( size ); }
284  template <typename T> // , typename = std::is_convertible<T,std::conditional_t<is_pointer,ptr_t,val_t>>
285  void push_back( T&& container ) {
286  details2::push_back( m_containers, std::forward<T>( container ), std::bool_constant<is_pointer>{} );
287  } // note: does not copy its argument, so we're not really a container...
288  iterator begin() const { return m_containers.begin(); }
289  iterator end() const { return m_containers.end(); }
290  size_type size() const { return m_containers.size(); }
291 
292  template <typename X = Container>
293  std::enable_if_t<!std::is_pointer_v<X>, ref_t> operator[]( size_type i ) const {
294  return *m_containers[i];
295  }
296 
297  template <typename X = Container>
298  std::enable_if_t<std::is_pointer_v<X>, ptr_t> operator[]( size_type i ) const {
299  return m_containers[i];
300  }
301 
302  template <typename X = Container>
303  std::enable_if_t<!std::is_pointer_v<X>, ref_t> at( size_type i ) const {
304  return *m_containers[i];
305  }
306 
307  template <typename X = Container>
308  std::enable_if_t<std::is_pointer_v<X>, ptr_t> at( size_type i ) const {
309  return m_containers[i];
310  }
311 
312  bool is_null( size_type i ) const { return !m_containers[i]; }
313  };
314 
316  namespace detail2 { // utilities for detected_or_t{,_} usage
317  template <typename Tr>
318  using BaseClass_t = typename Tr::BaseClass;
319  template <typename Tr, typename T>
320  using OutputHandle_t = typename Tr::template OutputHandle<T>;
321  template <typename Tr, typename T>
322  using InputHandle_t = typename Tr::template InputHandle<T>;
323  } // namespace detail2
324 
325  // check whether Traits::BaseClass is a valid type,
326  // if so, define BaseClass_t<Traits> as being Traits::BaseClass
327  // else define as being GaudiAlgorithm
328  template <typename Tr>
329  using BaseClass_t = Gaudi::cpp17::detected_or_t<GaudiAlgorithm, detail2::BaseClass_t, Tr>;
330 
331  // check whether Traits::{Input,Output}Handle<T> is a valid type,
332  // if so, define {Input,Output}Handle_t<Traits,T> as being Traits::{Input,Output}Handle<T>
333  // else define as being DataObject{Read,,Write}Handle<T>
334  template <typename Tr, typename T>
335  using OutputHandle_t = Gaudi::cpp17::detected_or_t<DataObjectWriteHandle<T>, detail2::OutputHandle_t, Tr, T>;
336  template <typename Tr, typename T>
337  using InputHandle_t = Gaudi::cpp17::detected_or_t<DataObjectReadHandle<T>, detail2::InputHandle_t, Tr, T>;
338 
339  template <typename Traits>
340  inline constexpr bool isLegacy =
341  std::is_base_of_v<Gaudi::details::LegacyAlgorithmAdapter, details::BaseClass_t<Traits>>;
342 
344 
345  template <typename Handles>
347  Handles handles;
348  handles.reserve( init.size() );
350  init.begin(), init.end(),
351  std::back_inserter( handles ), [&]( const std::string& loc ) -> typename Handles::value_type {
352  return {loc, owner};
353  } );
354  return handles;
355  }
356 
357  template <typename Handle, typename Algo>
358  auto get( const Handle& handle, const Algo&, const EventContext& )
359  -> decltype( details::deref( handle.get() ) ) // make it SFINAE friendly...
360  {
361  return details::deref( handle.get() );
362  }
363 
364  template <typename Handle>
365  auto getKey( const Handle& h ) -> decltype( h.objKey() ) {
366  return h.objKey();
367  }
368 
370  // given a pack, return a corresponding tuple
371  template <typename... In>
373  using type = std::tuple<In...>;
374 
375  static_assert( !std::disjunction_v<std::is_same<EventContext, In>...>,
376  "EventContext can only appear as first argument" );
377 
378  template <typename Algorithm, typename Handles>
379  static auto apply( const Algorithm& algo, Handles& handles ) {
380  return std::apply( [&]( const auto&... handle ) { return algo( details::deref( handle.get() )... ); }, handles );
381  }
382  template <typename Algorithm, typename Handles>
383  static auto apply( const Algorithm& algo, const EventContext& ctx, Handles& handles ) {
384  return std::apply( [&]( const auto&... handle ) { return algo( get( handle, algo, ctx )... ); }, handles );
385  }
386  };
387 
388  // except when it starts with EventContext, then drop it
389  template <typename... In>
391  using type = std::tuple<In...>;
392 
393  static_assert( !std::disjunction_v<std::is_same<EventContext, In>...>,
394  "EventContext can only appear as first argument" );
395 
396  template <typename Algorithm, typename Handles>
397  static auto apply( const Algorithm& algo, const EventContext& ctx, Handles& handles ) {
398  return std::apply( [&]( const auto&... handle ) { return algo( ctx, get( handle, algo, ctx )... ); }, handles );
399  }
400 
401  template <typename Algorithm, typename Handles>
402  static auto apply( const Algorithm& algo, Handles& handles ) {
403  return apply( algo, Gaudi::Hive::currentContext(), handles );
404  }
405  };
406 
407  template <typename... In>
409 
410  template <typename OutputSpec, typename InputSpec, typename Traits_>
412 
413  template <typename Out, typename In, typename Tr>
415  const std::string& newLoc ) {
416  auto sc = parent.setProperty( prop, newLoc );
417  if ( sc.isFailure() ) throw GaudiException( "Could not set Property", prop + " -> " + newLoc, sc );
418  }
419 
420  template <typename Out, typename In, typename Tr>
422  const std::vector<std::string>& newLocs ) {
425  ss << '[', newLocs, ", ", []( std::ostream & os, const auto& i ) -> auto& { return os << "'" << i << "'"; } )
426  << ']';
427  auto sc = parent.setProperty( prop, ss.str() );
428  if ( sc.isFailure() ) throw GaudiException( "Could not set Property", prop + " -> " + ss.str(), sc );
429  }
430 
431  template <typename... Out, typename... In, typename Traits_>
432  class DataHandleMixin<std::tuple<Out...>, std::tuple<In...>, Traits_> : public BaseClass_t<Traits_> {
433  static_assert( std::is_base_of_v<Algorithm, BaseClass_t<Traits_>>, "BaseClass must inherit from Algorithm" );
434 
435  template <typename IArgs, typename OArgs, std::size_t... I, std::size_t... J>
436  DataHandleMixin( const std::string& name, ISvcLocator* pSvcLocator, const IArgs& inputs, std::index_sequence<I...>,
437  const OArgs& outputs, std::index_sequence<J...> )
438  : BaseClass_t<Traits_>( name, pSvcLocator )
439  , m_inputs( std::tuple_cat( std::forward_as_tuple( this ), std::get<I>( inputs ) )... )
440  , m_outputs( std::tuple_cat( std::forward_as_tuple( this ), std::get<J>( outputs ) )... ) {
441  this->setProperty( "Cardinality", 0 ); // make sure this algorithm is seen as reentrant by Gaudi
442  }
443 
444  public:
445  constexpr static std::size_t N_in = sizeof...( In );
446  constexpr static std::size_t N_out = sizeof...( Out );
447 
450 
451  // generic constructor: N -> M
453  const std::array<KeyValue, N_out>& outputs )
454  : DataHandleMixin( name, pSvcLocator, inputs, std::index_sequence_for<In...>{}, outputs,
455  std::index_sequence_for<Out...>{} ) {}
456 
457  // special cases: forward to the generic case...
458  // 1 -> 1
459  DataHandleMixin( const std::string& name, ISvcLocator* locator, const KeyValue& input, const KeyValue& output )
460  : DataHandleMixin( name, locator, std::array<KeyValue, 1>{input}, std::array<KeyValue, 1>{output} ) {}
461  // 1 -> N
462  DataHandleMixin( const std::string& name, ISvcLocator* locator, const KeyValue& input,
463  const std::array<KeyValue, N_out>& outputs )
464  : DataHandleMixin( name, locator, std::array<KeyValue, 1>{input}, outputs ) {}
465  // N -> 1
467  const KeyValue& output )
468  : DataHandleMixin( name, locator, inputs, std::array<KeyValue, 1>{output} ) {}
469 
470  template <std::size_t N = 0>
471  decltype( auto ) inputLocation() const {
472  return getKey( std::get<N>( m_inputs ) );
473  }
474  template <typename T>
475  decltype( auto ) inputLocation() const {
476  return getKey( std::get<details::InputHandle_t<Traits_, std::decay_t<T>>>( m_inputs ) );
477  }
478  constexpr unsigned int inputLocationSize() const { return N_in; }
479 
480  template <std::size_t N = 0>
481  decltype( auto ) outputLocation() const {
482  return getKey( std::get<N>( m_outputs ) );
483  }
484  template <typename T>
485  decltype( auto ) outputLocation() const {
486  return getKey( std::get<details::OutputHandle_t<Traits_, std::decay_t<T>>>( m_outputs ) );
487  }
488  constexpr unsigned int outputLocationSize() const { return N_out; }
489 
490  protected:
491  bool isReEntrant() const override { return true; }
492 
495  };
496 
497  template <typename Traits_>
498  class DataHandleMixin<std::tuple<>, std::tuple<>, Traits_> : public BaseClass_t<Traits_> {
499  static_assert( std::is_base_of_v<Algorithm, BaseClass_t<Traits_>>, "BaseClass must inherit from Algorithm" );
500 
501  public:
502  DataHandleMixin( const std::string& name, ISvcLocator* pSvcLocator ) : BaseClass_t<Traits_>( name, pSvcLocator ) {
503  this->setProperty( "Cardinality", 0 ); // make sure this algorithm is seen as reentrant by Gaudi
504  }
505 
506  protected:
507  bool isReEntrant() const override { return true; }
508 
510  };
511 
512  template <typename... In, typename Traits_>
513  class DataHandleMixin<std::tuple<>, std::tuple<In...>, Traits_> : public BaseClass_t<Traits_> {
514  static_assert( std::is_base_of_v<Algorithm, BaseClass_t<Traits_>>, "BaseClass must inherit from Algorithm" );
515 
516  template <typename IArgs, std::size_t... I>
517  DataHandleMixin( const std::string& name, ISvcLocator* pSvcLocator, const IArgs& inputs, std::index_sequence<I...> )
518  : BaseClass_t<Traits_>( name, pSvcLocator )
519  , m_inputs( std::tuple_cat( std::forward_as_tuple( this ), std::get<I>( inputs ) )... ) {
520  this->setProperty( "Cardinality", 0 ); // make sure this algorithm is seen as reentrant by Gaudi
521  }
522 
523  public:
526  constexpr static std::size_t N_in = sizeof...( In );
527 
528  // generic constructor: N -> 0
530  : DataHandleMixin( name, pSvcLocator, inputs, std::index_sequence_for<In...>{} ) {}
531 
532  // special cases: forward to the generic case...
533  // 1 -> 0
534  DataHandleMixin( const std::string& name, ISvcLocator* locator, const KeyValue& input )
535  : DataHandleMixin( name, locator, std::array<KeyValue, 1>{input} ) {}
536 
537  template <std::size_t N = 0>
538  decltype( auto ) inputLocation() const {
539  return getKey( std::get<N>( m_inputs ) );
540  }
541  template <typename T>
542  decltype( auto ) inputLocation() const {
543  return getKey( std::get<details::InputHandle_t<Traits_, std::decay_t<T>>>( m_inputs ) );
544  }
545  constexpr unsigned int inputLocationSize() const { return N_in; }
546 
547  protected:
548  bool isReEntrant() const override { return true; }
549 
551  };
552 
553  template <typename... Out, typename Traits_>
554  class DataHandleMixin<std::tuple<Out...>, std::tuple<>, Traits_> : public BaseClass_t<Traits_> {
555  static_assert( std::is_base_of_v<Algorithm, BaseClass_t<Traits_>>, "BaseClass must inherit from Algorithm" );
556 
557  template <typename OArgs, std::size_t... J>
558  DataHandleMixin( const std::string& name, ISvcLocator* pSvcLocator, const OArgs& outputs,
559  std::index_sequence<J...> )
560  : BaseClass_t<Traits_>( name, pSvcLocator )
561  , m_outputs( std::tuple_cat( std::forward_as_tuple( this ), std::get<J>( outputs ) )... ) {
562  this->setProperty( "Cardinality", 0 ); // make sure this algorithm is seen as reentrant by Gaudi
563  }
564 
565  public:
566  constexpr static std::size_t N_out = sizeof...( Out );
569 
570  // generic constructor: 0 -> N
572  : DataHandleMixin( name, pSvcLocator, outputs, std::index_sequence_for<Out...>{} ) {}
573 
574  // 0 -> 1
576  : DataHandleMixin( name, locator, std::array<KeyValue, 1>{output} ) {}
577 
578  template <std::size_t N = 0>
579  decltype( auto ) outputLocation() const {
580  return getKey( std::get<N>( m_outputs ) );
581  }
582  constexpr unsigned int outputLocationSize() const { return N_out; }
583 
584  protected:
585  bool isReEntrant() const override { return true; }
586 
588  };
589 
591  template <typename Fun, typename Container, typename... Args>
592  constexpr void applyPostProcessing( const Fun&, Container&, Args... ) {
593  static_assert( sizeof...( Args ) == 0, "Args should not be used!" );
594  }
595 
596  template <typename Fun, typename Container>
597  auto applyPostProcessing( const Fun& fun, Container& c ) -> decltype( fun.postprocess( c ), void() ) {
598  fun.postprocess( c );
599  }
600 
601 } // namespace Gaudi::Functional::details
602 
603 #endif
auto operator()(Container &c, Value &&v) const -> decltype(c.insert(v))
auto operator()(Container &c, Value &&v) const
bool check_sizes(const A &a, const B &b, const C &... c) noexcept
Compare sizes of 3 or more containers.
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const IArgs &inputs, std::index_sequence< I... >)
#define UNLIKELY(x)
Definition: Kernel.h:106
constexpr auto size(const T &, Args &&...) noexcept
auto applyPostProcessing(const Fun &fun, Container &c) -> decltype(fun.postprocess(c), void())
Gaudi::cpp17::detected_or_t< DataObjectWriteHandle< T >, detail2::OutputHandle_t, Tr, T > OutputHandle_t
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const std::array< KeyValue, N_in > &inputs, const std::array< KeyValue, N_out > &outputs)
void printSizes(OS &out, Arg &&arg, Args &&... args)
Print the parameters.
std::add_const_t< std::remove_pointer_t< Container > > val_t
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:35
decltype(bool{std::declval< T >()}, std::declval< T >().value()) is_optional_
std::enable_if_t< is_optional_v< Arg > > require_is_optional
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
DataHandleMixin(const std::string &name, ISvcLocator *locator, const std::array< KeyValue, N_in > &inputs, const KeyValue &output)
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const std::array< KeyValue, N_in > &inputs)
Header file for class GaudiAlgorithm.
T * put(std::unique_ptr< T > object) const
Register object in transient store.
static auto apply(const Algorithm &algo, Handles &handles)
void push_back(Container &c, const Value &v, std::false_type)
STL namespace.
T end(T... args)
void put(const OutHandle &out_handle, OptOut &&out)
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &output)
std::conditional_t< is_optional_v< T >, typename T::value_type, T > remove_optional_t
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
This class represents an entry point to all the event specific data.
Definition: EventContext.h:34
STL class.
typename Tr::template InputHandle< T > InputHandle_t
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const std::array< KeyValue, N_out > &outputs)
DataObjectHandle.h GaudiKernel/DataObjectHandle.h.
Definition: AlgTool.h:36
decltype(auto) verifySizes(Args &... args)
Verify the data container sizes have the same sizes.
decltype(auto) const_range(Args &&... args)
Zips multiple containers together to form a single const range.
typename filter_evtcontext_t< In... >::type filter_evtcontext
T & deref_if(T *const t, std::true_type)
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &input)
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
Definition: Bootstrap.cpp:243
typename Tr::template OutputHandle< T > OutputHandle_t
GAUDI_API const EventContext & currentContext()
T str(T... args)
void updateHandleLocation(DataHandleMixin< Out, In, Tr > &parent, const std::string &prop, const std::string &newLoc)
std::enable_if_t<!is_optional_v< Arg > > require_is_not_optional
std::conditional_t< is_pointer, ptr_t, val_t > value_type
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
Definition: SerializeSTL.h:47
friend bool operator==(const iterator &lhs, const iterator &rhs)
std::enable_if_t<!std::is_pointer_v< X >, ref_t > at(size_type i) const
static auto apply(const Algorithm &algo, const EventContext &ctx, Handles &handles)
Alias for backward compatibility.
Definition: Algorithm.h:66
T size(T... args)
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
std::enable_if_t<!std::is_pointer_v< X >, ref_t > operator[](size_type i) const
std::enable_if_t< std::is_pointer_v< X >, ptr_t > at(size_type i) const
T begin(T... args)
T back_inserter(T... args)
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const IArgs &inputs, std::index_sequence< I... >, const OArgs &outputs, std::index_sequence< J... >)
std::enable_if_t< std::is_pointer_v< X >, ptr_t > operator[](size_type i) const
constexpr struct ranges::Gaudi::Functional::details::insert_t insert
void updateHandleLocations(DataHandleMixin< Out, In, Tr > &parent, const std::string &prop, const std::vector< std::string > &newLocs)
std::conditional_t< is_pointer, ptr_t, ref_t > ret_t
std::remove_pointer_t< typename Container::value_type > c_remove_ptr_t
STL class.
auto operator()(Container &c, Value &&v) const -> decltype(c.push_back(v))
constexpr static const auto FAILURE
Definition: StatusCode.h:97
DataHandleMixin(const std::string &name, ISvcLocator *pSvcLocator, const OArgs &outputs, std::index_sequence< J... >)
const In & operator()(const In &in) const
friend auto operator-(const iterator &lhs, const iterator &rhs)
Handles make_vector_of_handles(IDataHandleHolder *owner, const std::vector< std::string > &init)
T transform(T... args)
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &input, const KeyValue &output)
constexpr struct ranges::Gaudi::Functional::details::deref_t deref
auto getKey(const Handle &h) -> decltype(h.objKey())
friend bool operator!=(const iterator &lhs, const iterator &rhs)
const In & operator()(const In *in) const
DataHandleMixin(const std::string &name, ISvcLocator *locator, const KeyValue &input, const std::array< KeyValue, N_out > &outputs)
STL class.
constexpr struct ranges::Gaudi::Functional::details::invoke_optionally_t invoke_optionally
Gaudi::cpp17::detected_or_t< DataObjectReadHandle< T >, detail2::InputHandle_t, Tr, T > InputHandle_t
static auto apply(const Algorithm &algo, const EventContext &ctx, Handles &handles)
T reserve(T... args)
Gaudi::cpp17::detected_or_t< GaudiAlgorithm, detail2::BaseClass_t, Tr > BaseClass_t
auto operator *(const std::chrono::duration< Rep1, Period > &lhs, const std::chrono::duration< Rep2, Period > &rhs)
Multiplication of two std::chrono::duration objects with same Period.
Definition: Counters.h:40