ATLAS Offline Software
Loading...
Searching...
No Matches
IoSvc.h
Go to the documentation of this file.
2
3/*
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5*/
6
7// IoSvc.h
8// Header file for class IoSvc
9// Author: S.Binet<binet@cern.ch>
11#ifndef ATHENASERVICES_IOSVC_H
12#define ATHENASERVICES_IOSVC_H 1
13
14// STL includes
15#include <string>
16#include <unordered_map>
17
18// FrameWork includes
20
21// AthenaKernel
23
24// Forward declaration
25class ISvcLocator;
26template <class TYPE> class SvcFactory;
27
28
29
30class IoSvc
31 : public extends<::AthService, ::IIoSvc>
32{
33 friend class SvcFactory<IoSvc>;
34
36 // Public methods:
38 public:
39 typedef IIoSvc::Fd Fd;
40
42 IoSvc( const std::string& name, ISvcLocator* pSvcLocator );
43
45 virtual ~IoSvc();
46
47 // Assignment operator:
48 //IoSvc &operator=(const IoSvc &alg);
49
51
52 virtual StatusCode initialize() override;
53 virtual StatusCode finalize() override;
55
57 // Const methods:
59
61 virtual bool has_fd(Fd fd) const override;
62
65 virtual Fd fd(const std::string& fname) const override;
66
69 virtual const std::string& fname(Fd fd) const override;
70
72 virtual IoType mode(Fd fd) const override;
73
75 // Non-const methods:
77
80 virtual Fd open(const std::string& fname, IoType mode) override;
81
83 virtual StatusCode close(Fd fd) override;
84
86 // Private data:
88 private:
89
92
93 struct FdInfos {
94 std::string fname;
96 };
97
98 typedef std::unordered_map<Fd, FdInfos> FdMap_t;
99
102
105};
106
107#endif //> !ATHENASERVICES_IOSVC_H
IIoSvc::IoType IoType
Definition IoSvc.cxx:23
IoType
I/O Connection types.
Definition IIoSvc.h:41
int Fd
unix-y file descriptor
Definition IIoSvc.h:38
virtual Fd open(const std::string &fname, IoType mode) override
open file fname with open mode mode
Definition IoSvc.cxx:120
virtual IoType mode(Fd fd) const override
retrieve the open mode associated with file descriptor fd
Definition IoSvc.cxx:108
virtual const std::string & fname(Fd fd) const override
retrieve the file fname associated with file descriptor fd
Definition IoSvc.cxx:96
virtual Fd fd(const std::string &fname) const override
retrieve the file descriptor associated with file fname
Definition IoSvc.cxx:79
virtual StatusCode initialize() override
Gaudi Service Implementation.
Definition IoSvc.cxx:51
IoSvc()
Default constructor:
virtual StatusCode close(Fd fd) override
close file fd
Definition IoSvc.cxx:147
Fd m_last_fd
last created Fd
Definition IoSvc.h:104
IIoSvc::Fd Fd
Definition IoSvc.h:39
virtual StatusCode finalize() override
Definition IoSvc.cxx:58
std::unordered_map< Fd, FdInfos > FdMap_t
Definition IoSvc.h:98
FdMap_t m_fds
map of fd->fdinfos
Definition IoSvc.h:101
IoSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition IoSvc.cxx:31
virtual ~IoSvc()
Destructor:
Definition IoSvc.cxx:46
virtual bool has_fd(Fd fd) const override
test if a given file descriptor fd is known to us
Definition IoSvc.cxx:71
std::string fname
Definition IoSvc.h:94
IIoSvc::IoType mode
Definition IoSvc.h:95