Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:57:53

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #pragma once
0012 
0013 #include <GaudiKernel/DataObjectHandle.h>
0014 #include <GaudiKernel/SerializeSTL.h>
0015 #include <boost/algorithm/string/join.hpp>
0016 
0017 namespace Gaudi::Functional {
0018 
0019   namespace Traits {
0020 
0021     // traits classes used to customize Transformer and FilterPredicate
0022     // Define the types to to be used as baseclass, and as in- resp. output hanldes.
0023     // In case a type is not specified in the traits struct, a default is used.
0024     //
0025     // The defaults are:
0026     //
0027     //      using BaseClass = Gaudi::Algorithm
0028     //      template <typename T> using InputHandle = DataObjectHandle<T>;
0029     //      template <typename T> using OutputHandle = DataObjectHandle<T>;
0030     //
0031 
0032     // the best way to 'compose' traits is by inheriting them one-by-one...
0033     template <typename... Base>
0034     struct use_ : Base... {};
0035 
0036     // helper classes one can inherit from to specify a specific trait
0037     template <typename Base>
0038     struct BaseClass_t {
0039       using BaseClass = Base;
0040     };
0041 
0042     template <template <typename> class Handle>
0043     struct InputHandle_t {
0044       template <typename T>
0045       using InputHandle = Handle<T>;
0046     };
0047 
0048     template <template <typename> class Handle>
0049     struct OutputHandle_t {
0050       template <typename T>
0051       using OutputHandle = Handle<T>;
0052     };
0053 
0054     template <typename Data, typename View>
0055     struct writeViewFor {
0056       template <std::same_as<Data> T>
0057       using OutputHandle = DataObjectWriteHandle<View, Data>;
0058     };
0059 
0060     // add support for objects that should reside in the TES for lifetime management, but should not
0061     // be used explicitly and/or directly by downstream code.
0062     template <typename Data>
0063     struct WriteOpaqueFor {
0064       struct OpaqueView {
0065         OpaqueView() = default;
0066         template <typename T>
0067         OpaqueView( T const& ) {}
0068       };
0069 
0070       template <std::same_as<Data> T>
0071       using OutputHandle = DataObjectWriteHandle<OpaqueView, Data>;
0072     };
0073 
0074     // this uses the defaults -- and it itself is the default ;-)
0075     using useDefaults = use_<>;
0076   } // namespace Traits
0077 } // namespace Gaudi::Functional