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