| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

IIODataManager.h
Go to the documentation of this file.
1 #ifndef GAUDIUTILS_IIODATAMANAGER_H
2 #define GAUDIUTILS_IIODATAMANAGER_H
3
4 // Framework include files
5 #include "GaudiKernel/IInterface.h"
6
7 // C++ include files
8 #include <string>
9 #include <vector>
10
11 /*
12 * LHCb namespace declaration
13 */
14 namespace Gaudi
15 {
16
25 class GAUDI_API IDataConnection
26 {
27 protected:
29 std::string m_name;
31 std::string m_fid;
33 std::string m_pfn;
35 int m_age = 0;
37 const IInterface* m_owner = nullptr;
38
39 public:
41 enum IoType { READ = 1 << 1, UPDATE = 1 << 2, CREATE = 1 << 3, RECREATE = ( 1 << 4 ) + ( 1 << 3 ) };
43 enum IoStatus { BAD_DATA_CONNECTION = 4 };
44
45 public:
47 IDataConnection( const IInterface* own, std::string nam ) : m_name( std::move( nam ) ), m_owner( own ) {}
49 virtual ~IDataConnection() = default;
51 const std::string& name() const { return m_name; }
53 void setFID( std::string fid ) { m_fid = std::move( fid ); }
55 const std::string& fid() const { return m_fid; }
57 const std::string& pfn() const { return m_pfn; }
59 void setPFN( std::string fn ) { m_pfn = std::move( fn ); }
61 int ageFile() { return ++m_age; }
63 void resetAge() { m_age = 0; }
65 int age() const { return m_age; }
67 const IInterface* owner() const { return m_owner; }
69 virtual StatusCode connectRead() = 0;
71 virtual StatusCode connectWrite( IoType type ) = 0;
73 virtual StatusCode disconnect() = 0;
75 virtual bool isConnected() const = 0;
77 virtual StatusCode read( void* const data, size_t len ) = 0;
79 virtual StatusCode write( const void* data, int len ) = 0;
81 virtual long long int seek( long long int where, int origin ) = 0;
82 };
83
90 class GAUDI_API IIODataManager : virtual public IInterface
91 {
92 public:
94 DeclareInterfaceID( IIODataManager, 2, 0 );
95
97 typedef IDataConnection Connection;
98 typedef std::vector<Connection*> Connections;
99 typedef Connection::IoType IoType;
100 enum FileType { UNKNOWN = 1, PFN, LFN, FID };
101
103 virtual StatusCode connectRead( bool keep_open, IDataConnection* con ) = 0;
105 virtual StatusCode connectWrite( IDataConnection* con, IoType mode = Connection::CREATE,
106 const std::string& doctype = "UNKNOWN" ) = 0;
108 virtual StatusCode disconnect( IDataConnection* con ) = 0;
110 virtual Connection* connection( const std::string& dsn ) const = 0;
112 virtual Connections connections( const IInterface* owner ) const = 0;
114 virtual StatusCode read( IDataConnection* con, void* const data, size_t len ) = 0;
116 virtual StatusCode write( IDataConnection* con, const void* data, int len ) = 0;
118 virtual long long int seek( IDataConnection* con, long long int where, int origin ) = 0;
119 };
120 } // End namespace Gaudi
121 #endif // GAUDIUTILS_IIODATAMANAGER_H
Gaudi::IDataConnection::age
int age() const
Access age counter.
Definition: IIODataManager.h:65
Gaudi::IDataConnection::fid
const std::string & fid() const
Access file id.
Definition: IIODataManager.h:55
Gaudi::IDataConnection::m_name
std::string m_name
Connection name/identifier.
Definition: IIODataManager.h:29
Gaudi::IDataConnection::IoType
IoType
I/O Connection types.
Definition: IIODataManager.h:41
Gaudi::IDataConnection::IoStatus
IoStatus
Status Code on bad file connection.
Definition: IIODataManager.h:43
Gaudi::IDataConnection::IDataConnection
IDataConnection(const IInterface *own, std::string nam)
Standard constructor.
Definition: IIODataManager.h:47
Gaudi::IDataConnection::m_fid
std::string m_fid
File ID of the connection.
Definition: IIODataManager.h:31
Gaudi::IIODataManager::FileType
FileType
Definition: IIODataManager.h:100
Gaudi::IIODataManager::Connections
std::vector< Connection * > Connections
Definition: IIODataManager.h:98
std
STL namespace.
hivetimeline.read
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:22
Gaudi::IIODataManager::IoType
Connection::IoType IoType
Definition: IIODataManager.h:99
Gaudi::IDataConnection::pfn
const std::string & pfn() const
Access physical file name.
Definition: IIODataManager.h:57
std::string
STL class.
Gaudi::IDataConnection::m_pfn
std::string m_pfn
Physical file name of the connection.
Definition: IIODataManager.h:33
Gaudi::IDataConnection::setPFN
void setPFN(std::string fn)
Set physical file name.
Definition: IIODataManager.h:59
Gaudi::IDataConnection::ageFile
int ageFile()
Increase age of I/O source.
Definition: IIODataManager.h:61
Gaudi::IDataConnection::name
const std::string & name() const
Connection name.
Definition: IIODataManager.h:51
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
DeclareInterfaceID
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:13
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
gaudirun.type
type
Definition: gaudirun.py:133
Gaudi::IIODataManager::Connection
IDataConnection Connection
Connection type definition.
Definition: IIODataManager.h:97
Io::READ
Definition: IFileMgr.h:27
std::move
T move(T...args)
Gaudi::IDataConnection::owner
const IInterface * owner() const
Owner instance.
Definition: IIODataManager.h:67
Gaudi::IDataConnection::setFID
void setFID(std::string fid)
Set file ID.
Definition: IIODataManager.h:53
std::vector
STL class.
Gaudi::IDataConnection
ABC describing basic data connection.
Definition: IIODataManager.h:25
Io::CREATE
Definition: IFileMgr.h:31
Gaudi::IDataConnection::resetAge
void resetAge()
Reset age.
Definition: IIODataManager.h:63
GaudiPython.GaudiAlgs.write
write
Definition: GaudiAlgs.py:1259
Gaudi::IIODataManager
Definition: IIODataManager.h:90
Io::UNKNOWN
Definition: IFileMgr.h:157
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
IInterface.h
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1