17#include "GaudiKernel/FileIncident.h"
18#include "GaudiKernel/IIncidentSvc.h"
19#include "GaudiKernel/StatusCode.h"
29 long eventNumber,
const void* source,
30 size_t nbytes,
unsigned int status) {
38 base_class(name, pSvcLocator) {
43 return StatusCode::FAILURE;
48 return StatusCode::FAILURE;
55 m_incidentSvc->removeListener(
this, IncidentType::BeginProcessing);
56 m_incidentSvc->removeListener(
this, IncidentType::EndProcessing);
58 return StatusCode::SUCCESS;
63 return StatusCode::SUCCESS;
70 return StatusCode::SUCCESS;
78 delete m_endIter; m_endIter =
nullptr;
79 return ::AthService::finalize();
98 while (
sc.isRecoverable()) {
105 void* tokenStrPtr =
nullptr;
106 unsigned int status = 0;
108 std::unique_ptr<const char[]> tokenStr{
static_cast<const char*
>(tokenStrPtr)};
109 if (
sc.isRecoverable()) {
113 return StatusCode::FAILURE;
115 if (
sc.isFailure()) {
116 ATH_MSG_FATAL(
"Cannot get NextEvent from AthenaSharedMemoryTool");
117 return StatusCode::FAILURE;
119 if (!eventStore()->clearStore().isSuccess()) {
122 std::unique_ptr<AthenaAttributeList> athAttrList = std::make_unique<AthenaAttributeList>();
123 athAttrList->extend(
"eventRef",
"string");
124 (*athAttrList)[
"eventRef"].data<std::string>() = tokenStr.get();
126 if (!wh.record(std::move(athAttrList)).isSuccess()) {
128 return StatusCode::FAILURE;
133 if (guid != m_guid && m_processMetadata.value()) {
135 "FID:" + guid.toString(), guid.toString(),
139 return StatusCode::SUCCESS;
146 for (
int i = 0; i < jump; i++) {
149 return StatusCode::SUCCESS;
151 return StatusCode::FAILURE;
158 return StatusCode::FAILURE;
161 if (ds->makeServer(num - 1).isFailure()) {
162 ATH_MSG_ERROR(
"Failed to switch AthenaPoolCnvSvc to output DataStreaming server");
164 return StatusCode::SUCCESS;
166 if (ds->makeServer(num + 1).isFailure()) {
167 ATH_MSG_ERROR(
"Failed to switch AthenaPoolCnvSvc to input DataStreaming server");
168 return StatusCode::FAILURE;
171 return StatusCode::SUCCESS;
173 m_processMetadata =
false;
183 return StatusCode::FAILURE;
185 if (ds->makeClient(num + 1).isFailure()) {
186 ATH_MSG_ERROR(
"Failed to switch AthenaPoolCnvSvc to DataStreaming client");
187 return StatusCode::FAILURE;
190 return StatusCode::SUCCESS;
193 std::string dummyStr;
202 return StatusCode::FAILURE;
206 while (
sc.isRecoverable()) {
211 if (
sc.isFailure()) {
212 if (ds->makeClient(0).isFailure()) {
213 return StatusCode::FAILURE;
216 while (
sc.isRecoverable() ||
sc.isFailure()) {
221 if (ds->makeClient(1).isFailure()) {
222 return StatusCode::FAILURE;
227 return StatusCode::FAILURE;
235 return StatusCode::FAILURE;
238 ATH_MSG_ERROR(
"No AthenaSharedMemoryTool configured for readEvent()");
239 return StatusCode::FAILURE;
242 std::unique_ptr<IEvtSelector::Context> ctxt = std::make_unique<EventContextAthenaPool>(
this);
243 for (
int i = 0; i < maxevt || maxevt == -1; ++i) {
244 if (!
next(*ctxt).isSuccess()) {
245 if (m_evtCount == -1) {
246 ATH_MSG_VERBOSE(
"Called read Event and read last event from input: " << i);
249 ATH_MSG_ERROR(
"Cannot read Event " << m_evtCount - 1 <<
" into AthenaSharedMemoryTool");
250 return StatusCode::FAILURE;
259 while (ds->readData().isSuccess()) {
260 ATH_MSG_VERBOSE(
"Called last readData, while marking last event in readEvent()");
264 if (!
sc.isSuccess()) {
265 ATH_MSG_ERROR(
"Cannot put last Event marker to AthenaSharedMemoryTool");
266 return StatusCode::FAILURE;
269 while (
sc.isSuccess() ||
sc.isRecoverable()) {
272 ATH_MSG_DEBUG(
"Failed last readData -> Clients are stopped, after marking last event in readEvent()");
274 return StatusCode::SUCCESS;
283 return StatusCode::FAILURE;
285 std::string token = m_headerIterator->eventRef().toString();
288 m_evtCount - 1, token.c_str(),
289 token.length() + 1, 0)).isRecoverable() ) {
290 while (ds->readData().isSuccess()) {
291 ATH_MSG_VERBOSE(
"Called last readData, while putting next event in next()");
295 if (!
sc.isSuccess()) {
296 ATH_MSG_ERROR(
"Cannot put Event " << m_evtCount - 1 <<
" to AthenaSharedMemoryTool");
297 return StatusCode::FAILURE;
300 return StatusCode::SUCCESS;
305 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
This file contains the class definition for the EventContextAthenaPool class.
This file contains the class definition for the EventSelectorAthenaPoolSharedIO class.
This file contains the class definition for the Token class (migrated from POOL).
#define ATLAS_THREAD_SAFE
virtual StatusCode finalize() override
virtual StatusCode next(IEvtSelector::Context &ctxt) const override
Gaudi::Property< int > m_makeStreamingToolClient
Make this instance a Streaming Client during first iteration automatically.
virtual StatusCode start() override
virtual StatusCode makeServer(int num) override
Make this a server.
virtual StatusCode makeClient(int num) override
Make this a client.
virtual StatusCode stop() override
EventSelectorAthenaPoolSharedIO(const std::string &name, ISvcLocator *pSvcLocator)
Standard Service Constructor.
virtual StatusCode initialize() override
Required of all Gaudi Services.
virtual StatusCode share(int evtnum) override
Request to share a given event number.
virtual StatusCode readEvent(int maxevt) override
Read the next maxevt events.
virtual StatusCode io_reinit() override
Callback method to reinitialize the internal state of the component for I/O purposes (e....
virtual StatusCode recordAttributeList() const override
Record AttributeList in StoreGate.
ToolHandle< IAthenaIPCTool > m_eventStreamingTool
virtual StatusCode start() override
virtual StatusCode initialize() override
Required of all Gaudi Services.
virtual StatusCode io_reinit() override
Callback method to reinitialize the internal state of the component for I/O purposes (e....
virtual StatusCode stop() override
virtual StatusCode next(IEvtSelector::Context &ctxt) const override
virtual StatusCode finalize() override
virtual StatusCode recordAttributeList() const override
Record AttributeList in StoreGate.
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
static const Guid & null() noexcept
NULL-Guid: static class method.
Abstract interface for sharing data.
static const std::string & storeName(const StoreID::type &s)
This class provides a token that identifies in a unique way objects on the persistent storage.
Token & fromString(const std::string_view from)
Build from the string representation of a token.
const Guid & dbID() const
Access database identifier.
::StatusCode StatusCode
StatusCode definition for legacy code.