ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Database
AthenaRoot
AthenaRootKernel
AthenaRootKernel
IIoSvc.h
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// IIoSvc.h
8
// Header file for class IIoSvc
9
// Author: S.Binet<binet@cern.ch>
11
#ifndef ATHENAKERNEL_IIOSVC_H
12
#define ATHENAKERNEL_IIOSVC_H 1
13
14
// STL includes
15
#include <string>
16
17
// FrameWork includes
18
#include "GaudiKernel/IService.h"
19
20
// AthenaKernel includes
21
22
27
class
IIoSvc
28
:
virtual
public
::IService
29
{
31
// Public typedef:
33
public
:
35
DeclareInterfaceID
(
IIoSvc
, 1, 0);
36
38
typedef
int
Fd
;
39
41
enum
IoType
{
42
INVALID
= 0,
43
READ
= 1<<1,
44
UPDATE
= 1<<2,
45
CREATE
= 1<<3,
46
RECREATE
= (1<<4)+(1<<3)
47
};
48
49
static
50
const
std::string&
IoTypeName
(
IoType
mode
) {
51
static
std::map<IoType, std::string> s_names;
52
if
(s_names.empty()) {
53
s_names[
INVALID
] =
""
;
54
s_names[
READ
] =
"READ"
;
55
s_names[
UPDATE
] =
"UPDATE"
;
56
s_names[
CREATE
] =
"CREATE"
;
57
s_names[
RECREATE
] =
"RECREATE"
;
58
}
59
return
s_names[
mode
];
60
}
61
62
static
63
IoType
IoTypeFromName
(
const
std::string& name) {
64
static
std::map<std::string, IoType> s_names;
65
if
(s_names.empty()) {
66
s_names[
""
] =
INVALID
;
67
s_names[
"READ"
] =
READ
;
68
s_names[
"UPDATE"
] =
UPDATE
;
69
s_names[
"CREATE"
] =
CREATE
;
70
s_names[
"RECREATE"
] =
RECREATE
;
71
}
72
return
s_names[name];
73
}
74
76
// Public methods:
78
public
:
79
82
virtual
~IIoSvc
();
83
85
// Const methods:
87
89
// Non-const methods:
91
94
virtual
95
Fd
open
(
const
std::string&
fname
,
IoType
mode
) = 0;
96
98
virtual
99
StatusCode
close
(
Fd
fd
) = 0;
100
102
virtual
103
bool
has_fd
(
Fd
fd
)
const
= 0;
104
107
virtual
108
Fd
fd
(
const
std::string&
fname
)
const
= 0;
109
112
virtual
113
const
std::string&
fname
(
Fd
fd
)
const
= 0;
114
116
virtual
117
IoType
mode
(
Fd
fd
)
const
= 0;
118
119
};
120
121
#endif
//> !ATHENAKERNEL_IIOSVC_H
IIoSvc
is a registry of file handles, storing their name and openmode.
Definition
IIoSvc.h:29
IIoSvc::mode
virtual IoType mode(Fd fd) const =0
retrieve the open mode associated with file descriptor fd
IIoSvc::IoType
IoType
I/O Connection types.
Definition
IIoSvc.h:41
IIoSvc::READ
@ READ
Definition
IIoSvc.h:43
IIoSvc::CREATE
@ CREATE
Definition
IIoSvc.h:45
IIoSvc::UPDATE
@ UPDATE
Definition
IIoSvc.h:44
IIoSvc::RECREATE
@ RECREATE
Definition
IIoSvc.h:46
IIoSvc::INVALID
@ INVALID
Definition
IIoSvc.h:42
IIoSvc::close
virtual StatusCode close(Fd fd)=0
close file fd
IIoSvc::Fd
int Fd
unix-y file descriptor
Definition
IIoSvc.h:38
IIoSvc::has_fd
virtual bool has_fd(Fd fd) const =0
test if a given file descriptor fd is known to us
IIoSvc::open
virtual Fd open(const std::string &fname, IoType mode)=0
open file fname with open mode mode
IIoSvc::DeclareInterfaceID
DeclareInterfaceID(IIoSvc, 1, 0)
InterfaceID.
IIoSvc::fd
virtual Fd fd(const std::string &fname) const =0
retrieve the file descriptor associated with file fname
IIoSvc::fname
virtual const std::string & fname(Fd fd) const =0
retrieve the file fname associated with file descriptor fd
IIoSvc::IoTypeName
static const std::string & IoTypeName(IoType mode)
Definition
IIoSvc.h:50
IIoSvc::IoTypeFromName
static IoType IoTypeFromName(const std::string &name)
Definition
IIoSvc.h:63
IIoSvc::~IIoSvc
virtual ~IIoSvc()
Destructor:
Definition
IIoSvc.cxx:17
Generated on
for ATLAS Offline Software by
1.17.0