| The Gaudi Framework v27r1

- 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
36 // Copy constructor:
37
39 IoComponentMgr( const std::string& name, ISvcLocator* pSvcLocator );
40
42 virtual ~IoComponentMgr();
43
44 // Assignment operator:
45 //IoComponentMgr &operator=(const IoComponentMgr &alg);
46
48
49 virtual StatusCode initialize();
50 virtual StatusCode finalize();
51
53
54 void handle(const Incident&);
55
57 // Const methods:
59
62 virtual
63 bool io_hasitem (IIoComponent* iocomponent) const;
64
68 virtual
69 bool io_contains (IIoComponent* iocomponent,
70 const std::string& fname) const;
71
73 // Non-const methods:
75
82 virtual
83 StatusCode io_register (IIoComponent* iocomponent);
84
91 virtual
92 StatusCode io_register (IIoComponent* iocomponent,
93 IIoComponentMgr::IoMode::Type iomode,
94 const std::string& fname,
95 const std::string& pfn);
96
100 virtual
101 StatusCode io_update (IIoComponent* iocomponent,
102 const std::string& old_fname,
103 const std::string& new_fname);
104
108 virtual
109 StatusCode io_update (IIoComponent* iocomponent,
110 const std::string& work_dir);
111
112 // VT. new method
115 virtual
116 StatusCode io_update_all (const std::string& work_dir);
117
121 virtual
122 StatusCode io_retrieve (IIoComponent* iocomponent,
123 std::string& fname);
124
129 virtual
130 StatusCode io_reinitialize ();
131
136 virtual
137 StatusCode io_finalize ();
138
140 // Private data:
142 private:
143
144 struct IoComponentEntry {
145 std::string m_oldfname;
146 std::string m_oldabspath; // VT. store absolute path
147 std::string m_newfname;
148 IIoComponentMgr::IoMode::Type m_iomode;
149
150 IoComponentEntry():m_oldfname(""),m_oldabspath(""),m_newfname(""), // VT. changes
151 m_iomode(IIoComponentMgr::IoMode::INVALID) {}
152 IoComponentEntry(const std::string& f, const std::string& p, // VT. changes
153 const IIoComponentMgr::IoMode::Type& t)
154 : m_oldfname(f), m_oldabspath(p),m_newfname(""), m_iomode(t){} // VT. changes
155 IoComponentEntry(const IoComponentEntry& rhs):m_oldfname(rhs.m_oldfname),
156 m_oldabspath(rhs.m_oldabspath), // VT. changes
157 m_newfname(rhs.m_newfname),
158 m_iomode(rhs.m_iomode){}
159 bool operator < (IoComponentEntry const &rhs) const {
160 if (m_oldfname == rhs.m_oldfname) {
161 return (m_iomode < rhs.m_iomode);
162 } else {
163 return (m_oldfname < rhs.m_oldfname);
164 }
165 }
166
167 friend std::ostream& operator<< ( std::ostream& os, const IoComponentEntry& c) {
168 os << "old: \"" << c.m_oldfname
169 << "\" absolute path: \"" << c.m_oldabspath
170 << "\" new: \"" << c.m_newfname
171 << "\" m: " << ( (c.m_iomode == IIoComponentMgr::IoMode::READ) ?
172 "R" : "W" );
173 return os;
174 }
175
176 };
177
178
179
181 IoComponentMgr();
182
183 mutable MsgStream m_log;
184
185 typedef std::map<std::string, IIoComponent*> IoRegistry_t;
187 IoRegistry_t m_ioregistry;
188
189 typedef std::list<IIoComponent*> IoStack_t;
191 IoStack_t m_iostack;
192
193
194 // This is the registry
195 typedef std::multimap<IIoComponent*, IoComponentEntry > IoDict_t;
196 typedef IoDict_t::const_iterator iodITR;
197
198 IoDict_t m_cdict;
199
201 std::string m_dict_location;
202
203 bool findComp(IIoComponent*, const std::string&, iodITR& ) const;
204 bool findComp(IIoComponent*, std::pair<iodITR,iodITR>& ) const;
205 bool findComp(const std::string&, std::pair<iodITR,iodITR>& ) const;
206
207 std::string list() const;
208
209
210 };
211
212
213 #endif //> !GAUDIMP_IOCOMPONENTMGR_H
IoComponentMgr
Definition: IoComponentMgr.h:28
IIoComponent
Definition: IIoComponent.h:16
IIoComponentMgr
Definition: IIoComponentMgr.h:22
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
IoComponentMgr::io_contains
virtual bool io_contains(IIoComponent *iocomponent, const std::string &fname) const
: check if the registry contains a given IIoComponent and that component had
Definition: IoComponentMgr.cpp:129
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IoComponentMgr::IoComponentEntry
Definition: IoComponentMgr.h:144
Io::INVALID
Definition: IFileMgr.h:36
IoComponentMgr::IoComponentEntry::m_oldabspath
std::string m_oldabspath
Definition: IoComponentMgr.h:146
gaudirun.c
tuple c
Definition: gaudirun.py:391
IoComponentMgr::iodITR
IoDict_t::const_iterator iodITR
Definition: IoComponentMgr.h:196
IoComponentMgr::IoRegistry_t
std::map< std::string, IIoComponent * > IoRegistry_t
Definition: IoComponentMgr.h:185
IoComponentMgr::m_ioregistry
IoRegistry_t m_ioregistry
Registry of IIoComponents.
Definition: IoComponentMgr.h:187
IoComponentMgr::IoComponentEntry::operator<
bool operator<(IoComponentEntry const &rhs) const
Definition: IoComponentMgr.h:159
IoComponentMgr::handle
void handle(const Incident &)
Definition: IoComponentMgr.cpp:535
IoComponentMgr::m_log
MsgStream m_log
Definition: IoComponentMgr.h:183
std::map< std::string, IIoComponent * >
IoComponentMgr::IoStack_t
std::list< IIoComponent * > IoStack_t
Definition: IoComponentMgr.h:189
IoComponentMgr::io_update
virtual StatusCode io_update(IIoComponent *iocomponent, const std::string &old_fname, const std::string &new_fname)
: allow a IIoComponent to update the contents of the registry with a new file name ...
Definition: IoComponentMgr.cpp:342
std::string
STL class.
IoComponentMgr::list
std::string list() const
Definition: IoComponentMgr.cpp:520
Service.h
IoComponentMgr::IoDict_t
std::multimap< IIoComponent *, IoComponentEntry > IoDict_t
Definition: IoComponentMgr.h:195
IIoComponentMgr::IoMode::Type
Type
Definition: IIoComponentMgr.h:32
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
IoComponentMgr::findComp
bool findComp(IIoComponent *, const std::string &, iodITR &) const
Definition: IoComponentMgr.cpp:480
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry(const std::string &f, const std::string &p, const IIoComponentMgr::IoMode::Type &t)
Definition: IoComponentMgr.h:152
IIoComponentMgr.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IoComponentMgr::io_reinitialize
virtual StatusCode io_reinitialize()
: reinitialize the I/O subsystem.
Definition: IoComponentMgr.cpp:306
IoComponentMgr::io_finalize
virtual StatusCode io_finalize()
: finalize the I/O subsystem.
Definition: IoComponentMgr.cpp:448
IIoComponent.h
IoComponentMgr::IoComponentMgr
IoComponentMgr()
Default constructor:
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry()
Definition: IoComponentMgr.h:150
std::list< IIoComponent * >
IoComponentMgr::initialize
virtual StatusCode initialize()
Gaudi Service Implementation.
Definition: IoComponentMgr.cpp:77
IoComponentMgr::IoComponentEntry::m_oldfname
std::string m_oldfname
Definition: IoComponentMgr.h:145
std::multimap< IIoComponent *, IoComponentEntry >
std::pair
IoComponentMgr::m_dict_location
std::string m_dict_location
location of the python dictionary
Definition: IoComponentMgr.h:201
IoComponentMgr::IoComponentEntry::m_iomode
IIoComponentMgr::IoMode::Type m_iomode
Definition: IoComponentMgr.h:148
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
IoComponentMgr::io_hasitem
virtual bool io_hasitem(IIoComponent *iocomponent) const
: check if the registry contains a given IIoComponent
Definition: IoComponentMgr.cpp:113
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry(const IoComponentEntry &rhs)
Definition: IoComponentMgr.h:155
IIncidentListener.h
IoComponentMgr::~IoComponentMgr
virtual ~IoComponentMgr()
Destructor:
Definition: IoComponentMgr.cpp:70
IoComponentMgr::io_retrieve
virtual StatusCode io_retrieve(IIoComponent *iocomponent, std::string &fname)
: retrieve the new filename for a given IIoComponent and
Definition: IoComponentMgr.cpp:261
IoComponentMgr::m_iostack
IoStack_t m_iostack
Stack of IIoComponents to properly handle order of registration.
Definition: IoComponentMgr.h:191
IoComponentMgr::io_register
virtual StatusCode io_register(IIoComponent *iocomponent)
: allow a IIoComponent to register itself with this manager so appropriate actions can be taken when ...
Definition: IoComponentMgr.cpp:170
IoComponentMgr::finalize
virtual StatusCode finalize()
Definition: IoComponentMgr.cpp:102
IoComponentMgr::IoComponentEntry::m_newfname
std::string m_newfname
Definition: IoComponentMgr.h:147
std::ostream
STL class.
IIoComponentMgr::IoMode::READ
Definition: IIoComponentMgr.h:33
IoComponentMgr::io_update_all
virtual StatusCode io_update_all(const std::string &work_dir)
: Update all IIoComponents with a new work directory
Definition: IoComponentMgr.cpp:425
IoComponentMgr::IoComponentEntry::operator<<
friend std::ostream & operator<<(std::ostream &os, const IoComponentEntry &c)
Definition: IoComponentMgr.h:167
IoComponentMgr::m_cdict
IoDict_t m_cdict
Definition: IoComponentMgr.h:198