ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaHDFStreamTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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"
16
17#include <string>
18
19// Forward declarations.
20class IIncidentSvc;
21
22namespace H5 {
23 class H5File;
24 class Group;
25}
26
30/* To use this tool to
31 * write data to HDF5 add the following jobOption fragment:
32 *
33 * from AthenaCommon.AppMgr import ServiceMgr as svcMgr
34 * import AthenaPoolCnvSvc.AthenaPool
35 * from AthenaIPCTools.AthenaIPCToolsConf import AthenaHDFStreamTool
36 * svcMgr.AthenaPoolCnvSvc.OutputStreamingTool += [ AthenaHDFStreamTool("OutputStreamingTool") ]
37 * svcMgr.AthenaPoolCnvSvc.MakeStreamingToolClient = 1
38 * svcMgr.AthenaPoolCnvSvc.ParallelCompression=False
39 *
40 * To read it back use:
41 * from AthenaCommon.AppMgr import ServiceMgr as svcMgr
42 * import AthenaPoolCnvSvc.ReadAthenaPool
43 * from AthenaIPCTools.AthenaIPCToolsConf import AthenaHDFStreamTool
44 * svcMgr.EventSelector.SharedMemoryTool = AthenaHDFStreamTool("EventStreamingTool")
45 * svcMgr.EventSelector.MakeStreamingToolClient = -1
46 * svcMgr.AthenaPoolCnvSvc.InputStreamingTool = AthenaHDFStreamTool("InputStreamingTool")
47 * svcMgr.AthenaPoolCnvSvc.MakeStreamingToolClient = 1
48 * svcMgr.AthenaPoolCnvSvc.StreamingTechnology = 1025
49 *
50 **/
51
52// Mark class as not thread-safe: Initial demonstrator/prototype not used in production workflows
53class ATLAS_NOT_THREAD_SAFE AthenaHDFStreamTool : public extends<::AthAlgTool, IAthenaIPCTool> {
54public:
56 AthenaHDFStreamTool(const std::string& type, const std::string& name, const IInterface* parent);
58 virtual ~AthenaHDFStreamTool();
59
61 StatusCode initialize();
62 StatusCode finalize();
63
64 StatusCode makeServer(int num, const std::string& streamPortSuffix);
65 bool isServer() const;
66 StatusCode makeClient(int num, std::string& streamPortSuffix);
67 bool isClient() const;
68
69 StatusCode putEvent ATLAS_NOT_THREAD_SAFE (long eventNumber, const void* source, std::size_t nbytes, unsigned int status) const;
70 StatusCode getLockedEvent(void** target, unsigned int& status) const;
71 StatusCode lockEvent(long eventNumber) const;
72
73 StatusCode putObject(const void* source, std::size_t nbytes, int num = 0);
74 StatusCode getObject(void** target, std::size_t& nbytes, int num = 0);
75 StatusCode clearObject(const char** tokenString, int& num);
76 StatusCode lockObject(const char* tokenString, int num = 0);
77
78private:
79 H5::H5File* m_file;
80 H5::Group* m_group;
81 mutable std::string m_token;
82 mutable char* m_read_data;
83 mutable std::size_t m_read_size;
84 mutable std::size_t m_read_position;
85 mutable long long unsigned int m_event_iter;
88};
89
90#endif
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)
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()