| The Gaudi Framework v32r1 (f65d50dc)

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 <list>
14 #include <map>
15 #include <string>
16 #include <vector>
17
18 // FrameWork includes
19 #include "GaudiKernel/Service.h"
20
21 // GaudiKernel
22 #include "GaudiKernel/IIncidentListener.h"
23 #include "GaudiKernel/IIoComponent.h"
24 #include "GaudiKernel/IIoComponentMgr.h"
25
26 // Forward declaration
27 class ISvcLocator;
28
29 class IoComponentMgr : public extends<Service, IIoComponentMgr, IIncidentListener> {
31 // Public methods:
33 public:
35 using extends::extends;
36
38
39 StatusCode initialize() override;
40 StatusCode finalize() override;
42
43 void handle( const Incident& ) override;
44
46 // Const methods:
48
51 bool io_hasitem( IIoComponent* iocomponent ) const override;
52
56 bool io_contains( IIoComponent* iocomponent, const std::string& fname ) const override;
57
59 // Non-const methods:
61
68 StatusCode io_register( IIoComponent* iocomponent ) override;
69
76 StatusCode io_register( IIoComponent* iocomponent, IIoComponentMgr::IoMode::Type iomode, const std::string& fname,
77 const std::string& pfn ) override;
78
82 StatusCode io_update( IIoComponent* iocomponent, const std::string& old_fname,
83 const std::string& new_fname ) override;
84
88 StatusCode io_update( IIoComponent* iocomponent, const std::string& work_dir ) override;
89
92 StatusCode io_update_all( const std::string& work_dir ) override;
93
96 std::vector<std::string> io_retrieve( IIoComponent* iocomponent ) override;
97
101 StatusCode io_retrieve( IIoComponent* iocomponent, std::string& fname ) override;
102
107 StatusCode io_reinitialize() override;
108
113 StatusCode io_finalize() override;
114
116 // Private data:
118 private:
119 struct IoComponentEntry {
120 std::string m_oldfname;
121 std::string m_oldabspath;
122 std::string m_newfname;
123 IIoComponentMgr::IoMode::Type m_iomode;
124
125 IoComponentEntry()
126 : m_oldfname( "" ), m_oldabspath( "" ), m_newfname( "" ), m_iomode( IIoComponentMgr::IoMode::INVALID ) {}
127 IoComponentEntry( const std::string& f, const std::string& p, const IIoComponentMgr::IoMode::Type& t )
128 : m_oldfname( f ), m_oldabspath( p ), m_newfname( "" ), m_iomode( t ) {}
129 IoComponentEntry( const IoComponentEntry& rhs )
130 : m_oldfname( rhs.m_oldfname )
131 , m_oldabspath( rhs.m_oldabspath )
132 , m_newfname( rhs.m_newfname )
133 , m_iomode( rhs.m_iomode ) {}
134 bool operator<( IoComponentEntry const& rhs ) const {
135 if ( m_oldfname == rhs.m_oldfname ) {
136 return ( m_iomode < rhs.m_iomode );
137 } else {
138 return ( m_oldfname < rhs.m_oldfname );
139 }
140 }
141
142 friend std::ostream& operator<<( std::ostream& os, const IoComponentEntry& c ) {
143 os << "old: \"" << c.m_oldfname << "\" absolute path: \"" << c.m_oldabspath << "\" new: \"" << c.m_newfname
144 << "\" m: " << ( ( c.m_iomode == IIoComponentMgr::IoMode::READ ) ? "R" : "W" );
145 return os;
146 }
147 };
148
150 IoComponentMgr() = delete;
151
152 typedef std::map<std::string, IIoComponent*> IoRegistry_t;
154 IoRegistry_t m_ioregistry;
155
156 typedef std::list<IIoComponent*> IoStack_t;
158 IoStack_t m_iostack;
159
160 // This is the registry
161 typedef std::multimap<IIoComponent*, IoComponentEntry> IoDict_t;
162 typedef IoDict_t::const_iterator iodITR;
163
164 IoDict_t m_cdict;
165
167 std::string m_dict_location;
168
170 Gaudi::Property<std::vector<std::string>> m_directio_patterns{this,
171 "DirectIOPatterns",
172 {
173 "://",
174 },
175 "Search patterns for direct I/O input names"};
176
177 bool findComp( IIoComponent*, const std::string&, iodITR& ) const;
178 bool findComp( IIoComponent*, std::pair<iodITR, iodITR>& ) const;
179 bool findComp( const std::string&, std::pair<iodITR, iodITR>& ) const;
180
181 std::string list() const;
182 };
183
184 #endif //> !GAUDIMP_IOCOMPONENTMGR_H
IoComponentMgr::finalize
StatusCode finalize() override
Definition: IoComponentMgr.cpp:76
IoComponentMgr
Definition: IoComponentMgr.h:29
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:487
IoComponentMgr::io_hasitem
bool io_hasitem(IIoComponent *iocomponent) const override
: check if the registry contains a given IIoComponent
Definition: IoComponentMgr.cpp:86
IoComponentMgr::IoComponentEntry
Definition: IoComponentMgr.h:119
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
Io::INVALID
Definition: IFileMgr.h:37
IoComponentMgr::IoComponentEntry::m_oldabspath
std::string m_oldabspath
Definition: IoComponentMgr.h:121
IoComponentMgr::findComp
bool findComp(IIoComponent *, const std::string &, iodITR &) const
Definition: IoComponentMgr.cpp:398
IoComponentMgr::io_retrieve
std::vector< std::string > io_retrieve(IIoComponent *iocomponent) override
: retrieve all registered filenames for a given IIoComponent
Definition: IoComponentMgr.cpp:207
IoComponentMgr::iodITR
IoDict_t::const_iterator iodITR
Definition: IoComponentMgr.h:162
IoComponentMgr::IoRegistry_t
std::map< std::string, IIoComponent * > IoRegistry_t
Definition: IoComponentMgr.h:152
IoComponentMgr::m_ioregistry
IoRegistry_t m_ioregistry
Registry of IIoComponents.
Definition: IoComponentMgr.h:154
std::map< std::string, IIoComponent * >
IoComponentMgr::IoStack_t
std::list< IIoComponent * > IoStack_t
Definition: IoComponentMgr.h:156
IoComponentMgr::handle
void handle(const Incident &) override
Definition: IoComponentMgr.cpp:441
std::string
STL class.
IoComponentMgr::IoComponentMgr
IoComponentMgr()=delete
Default constructor:
Service.h
IIoComponentMgr::IoMode::Type
Type
Definition: IIoComponentMgr.h:31
IoComponentMgr::initialize
StatusCode initialize() override
Gaudi Service Implementation.
Definition: IoComponentMgr.cpp:53
IoComponentMgr::IoDict_t
std::multimap< IIoComponent *, IoComponentEntry > IoDict_t
Definition: IoComponentMgr.h:161
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry(const std::string &f, const std::string &p, const IIoComponentMgr::IoMode::Type &t)
Definition: IoComponentMgr.h:127
IIoComponentMgr.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
IIoComponent.h
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry()
Definition: IoComponentMgr.h:125
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:134
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:291
std::list< IIoComponent * >
IoComponentMgr::IoComponentEntry::m_oldfname
std::string m_oldfname
Definition: IoComponentMgr.h:120
std::multimap< IIoComponent *, IoComponentEntry >
std::pair
IoComponentMgr::list
std::string list() const
Definition: IoComponentMgr.cpp:429
std::vector< std::string >
IoComponentMgr::m_dict_location
std::string m_dict_location
location of the python dictionary
Definition: IoComponentMgr.h:167
IoComponentMgr::IoComponentEntry::m_iomode
IIoComponentMgr::IoMode::Type m_iomode
Definition: IoComponentMgr.h:123
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:357
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
IoComponentMgr::m_directio_patterns
Gaudi::Property< std::vector< std::string > > m_directio_patterns
search patterns for special file names (direct I/O protocols)
Definition: IoComponentMgr.h:170
IoComponentMgr::IoComponentEntry::operator<
bool operator<(IoComponentEntry const &rhs) const
Definition: IoComponentMgr.h:134
IoComponentMgr::IoComponentEntry::IoComponentEntry
IoComponentEntry(const IoComponentEntry &rhs)
Definition: IoComponentMgr.h:129
IIncidentListener.h
IoComponentMgr::io_finalize
StatusCode io_finalize() override
: finalize the I/O subsystem.
Definition: IoComponentMgr.cpp:375
IoComponentMgr::io_reinitialize
StatusCode io_reinitialize() override
: reinitialize the I/O subsystem.
Definition: IoComponentMgr.cpp:261
IoComponentMgr::m_iostack
IoStack_t m_iostack
Stack of IIoComponents to properly handle order of registration.
Definition: IoComponentMgr.h:158
IoComponentMgr::IoComponentEntry::m_newfname
std::string m_newfname
Definition: IoComponentMgr.h:122
std::ostream
STL class.
IIoComponentMgr::IoMode::READ
Definition: IIoComponentMgr.h:31
IoComponentMgr::IoComponentEntry::operator<<
friend std::ostream & operator<<(std::ostream &os, const IoComponentEntry &c)
Definition: IoComponentMgr.h:142
IoComponentMgr::m_cdict
IoDict_t m_cdict
Definition: IoComponentMgr.h:164
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:99