The Gaudi Framework  master (e98cfcff)
Loading...
Searching...
No Matches
deprecated.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 2026 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#pragma once
16#include <algorithm>
17#include <iterator>
18#include <sstream>
19#include <string>
20#include <tuple>
21#include <type_traits>
22#include <vector>
23
25 template <typename... T>
26 struct type_list;
27
28 template <typename Handles>
29 [[deprecated]] Handles make_vector_of_handles( IDataHandleHolder* owner, const std::vector<DataObjID>& init ) {
30 Handles handles;
31 handles.reserve( init.size() );
32 std::transform( init.begin(), init.end(), std::back_inserter( handles ),
33 [&]( const auto& loc ) -> typename Handles::value_type {
34 return { loc, owner };
35 } );
36 return handles;
37 }
38
39 template <typename OutputSpec, typename InputSpec, typename Traits_>
40 class DataHandleMixin;
41
42 template <typename Out, typename In, typename Tr>
43 [[deprecated]] void updateHandleLocation( DataHandleMixin<Out, In, Tr>& parent, const std::string& prop,
44 const std::string& newLoc ) {
45 parent.setProperty( prop, newLoc ).orThrow( "Could not set Property", prop + " -> " + newLoc );
46 }
47
48 template <typename Out, typename In, typename Tr>
49 [[deprecated]] void updateHandleLocations( DataHandleMixin<Out, In, Tr>& parent, const std::string& prop,
50 const std::vector<std::string>& newLocs ) {
51 std::ostringstream ss;
52 GaudiUtils::details::ostream_joiner( ss << '[', newLocs, ", ", []( std::ostream& os, const auto& i ) -> auto& {
53 return os << "'" << i << "'";
54 } ) << ']';
55 parent.setProperty( prop, ss.str() ).orThrow( "Could not set Property", prop + " -> " + ss.str() );
56 }
57
58 template <typename... In>
59 struct /*[[deprecated( "use EventContextHandle in DataHandleMixin inputs instead" )]]*/ filter_evtcontext_t {
60 using type = std::tuple<In...>;
61
62 static_assert( !std::disjunction_v<std::is_same<EventContext, In>...>,
63 "EventContext can only appear as first argument" );
64
65 template <typename Algorithm, typename Handles>
66 static auto apply( const Algorithm& algo, const EventContext& ctx, Handles& handles ) {
67 return std::apply( [&]( const auto&... handle ) { return algo( get( handle, algo, ctx )... ); }, handles );
68 }
69 };
70
71 template <typename... In>
72 struct /*[[deprecated(
73 "use EventContextHandle in DataHandleMixin inputs instead" )]]*/
75 using type = std::tuple<In...>;
76
77 static_assert( !std::disjunction_v<std::is_same<EventContext, In>...>,
78 "EventContext can only appear as first argument" );
79
80 template <typename Algorithm, typename Handles>
81 static auto apply( const Algorithm& algo, const EventContext& ctx, Handles& handles ) {
82 return std::apply( [&]( const auto&... handle ) { return algo( ctx, get( handle, algo, ctx )... ); }, handles );
83 }
84 };
85
86 template <typename... In>
87 using filter_evtcontext /*[[deprecated( "use EventContextHandle in DataHandleMixin inputs instead" )]]*/ =
88 typename filter_evtcontext_t<In...>::type;
89
90 template <typename... Out, typename... In, typename Traits_>
91 class [[deprecated( "use DataHandleMixin<type_list<...>, type_list<...>, Traits> instead" )]] DataHandleMixin<
92 std::tuple<Out...>, std::tuple<In...>, Traits_>
93 : public DataHandleMixin<type_list<Out...>, type_list<In...>, Traits_> {
94 using base_class = DataHandleMixin<type_list<Out...>, type_list<In...>, Traits_>;
95
96 public:
97 using base_class::base_class;
98 };
99} // namespace Gaudi::Functional::details
Provide serialization function (output only) for some common STL classes (vectors,...
This class represents an entry point to all the event specific data.
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:87
DataHandleMixin(std::string name, ISvcLocator *pSvcLocator, const IArgs &inputs, std::index_sequence< I... >, const OArgs &outputs, std::index_sequence< J... >)
Definition details.h:764
DataHandleMixin< type_list< Out... >, type_list< In... >, Traits_ > base_class
Definition deprecated.h:94
auto get(const Handle &handle, const Algo &, const EventContext &) -> decltype(details::deref(handle.get()))
Definition details.h:717
Handles make_vector_of_handles(IDataHandleHolder *owner, const std::vector< DataObjID > &init)
Definition deprecated.h:29
void updateHandleLocation(DataHandleMixin< Out, In, Tr > &parent, const std::string &prop, const std::string &newLoc)
Definition deprecated.h:43
void updateHandleLocations(DataHandleMixin< Out, In, Tr > &parent, const std::string &prop, const std::vector< std::string > &newLocs)
Definition deprecated.h:49
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
STL namespace.
static auto apply(const Algorithm &algo, const EventContext &ctx, Handles &handles)
Definition deprecated.h:81
static auto apply(const Algorithm &algo, const EventContext &ctx, Handles &handles)
Definition deprecated.h:66