The Gaudi Framework  master (e98cfcff)
Loading...
Searching...
No Matches
utilities.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-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
12
14
15namespace Gaudi::Functional {
16
17 namespace Traits {
18
19 // traits classes used to customize Transformer and FilterPredicate
20 // Define the types to to be used as baseclass, and as in- resp. output hanldes.
21 // In case a type is not specified in the traits struct, a default is used.
22 //
23 // The defaults are:
24 //
25 // using BaseClass = Gaudi::Algorithm
26 // template <typename T> using InputHandle = DataObjectHandle<T>;
27 // template <typename T> using OutputHandle = DataObjectHandle<T>;
28 //
29
30 // the best way to 'compose' traits is by inheriting them one-by-one...
31 template <typename... Base>
32 struct use_ : Base... {};
33
34 // helper classes one can inherit from to specify a specific trait
35 template <typename Base>
36 struct BaseClass_t {
37 using BaseClass = Base;
38 };
39
40 template <template <typename> class Handle>
42 template <typename T>
43 using InputHandle = Handle<T>;
44 };
45
46 template <template <typename> class Handle>
48 template <typename T>
49 using OutputHandle = Handle<T>;
50 };
51
52 template <typename Data, typename View>
53 struct writeViewFor {
54 template <std::same_as<Data> T>
56 };
57
58 // add support for objects that should reside in the TES for lifetime management, but should not
59 // be used explicitly and/or directly by downstream code.
60 template <typename Data>
62 struct OpaqueView {
63 OpaqueView() = default;
64 template <typename T>
65 OpaqueView( T const& ) {}
66 };
67
68 template <std::same_as<Data> T>
70 };
71
72 // this uses the defaults -- and it itself is the default ;-)
74 } // namespace Traits
75} // namespace Gaudi::Functional
DataObjectWriteHandle< OpaqueView, Data > OutputHandle
Definition utilities.h:69
DataObjectWriteHandle< View, Data > OutputHandle
Definition utilities.h:55