Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:39

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 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 #ifndef GAUDIKERNEL_IDATASTOREAGENT_H
0012 #define GAUDIKERNEL_IDATASTOREAGENT_H
0013 
0014 // Framework include files
0015 #include "GaudiKernel/Kernel.h"
0016 #include <functional>
0017 
0018 // Forward declarations:
0019 class IRegistry;
0020 
0021 /** @class IDataStoreAgent IDataStoreAgent.h GaudiKernel/IDataStoreAgent.h
0022 
0023     Generic data agent interface
0024 
0025     @author Markus Frank
0026 */
0027 class GAUDI_API IDataStoreAgent {
0028 public:
0029   /// destructor
0030   virtual ~IDataStoreAgent() = default;
0031 
0032   /** Analyse the data object.
0033   @return Boolean indicating wether the tree below should be analysed
0034   */
0035   virtual bool analyse( IRegistry* pObject, int level ) = 0;
0036 };
0037 
0038 namespace details {
0039   template <typename F>
0040   class GenericDataStoreAgent final : public IDataStoreAgent {
0041     F f;
0042 
0043   public:
0044     template <typename G>
0045     GenericDataStoreAgent( G&& g ) : f{ std::forward<G>( g ) } {}
0046 
0047     bool analyse( IRegistry* pObj, int level ) override { return std::invoke( f, pObj, level ); }
0048   };
0049 } // namespace details
0050 
0051 template <typename F>
0052 ::details::GenericDataStoreAgent<F> makeDataStoreAgent( F&& f ) {
0053   return { std::forward<F>( f ) };
0054 }
0055 
0056 #endif // GAUDIKERNEL_IDATASTOREAGENT_H