| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IoComponentMgr.h
Go to the documentation of this file.
1
2 // 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 extends2<Service, IIoComponentMgr,
29 IIncidentListener> {
31 // Public methods:
33 public:
34
35 // Copy constructor:
36
38 IoComponentMgr( const std::string& name, ISvcLocator* pSvcLocator );
39
41 virtual ~IoComponentMgr();
42
43 // Assignment operator:
44 //IoComponentMgr &operator=(const IoComponentMgr &alg);
45
47
48 virtual StatusCode initialize();
49 virtual StatusCode finalize();
50
52
53 void handle(const Incident&);
54
56 // Const methods:
58
61 virtual
62 bool io_hasitem (IIoComponent* iocomponent) const;
63
67 virtual
68 bool io_contains (IIoComponent* iocomponent,
69 const std::string& fname) const;
70
72 // Non-const methods:
74
81 virtual
82 StatusCode io_register (IIoComponent* iocomponent);
83
90 virtual
91 StatusCode io_register (IIoComponent* iocomponent,
92 IIoComponentMgr::IoMode::Type iomode,
93 const std::string& fname,
94 const std::string& pfn);
95
99 virtual
100 StatusCode io_update (IIoComponent* iocomponent,
101 const std::string& old_fname,
102 const std::string& new_fname);
103
107 virtual
108 StatusCode io_update (IIoComponent* iocomponent,
109 const std::string& work_dir);
110
111 // VT. new method
114 virtual
115 StatusCode io_update_all (const std::string& work_dir);
116
120 virtual
121 StatusCode io_retrieve (IIoComponent* iocomponent,
122 std::string& fname);
123
128 virtual
129 StatusCode io_reinitialize ();
130
135 virtual
136 StatusCode io_finalize ();
137
139 // Private data:
141 private:
142
143 struct IoComponentEntry {
144 std::string m_oldfname;
145 std::string m_oldabspath; // VT. store absolute path
146 std::string m_newfname;
147 IIoComponentMgr::IoMode::Type m_iomode;
148
149 IoComponentEntry():m_oldfname(""),m_oldabspath(""),m_newfname(""), // VT. changes
150 m_iomode(IIoComponentMgr::IoMode::INVALID) {}
151 IoComponentEntry(const std::string& f, const std::string& p, // VT. changes
152 const IIoComponentMgr::IoMode::Type& t)
153 : m_oldfname(f), m_oldabspath(p),m_newfname(""), m_iomode(t){} // VT. changes
154 IoComponentEntry(const IoComponentEntry& rhs):m_oldfname(rhs.m_oldfname),
155 m_oldabspath(rhs.m_oldabspath), // VT. changes
156 m_newfname(rhs.m_newfname),
157 m_iomode(rhs.m_iomode){}
158 bool operator < (IoComponentEntry const &rhs) const {
159 if (m_oldfname == rhs.m_oldfname) {
160 return (m_iomode < rhs.m_iomode);
161 } else {
162 return (m_oldfname < rhs.m_oldfname);
163 }
164 }
165
166 friend std::ostream& operator<< ( std::ostream& os, const IoComponentEntry& c) {
167 os << "old: \"" << c.m_oldfname
168 << "\" absolute path: \"" << c.m_oldabspath
169 << "\" new: \"" << c.m_newfname
170 << "\" m: " << ( (c.m_iomode == IIoComponentMgr::IoMode::READ) ?
171 "R" : "W" );
172 return os;
173 }
174
175 };
176
177
178
180 IoComponentMgr();
181
182 mutable MsgStream m_log;
183
184 typedef std::map<std::string, IIoComponent*> IoRegistry_t;
186 IoRegistry_t m_ioregistry;
187
188 typedef std::list<IIoComponent*> IoStack_t;
190 IoStack_t m_iostack;
191
192
193 // This is the registry
194 typedef std::multimap<IIoComponent*, IoComponentEntry > IoDict_t;
195 typedef IoDict_t::const_iterator iodITR;
196
197 IoDict_t m_cdict;
198
200 std::string m_dict_location;
201
202 bool findComp(IIoComponent*, const std::string&, iodITR& ) const;
203 bool findComp(IIoComponent*, std::pair<iodITR,iodITR>& ) const;
204 bool findComp(const std::string&, std::pair<iodITR,iodITR>& ) const;
205
206 std::string list() const;
207
208
209 };
210
211
212 #endif //> !GAUDIMP_IOCOMPONENTMGR_H