ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaSharedWriter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#include "AthenaSharedWriter.h"
14
15//___________________________________________________________________________
16AthenaSharedWriter::AthenaSharedWriter(const std::string& name, ISvcLocator* pSvcLocator)
17 : AthFilterAlgorithm(name, pSvcLocator) {
18}
19//___________________________________________________________________________
21 ATH_MSG_INFO("in initialize()");
22 // Initialize IConversionSvc
23 ATH_CHECK(m_cnvSvc.retrieve());
24 // Use IDataShare to make ConversionSvc a Share Server
25 IDataShare* dataShare = dynamic_cast<IDataShare*>(m_cnvSvc.get());
26 if (dataShare == nullptr || !dataShare->makeServer(-m_numberOfClients.value() - 1).isSuccess()) {
27 ATH_MSG_FATAL("Could not make AthenaPoolCnvSvc a share server: " << dataShare);
28 return StatusCode::FAILURE;
29 } else {
30 ATH_MSG_DEBUG("Successfully made the conversion service a share server");
31 }
32 // Initialize IAthenaSharedWriterSvc
33 ATH_CHECK(m_sharedWriterSvc.retrieve());
34 return StatusCode::SUCCESS;
35}
36//___________________________________________________________________________
38 ATH_MSG_DEBUG("in execute()");
40 setFilterPassed(false); // don't output events
41 return StatusCode::SUCCESS;
42}
43//___________________________________________________________________________
45 ATH_MSG_INFO("in finalize()");
46 AthCnvSvc* cnvSvc = dynamic_cast<AthCnvSvc*>(m_cnvSvc.get());
47 if (cnvSvc == nullptr || !cnvSvc->disconnectOutput("").isSuccess()) {
48 ATH_MSG_FATAL("Could not disconnectOutput");
49 return StatusCode::FAILURE;
50 }
51 // Release IAthenaSharedWriterSvc
52 if (!m_sharedWriterSvc.release().isSuccess()) {
53 ATH_MSG_WARNING("Could not release IAthenaSharedWriterSvc");
54 }
55 return StatusCode::SUCCESS;
56}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This file contains the class definition for the AthenaSharedWriter class.
Base class for all conversion services.
Definition AthCnvSvc.h:66
virtual StatusCode disconnectOutput(const std::string &output)
Disconnect output files from the service.
virtual void setFilterPassed(bool state) const
Set the filter passed flag to the specified state.
AthFilterAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
IntegerProperty m_numberOfClients
AthenaSharedWriter(const std::string &name, ISvcLocator *pSvcLocator)
Standard Service Constructor.
virtual StatusCode finalize() override
ServiceHandle< IConversionSvc > m_cnvSvc
ServiceHandle< IAthenaSharedWriterSvc > m_sharedWriterSvc
virtual StatusCode initialize() override
Gaudi Service Interface method implementations:
virtual StatusCode execute() override
Abstract interface for sharing data.
Definition IDataShare.h:24
virtual StatusCode makeServer(int num)=0
Make this a server.