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
13
#include <
GaudiKernel/DataObjectHandle.h
>
14
15
namespace
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>
41
struct
InputHandle_t
{
42
template
<
typename
T>
43
using
InputHandle
= Handle<T>;
44
};
45
46
template
<
template
<
typename
>
class
Handle>
47
struct
OutputHandle_t
{
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>
55
using
OutputHandle
=
DataObjectWriteHandle<View, Data>
;
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>
61
struct
WriteOpaqueFor
{
62
struct
OpaqueView
{
63
OpaqueView
() =
default
;
64
template
<
typename
T>
65
OpaqueView
( T
const
& ) {}
66
};
67
68
template
<std::same_as<Data> T>
69
using
OutputHandle
=
DataObjectWriteHandle<OpaqueView, Data>
;
70
};
71
72
// this uses the defaults -- and it itself is the default ;-)
73
using
useDefaults
=
use_<>
;
74
}
// namespace Traits
75
}
// namespace Gaudi::Functional
DataObjectHandle.h
DataObjectWriteHandle
Definition
DataObjectHandle.h:466
Gaudi::Functional::Traits
Definition
utilities.h:17
Gaudi::Functional::Traits::useDefaults
use_<> useDefaults
Definition
utilities.h:73
Gaudi::Functional
Definition
Consumer.h:15
Gaudi::Functional::Traits::BaseClass_t
Definition
utilities.h:36
Gaudi::Functional::Traits::BaseClass_t::BaseClass
Base BaseClass
Definition
utilities.h:37
Gaudi::Functional::Traits::InputHandle_t
Definition
utilities.h:41
Gaudi::Functional::Traits::InputHandle_t::InputHandle
Handle< T > InputHandle
Definition
utilities.h:43
Gaudi::Functional::Traits::OutputHandle_t
Definition
utilities.h:47
Gaudi::Functional::Traits::OutputHandle_t::OutputHandle
Handle< T > OutputHandle
Definition
utilities.h:49
Gaudi::Functional::Traits::WriteOpaqueFor::OpaqueView::OpaqueView
OpaqueView()=default
Gaudi::Functional::Traits::WriteOpaqueFor::OpaqueView::OpaqueView
OpaqueView(T const &)
Definition
utilities.h:65
Gaudi::Functional::Traits::WriteOpaqueFor
Definition
utilities.h:61
Gaudi::Functional::Traits::WriteOpaqueFor::OutputHandle
DataObjectWriteHandle< OpaqueView, Data > OutputHandle
Definition
utilities.h:69
Gaudi::Functional::Traits::use_
Definition
utilities.h:32
Gaudi::Functional::Traits::writeViewFor
Definition
utilities.h:53
Gaudi::Functional::Traits::writeViewFor::OutputHandle
DataObjectWriteHandle< View, Data > OutputHandle
Definition
utilities.h:55
GaudiFunctional
include
Gaudi
Functional
utilities.h
Generated on Wed Jun 3 2026 11:01:19 for The Gaudi Framework by
1.13.1