ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaHDFStreamTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ATHENAHDFSTREAMTOOL_H
6#define ATHENAHDFSTREAMTOOL_H
7
12
13#include "GaudiKernel/ServiceHandle.h"
17
18#include <optional>
19#include <string>
20
21// Forward declarations.
22class IIncidentSvc;
23
24namespace H5 {
25 class H5File;
26 class Group;
27}
28
32/* To use this tool to
33 * write data to HDF5 add the following jobOption fragment:
34 *
35 * from AthenaCommon.AppMgr import ServiceMgr as svcMgr
36 * import AthenaPoolCnvSvc.AthenaPool
37 * from AthenaIPCTools.AthenaIPCToolsConf import AthenaHDFStreamTool
38 * svcMgr.AthenaPoolCnvSvc.OutputStreamingTool += [ AthenaHDFStreamTool("OutputStreamingTool") ]
39 * svcMgr.AthenaPoolCnvSvc.MakeStreamingToolClient = 1
40 * svcMgr.AthenaPoolCnvSvc.ParallelCompression=False
41 *
42 * To read it back use:
43 * from AthenaCommon.AppMgr import ServiceMgr as svcMgr
44 * import AthenaPoolCnvSvc.ReadAthenaPool
45 * from AthenaIPCTools.AthenaIPCToolsConf import AthenaHDFStreamTool
46 * svcMgr.EventSelector.SharedMemoryTool = AthenaHDFStreamTool("EventStreamingTool")
47 * svcMgr.EventSelector.MakeStreamingToolClient = -1
48 * svcMgr.AthenaPoolCnvSvc.InputStreamingTool = AthenaHDFStreamTool("InputStreamingTool")
49 * svcMgr.AthenaPoolCnvSvc.MakeStreamingToolClient = 1
50 * svcMgr.AthenaPoolCnvSvc.StreamingTechnology = 1025
51 *
52 **/
53
54// Mark class as not thread-safe: Initial demonstrator/prototype not used in production workflows
55class ATLAS_NOT_THREAD_SAFE AthenaHDFStreamTool : public extends<::AthAlgTool, IAthenaIPCTool> {
56public:
58 AthenaHDFStreamTool(const std::string& type, const std::string& name, const IInterface* parent);
60 virtual ~AthenaHDFStreamTool();
61
63 StatusCode initialize();
64 StatusCode finalize();
65
66 StatusCode makeServer(int num, const std::string& streamPortSuffix);
67 bool isServer() const;
68 StatusCode makeClient(int num, std::string& streamPortSuffix);
69 bool isClient() const;
70
71 StatusCode putEvent ATLAS_NOT_THREAD_SAFE (long eventNumber, const void* source, std::size_t nbytes, unsigned int status) const;
72 StatusCode getLockedEvent(void** target, unsigned int& status) const;
73 StatusCode lockEvent(long eventNumber) const;
74
75 StatusCode putObject(const void* source, std::size_t nbytes, int num = 0);
76 StatusCode getObject(void** target, std::size_t& nbytes, int num = 0);
77 StatusCode clearObject(const char** tokenString, int& num);
78 StatusCode lockObject(const char* tokenString, int num = 0);
79
80private:
81 H5::H5File* m_file;
82 H5::Group* m_group;
83 mutable std::string m_token;
84 mutable char* m_read_data;
85 mutable std::size_t m_read_size;
86 mutable std::size_t m_read_position;
87 mutable long long unsigned int m_event_iter;
90 mutable std::optional<InputFileIncidentGuard> m_inputFileGuard;
91};
92
93#endif
RAII guard that guarantees a matching end-incident for every begin-incident.
StatusCode lockObject(const char *tokenString, int num=0)
long long unsigned int m_event_iter
StatusCode getObject(void **target, std::size_t &nbytes, int num=0)
AthenaHDFStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Service Constructor.
StatusCode clearObject(const char **tokenString, int &num)
ServiceHandle< IIncidentSvc > m_incidentSvc
StatusCode makeClient(int num, std::string &streamPortSuffix)
StatusCode getLockedEvent(void **target, unsigned int &status) const
StatusCode putObject(const void *source, std::size_t nbytes, int num=0)
StatusCode makeServer(int num, const std::string &streamPortSuffix)
std::optional< InputFileIncidentGuard > m_inputFileGuard
StatusCode lockEvent(long eventNumber) const
StatusCode putEvent ATLAS_NOT_THREAD_SAFE(long eventNumber, const void *source, std::size_t nbytes, unsigned int status) const
HDF5 Traits.
void initialize()