#include <IoSvc.h>
|
| | IoSvc (const std::string &name, ISvcLocator *pSvcLocator) |
| | Constructor with parameters:
|
| virtual | ~IoSvc () |
| | Destructor:
|
| virtual StatusCode | initialize () override |
| | Gaudi Service Implementation.
|
| virtual StatusCode | finalize () override |
| virtual bool | has_fd (Fd fd) const override |
| | test if a given file descriptor fd is known to us
|
| virtual Fd | fd (const std::string &fname) const override |
| | retrieve the file descriptor associated with file fname
|
| virtual const std::string & | fname (Fd fd) const override |
| | retrieve the file fname associated with file descriptor fd
|
| virtual IoType | mode (Fd fd) const override |
| | retrieve the open mode associated with file descriptor fd
|
| virtual Fd | open (const std::string &fname, IoType mode) override |
| | open file fname with open mode mode
|
| virtual StatusCode | close (Fd fd) override |
| | close file fd
|
Definition at line 30 of file IoSvc.h.
◆ Fd
◆ FdMap_t
◆ IoSvc() [1/2]
| IoSvc::IoSvc |
( |
const std::string & | name, |
|
|
ISvcLocator * | pSvcLocator ) |
Constructor with parameters:
Definition at line 31 of file IoSvc.cxx.
32 :
33 base_class( name, pSvcLocator ),
36{
37
38
39
40
41
42}
Fd m_last_fd
last created Fd
FdMap_t m_fds
map of fd->fdinfos
◆ ~IoSvc()
◆ IoSvc() [2/2]
◆ close()
| StatusCode IoSvc::close |
( |
Fd | fd | ) |
|
|
overridevirtual |
close file fd
Definition at line 147 of file IoSvc.cxx.
148{
149 FdMap_t::const_iterator itr =
m_fds.find(
fd);
150 if (itr !=
m_fds.end()) {
152 return StatusCode::SUCCESS;
153 }
154 return StatusCode::FAILURE;
155}
virtual Fd fd(const std::string &fname) const override
retrieve the file descriptor associated with file fname
◆ fd()
| Fd IoSvc::fd |
( |
const std::string & | fname | ) |
const |
|
overridevirtual |
retrieve the file descriptor associated with file fname
- Returns
- -1 if no such fname is known
Definition at line 79 of file IoSvc.cxx.
80{
81 for (FdMap_t::const_iterator
84 itr != iend;
85 ++itr) {
86 if (itr->second.fname ==
fname) {
87 return itr->first;
88 }
89 }
90 return -1;
91}
virtual const std::string & fname(Fd fd) const override
retrieve the file fname associated with file descriptor fd
◆ finalize()
| StatusCode IoSvc::finalize |
( |
| ) |
|
|
overridevirtual |
Definition at line 58 of file IoSvc.cxx.
59{
61
62 return StatusCode::SUCCESS;
63}
◆ fname()
| const std::string & IoSvc::fname |
( |
Fd | fd | ) |
const |
|
overridevirtual |
retrieve the file fname associated with file descriptor fd
- Returns
- empty string if no such fd is known
Definition at line 96 of file IoSvc.cxx.
97{
98 FdMap_t::const_iterator itr =
m_fds.find(
fd);
99 if (itr !=
m_fds.end()) {
100 return itr->second.fname;
101 }
102 static const std::string s_empty = "";
103 return s_empty;
104}
◆ has_fd()
| bool IoSvc::has_fd |
( |
Fd | fd | ) |
const |
|
overridevirtual |
test if a given file descriptor fd is known to us
Definition at line 71 of file IoSvc.cxx.
◆ initialize()
| StatusCode IoSvc::initialize |
( |
| ) |
|
|
overridevirtual |
◆ mode()
retrieve the open mode associated with file descriptor fd
Definition at line 108 of file IoSvc.cxx.
109{
110 FdMap_t::const_iterator itr =
m_fds.find(
fd);
111 if (itr !=
m_fds.end()) {
112 return itr->second.mode;
113 }
115}
◆ open()
| Fd IoSvc::open |
( |
const std::string & | fname, |
|
|
IoType | mode ) |
|
overridevirtual |
open file fname with open mode mode
- Returns
- -1 if not successful
Definition at line 120 of file IoSvc.cxx.
121{
122
125
126 if (
m_last_fd == (std::numeric_limits<Fd>::max()-1)) {
128 return -1;
129 }
132 m_fds.insert(std::make_pair(
fd, infos));
134 }
135
136
139 }
140
141
142 return -1;
143}
virtual IoType mode(Fd fd) const override
retrieve the open mode associated with file descriptor fd
◆ SvcFactory< IoSvc >
◆ m_fds
map of fd->fdinfos
Definition at line 101 of file IoSvc.h.
◆ m_last_fd
The documentation for this class was generated from the following files: