| The Gaudi Framework v28r2-patches (bc4ad17a)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

IoComponentMgr.h
Go to the documentation of this file.
1 // IoComponentMgr.h
3 // Header file for class IoComponentMgr
4 // Author: S.Binet<binet@cern.ch>
6 #ifndef GAUDIMP_IOCOMPONENTMGR_H
7 #define GAUDIMP_IOCOMPONENTMGR_H 1
8
9 // Python includes
10 #include <Python.h>
11
12 // STL includes
13 #include <string>
14 #include <map>
15 #include <list>
16
17 // FrameWork includes
18 #include "GaudiKernel/Service.h"
19
20 // GaudiKernel
21 #include "GaudiKernel/IIoComponent.h"
22 #include "GaudiKernel/IIoComponentMgr.h"
23 #include "GaudiKernel/IIncidentListener.h"
24
25 // Forward declaration
26 class ISvcLocator;
27
28 class IoComponentMgr: public extends<Service,
29 IIoComponentMgr,
30 IIncidentListener> {
32 // Public methods:
34 public:
35
37 using extends::extends;
38
40 ~IoComponentMgr() override = default;
41
43
44 StatusCode initialize() override;
45 StatusCode finalize() override;
47
48 void handle(const Incident&) override;
49
51 // Const methods:
53
56 bool io_hasitem (IIoComponent* iocomponent) const override;
57
61 bool io_contains (IIoComponent* iocomponent,
62 const std::string& fname) const override;
63
65 // Non-const methods:
67
74 StatusCode io_register (IIoComponent* iocomponent) override;
75
82 StatusCode io_register (IIoComponent* iocomponent,
83 IIoComponentMgr::IoMode::Type iomode,
84 const std::string& fname,
85 const std::string& pfn) override;
86
90 StatusCode io_update (IIoComponent* iocomponent,
91 const std::string& old_fname,
92 const std::string& new_fname) override;
93
97 StatusCode io_update (IIoComponent* iocomponent,
98 const std::string& work_dir) override;
99
100 // VT. new method
103 StatusCode io_update_all (const std::string& work_dir) override;
104
108 StatusCode io_retrieve (IIoComponent* iocomponent,
109 std::string& fname) override;
110
115 StatusCode io_reinitialize () override;
116
121 StatusCode io_finalize () override;
122
124 // Private data:
126 private:
127
128 struct IoComponentEntry {
129 std::string m_oldfname;
130 std::string m_oldabspath; // VT. store absolute path
131 std::string m_newfname;
132 IIoComponentMgr::IoMode::Type m_iomode;
133
134 IoComponentEntry():m_oldfname(""),m_oldabspath(""),m_newfname(""), // VT. changes
135 m_iomode(IIoComponentMgr::IoMode::INVALID) {}
136 IoComponentEntry(const std::string& f, const std::string& p, // VT. changes
137 const IIoComponentMgr::IoMode::Type& t)
138 : m_oldfname(f), m_oldabspath(p),m_newfname(""), m_iomode(t){} // VT. changes
139 IoComponentEntry(const IoComponentEntry& rhs):m_oldfname(rhs.m_oldfname),
140 m_oldabspath(rhs.m_oldabspath), // VT. changes
141 m_newfname(rhs.m_newfname),
142 m_iomode(rhs.m_iomode){}
143 bool operator < (IoComponentEntry const &rhs) const {
144 if (m_oldfname == rhs.m_oldfname) {
145 return (m_iomode < rhs.m_iomode);
146 } else {
147 return (m_oldfname < rhs.m_oldfname);
148 }
149 }
150
151 friend std::ostream& operator<< ( std::ostream& os, const IoComponentEntry& c) {
152 os << "old: \"" << c.m_oldfname
153 << "\" absolute path: \"" << c.m_oldabspath
154 << "\" new: \"" << c.m_newfname
155 << "\" m: " << ( (c.m_iomode == IIoComponentMgr::IoMode::READ) ?
156 "R" : "W" );
157 return os;
158 }
159
160 };
161
162
164 IoComponentMgr() = delete;
165
166 typedef std::map<std::string, IIoComponent*> IoRegistry_t;
168 IoRegistry_t m_ioregistry;
169
170 typedef std::list<IIoComponent*> IoStack_t;
172 IoStack_t m_iostack;
173
174
175 // This is the registry
176 typedef std::multimap<IIoComponent*, IoComponentEntry > IoDict_t;
177 typedef IoDict_t::const_iterator iodITR;
178
179 IoDict_t m_cdict;
180
182 std::string m_dict_location;
183
184 bool findComp(IIoComponent*, const std::string&, iodITR& ) const;
185 bool findComp(IIoComponent*, std::pair<iodITR,iodITR>& ) const;
186 bool findComp(const std::string&, std::pair<iodITR,iodITR>& ) const;
187
188 std::string list() const;
189
190
191 };
192
193
194 #endif //> !GAUDIMP_IOCOMPONENTMGR_H
IoComponentMgr::finalize
StatusCode finalize() override
Definition: IoComponentMgr.cpp:73
IoComponentMgr
Definition: IoComponentMgr.h:28
IIoComponent
Definition: IIoComponent.h:16
IIoComponentMgr
Definition: IIoComponentMgr.h:22
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudirun.c
c
Definition: gaudirun.py:391
IoComponentMgr::IoComponentEntry
Definition: IoComponentMgr.h:128
IoComponentMgr::io_contains
bool io_contains(IIoComponent *iocomponent, const std::string &fname) const override
: check if the registry contains a given IIoComponent and that component had
Definition: IoComponentMgr.cpp:100
Io::INVALID
Definition: IFileMgr.h:36
IoComponentMgr::IoComponentEntry::m_oldabspath
std::string m_oldabspath
Definition: IoComponentMgr.h:130
IoComponentMgr::iodITR
IoDict_t::const_iterator iodITR
Definition: IoComponentMgr.h:177
IoComponentMgr::IoRegistry_t
std::map< std::string, IIoComponent * > IoRegistry_t
Definition: IoComponentMgr.h:166
IoComponentMgr::m_ioregistry
IoRegistry_t m_ioregistry
Registry of IIoComponents.
Definition: IoComponentMgr.h:168
IoComponentMgr::IoComponentEntry::operator<
bool operator<(IoComponentEntry const &rhs) const
Definition: IoComponentMgr.h:143
std::map< std::string, IIoComponent * >
IoComponentMgr::IoStack_t
std::list< IIoComponent * > IoStack_t
Definition: IoComponentMgr.h:170
IoComponentMgr::handle
void handle(const Incident &) override
Definition: IoComponentMgr.cpp:503
std::string
STL class.
IoComponentMgr::IoComponentMgr
IoComponentMgr()=delete
Default constructor:
IoComponentMgr::list
std::string list() const
Definition: IoComponentMgr.cpp:488
Service.h
IoComponentMgr::IoDict_t
std::multimap< IIoComponent *, IoComponentEntry > IoDict_t
Definition: IoComponentMgr.h:176
IIoComponentMgr::IoMode::Type
Type
Definition: IIoComponentMgr.h:32
IoComponentMgr::initialize
StatusCode initialize() override
Gaudi Service Implementation.
Definition: IoComponentMgr.cpp:49
IoComponentMgr::findComp
bool findComp(IIoComponent *, const std::string &, iodITR &) const
Definition: IoComponentMgr.cpp:448
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry(const std::string &f, const std::string &p, const IIoComponentMgr::IoMode::Type &t)
Definition: IoComponentMgr.h:136
IIoComponentMgr.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IIoComponent.h
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry()
Definition: IoComponentMgr.h:134
IoComponentMgr::io_register
StatusCode io_register(IIoComponent *iocomponent) override
: allow a IIoComponent to register itself with this manager so appropriate actions can be taken when ...
Definition: IoComponentMgr.cpp:141
IoComponentMgr::io_update
StatusCode io_update(IIoComponent *iocomponent, const std::string &old_fname, const std::string &new_fname) override
: allow a IIoComponent to update the contents of the registry with a new file name ...
Definition: IoComponentMgr.cpp:312
std::list< IIoComponent * >
IoComponentMgr::IoComponentEntry::m_oldfname
std::string m_oldfname
Definition: IoComponentMgr.h:129
std::multimap< IIoComponent *, IoComponentEntry >
std::pair
IoComponentMgr::m_dict_location
std::string m_dict_location
location of the python dictionary
Definition: IoComponentMgr.h:182
IoComponentMgr::IoComponentEntry::m_iomode
IIoComponentMgr::IoMode::Type m_iomode
Definition: IoComponentMgr.h:132
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
IoComponentMgr::io_update_all
StatusCode io_update_all(const std::string &work_dir) override
: Update all IIoComponents with a new work directory
Definition: IoComponentMgr.cpp:395
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry(const IoComponentEntry &rhs)
Definition: IoComponentMgr.h:139
IIncidentListener.h
IoComponentMgr::io_retrieve
StatusCode io_retrieve(IIoComponent *iocomponent, std::string &fname) override
: retrieve the new filename for a given IIoComponent and
Definition: IoComponentMgr.cpp:232
IoComponentMgr::io_finalize
StatusCode io_finalize() override
: finalize the I/O subsystem.
Definition: IoComponentMgr.cpp:418
IoComponentMgr::io_reinitialize
StatusCode io_reinitialize() override
: reinitialize the I/O subsystem.
Definition: IoComponentMgr.cpp:277
IoComponentMgr::~IoComponentMgr
~IoComponentMgr() override=default
Destructor:
IoComponentMgr::m_iostack
IoStack_t m_iostack
Stack of IIoComponents to properly handle order of registration.
Definition: IoComponentMgr.h:172
IoComponentMgr::IoComponentEntry::m_newfname
std::string m_newfname
Definition: IoComponentMgr.h:131
std::ostream
STL class.
IIoComponentMgr::IoMode::READ
Definition: IIoComponentMgr.h:33
IoComponentMgr::IoComponentEntry::operator<<
friend std::ostream & operator<<(std::ostream &os, const IoComponentEntry &c)
Definition: IoComponentMgr.h:151
IoComponentMgr::io_hasitem
bool io_hasitem(IIoComponent *iocomponent) const override
: check if the registry contains a given IIoComponent
Definition: IoComponentMgr.cpp:84
IoComponentMgr::m_cdict
IoDict_t m_cdict
Definition: IoComponentMgr.h:179