Back to home page

EIC code displayed by LXR

 
 

    


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

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 #pragma once
0012 
0013 #include <GaudiKernel/EventContext.h>
0014 #include <GaudiKernel/IEventProcessor.h>
0015 #include <GaudiKernel/StatusCode.h>
0016 #include <optional>
0017 #include <tuple>
0018 
0019 namespace Gaudi::Interfaces {
0020   /// Extend IEventProcessor for asynchronous scheduling of events via queue-like interface.
0021   struct IQueueingEventProcessor : virtual IEventProcessor {
0022     DeclareInterfaceID( IQueueingEventProcessor, 1, 0 );
0023 
0024     /// Type of objects in the output queue.
0025     using ResultType = std::tuple<StatusCode, EventContext>;
0026 
0027     /// Schedule the processing of an event.
0028     /// May block, depending on the concrete implementation.
0029     virtual void push( EventContext&& ctx ) = 0;
0030 
0031     /// Tell if the processor has events in the queues.
0032     /// Useful to know when all the work has been done (including retrieving the results).
0033     virtual bool empty() const = 0;
0034 
0035     /// Get the next available result.
0036     /// If none is available, return std::nullopt.
0037     virtual std::optional<ResultType> pop() = 0;
0038   };
0039 } // namespace Gaudi::Interfaces