| The Gaudi Framework v27r1

- 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
24 class GAUDI_API IDataConnection {
25 protected:
27 std::string m_name;
29 std::string m_fid;
31 std::string m_pfn;
33 int m_age = 0;
35 const IInterface* m_owner = nullptr;
36 public:
38 enum IoType { READ=1<<1,UPDATE=1<<2,CREATE=1<<3,RECREATE=(1<<4)+(1<<3) };
40 enum IoStatus { BAD_DATA_CONNECTION=4 };
41 public:
43 IDataConnection(const IInterface* own, std::string nam)
44 : m_name(std::move(nam)), m_owner(own) {}
46 virtual ~IDataConnection() = default;
48 const std::string& name() const { return m_name; }
50 void setFID(std::string fid) { m_fid = std::move(fid); }
52 const std::string& fid() const { return m_fid; }
54 const std::string& pfn() const { return m_pfn; }
56 void setPFN(std::string fn) { m_pfn = std::move(fn); }
58 int ageFile() { return ++m_age; }
60 void resetAge() { m_age = 0; }
62 int age() const { return m_age; }
64 const IInterface* owner() const { return m_owner; }
66 virtual StatusCode connectRead() = 0;
68 virtual StatusCode connectWrite(IoType type) = 0;
70 virtual StatusCode disconnect() = 0;
72 virtual bool isConnected() const = 0;
74 virtual StatusCode read(void* const data, size_t len) = 0;
76 virtual StatusCode write(const void* data, int len) = 0;
78 virtual long long int seek(long long int where, int origin) = 0;
79 };
80
87 class GAUDI_API IIODataManager : virtual public IInterface {
88 public:
90 DeclareInterfaceID(IIODataManager,2,0);
91
93 typedef IDataConnection Connection;
94 typedef std::vector<Connection*> Connections;
95 typedef Connection::IoType IoType;
96 enum FileType { UNKNOWN=1, PFN, LFN, FID };
97
99 virtual StatusCode connectRead(bool keep_open, IDataConnection* con) = 0;
101 virtual StatusCode connectWrite(IDataConnection* con,IoType mode=Connection::CREATE,const std::string& doctype="UNKNOWN") = 0;
103 virtual StatusCode disconnect(IDataConnection* con) = 0;
105 virtual Connection* connection(const std::string& dsn) const = 0;
107 virtual Connections connections(const IInterface* owner) const = 0;
109 virtual StatusCode read(IDataConnection* con, void* const data, size_t len) = 0;
111 virtual StatusCode write(IDataConnection* con, const void* data, int len) = 0;
113 virtual long long int seek(IDataConnection* con, long long int where, int origin) = 0;
114 };
115 } // End namespace Gaudi
116 #endif // GAUDIUTILS_IIODATAMANAGER_H
Gaudi::IDataConnection::age
int age() const
Access age counter.
Definition: IIODataManager.h:62
Gaudi::IDataConnection::fid
const std::string & fid() const
Access file id.
Definition: IIODataManager.h:52
Gaudi::IDataConnection::m_name
std::string m_name
Connection name/identifier.
Definition: IIODataManager.h:27
Gaudi::IDataConnection::IoType
IoType
I/O Connection types.
Definition: IIODataManager.h:38
Gaudi::IDataConnection::IoStatus
IoStatus
Status Code on bad file connection.
Definition: IIODataManager.h:40
Gaudi::IDataConnection::IDataConnection
IDataConnection(const IInterface *own, std::string nam)
Standard constructor.
Definition: IIODataManager.h:43
Gaudi::IDataConnection::m_fid
std::string m_fid
File ID of the connection.
Definition: IIODataManager.h:29
Gaudi::IIODataManager::FileType
FileType
Definition: IIODataManager.h:96
Gaudi::IIODataManager::Connections
std::vector< Connection * > Connections
Definition: IIODataManager.h:94
std
STL namespace.
Gaudi::IIODataManager::IoType
Connection::IoType IoType
Definition: IIODataManager.h:95
Gaudi::IDataConnection::pfn
const std::string & pfn() const
Access physical file name.
Definition: IIODataManager.h:54
std::string
STL class.
Gaudi::IDataConnection::m_pfn
std::string m_pfn
Physical file name of the connection.
Definition: IIODataManager.h:31
Gaudi::IDataConnection::setPFN
void setPFN(std::string fn)
Set physical file name.
Definition: IIODataManager.h:56
gaudirun.type
string type
Definition: gaudirun.py:151
Gaudi::IDataConnection::ageFile
int ageFile()
Increase age of I/O source.
Definition: IIODataManager.h:58
Gaudi::IDataConnection::name
const std::string & name() const
Connection name.
Definition: IIODataManager.h:48
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:234
Gaudi::IIODataManager::Connection
IDataConnection Connection
Connection type definition.
Definition: IIODataManager.h:93
Io::READ
Definition: IFileMgr.h:26
std::move
T move(T...args)
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:14
Gaudi::IDataConnection::owner
const IInterface * owner() const
Owner instance.
Definition: IIODataManager.h:64
Gaudi::IDataConnection::setFID
void setFID(std::string fid)
Set file ID.
Definition: IIODataManager.h:50
std::vector
STL class.
Gaudi::IDataConnection
ABC describing basic data connection.
Definition: IIODataManager.h:24
Io::CREATE
Definition: IFileMgr.h:30
Gaudi::IDataConnection::resetAge
void resetAge()
Reset age.
Definition: IIODataManager.h:60
Gaudi::IIODataManager
Definition: IIODataManager.h:87
Io::UNKNOWN
Definition: IFileMgr.h:151
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
IInterface.h
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1