The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
IncidentAsyncTestAlg.cpp
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\***********************************************************************************/
12
14
19
20// Static Factory declaration
22
23//=============================================================================
26 if ( sc.isFailure() ) return sc;
27 // get service containing event data
29 // Copied from CPUCruncher.cpp
30 for ( auto k : m_inpKeys ) {
31 debug() << "adding input key " << k << endmsg;
33 declare( *m_inputObjHandles.back() );
34 }
35
36 for ( auto k : m_outKeys ) {
37 debug() << "adding output key " << k << endmsg;
39 declare( *m_outputObjHandles.back() );
40 }
41
43}
44
45//=============================================================================
47 uint64_t data = 0;
48 MsgStream logstream( msgSvc(), name() );
49 for ( auto& inputHandle : m_inputObjHandles ) {
50 if ( !inputHandle->isValid() ) continue;
51
52 DataObject const* obj = inputHandle->get();
53 if ( !obj ) logstream << MSG::ERROR << "A read object was a null pointer." << endmsg;
54 }
55
56 m_service->getData( &data );
57 for ( auto& outputHandle : m_outputObjHandles ) {
58 if ( !outputHandle->isValid() ) continue;
59 outputHandle->put( std::make_unique<DataObject>() );
60 }
61 info() << "Read data " << data << endmsg;
63}
64
65//=============================================================================
67 info() << "Finalizing " << endmsg;
68 return Algorithm::finalize();
69}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
DataObjectHandle.h GaudiKernel/DataObjectHandle.h.
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
Definition Algorithm.h:175
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
Definition Algorithm.h:181
const std::string & name() const override
The identifying name of the algorithm object.
SmartIF< IService > service(std::string_view name, const bool createIf=true, const bool quiet=false) const
Return a pointer to the service identified by name (or "type/name")
StatusCode execute() override
Gaudi::Property< std::vector< std::string > > m_outKeys
StatusCode initialize() override
SmartIF< IIncidentAsyncTestSvc > m_service
Gaudi::Property< std::string > m_serviceName
Gaudi::Property< std::vector< std::string > > m_inpKeys
StatusCode finalize() override
std::vector< std::unique_ptr< DataObjectHandle< DataObject > > > m_inputObjHandles
std::vector< std::unique_ptr< DataObjectHandle< DataObject > > > m_outputObjHandles
Definition of the MsgStream class used to transmit messages.
Definition MsgStream.h:29
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isFailure() const
Definition StatusCode.h:129
constexpr static const auto SUCCESS
Definition StatusCode.h:99
@ ERROR
Definition IMessageSvc.h:22