| # 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
IIODataManager.h
Go to the documentation of this file.
1 #ifndef GAUDIUTILS_IIODATAMANAGER_H
2 #define GAUDIUTILS_IIODATAMANAGER_H
3 // $Id:
4
5 // Framework include files
6 #include "GaudiKernel/IInterface.h"
7
8 // C++ include files
9 #include <string>
10 #include <vector>
11
12 /*
13 * LHCb namespace declaration
14 */
15 namespace Gaudi {
16
25 class GAUDI_API IDataConnection {
26 protected:
28 std::string m_name;
30 std::string m_fid;
32 std::string m_pfn;
34 int m_age;
36 const IInterface* m_owner;
37 public:
39 enum IoType { READ=1<<1,UPDATE=1<<2,CREATE=1<<3,RECREATE=(1<<4)+(1<<3) };
41 enum IoStatus { BAD_DATA_CONNECTION=4 };
42 public:
44 IDataConnection(const IInterface* own, const std::string& nam)
45 : m_name(nam), m_owner(own) {}
47 virtual ~IDataConnection() {}
49 const std::string& name() const { return m_name; }
51 void setFID(const std::string& fid) { m_fid = fid; }
53 const std::string& fid() const { return m_fid; }
55 const std::string& pfn() const { return m_pfn; }
57 void setPFN(const std::string& fn) { m_pfn = fn; }
59 void ageFile() { ++m_age; }
61 void resetAge() { m_age = 0; }
63 int age() const { return m_age; }
65 const IInterface* owner() const { return m_owner; }
67 virtual StatusCode connectRead() = 0;
69 virtual StatusCode connectWrite(IoType type) = 0;
71 virtual StatusCode disconnect() = 0;
73 virtual bool isConnected() const = 0;
75 virtual StatusCode read(void* const data, size_t len) = 0;
77 virtual StatusCode write(const void* data, int len) = 0;
79 virtual long long int seek(long long int where, int origin) = 0;
80 };
81
88 class GAUDI_API IIODataManager : virtual public IInterface {
89 public:
91 DeclareInterfaceID(IIODataManager,2,0);
92
94 typedef IDataConnection Connection;
95 typedef std::vector<Connection*> Connections;
96 typedef Connection::IoType IoType;
97 enum FileType { UNKNOWN=1, PFN, LFN, FID };
98
100 virtual StatusCode connectRead(bool keep_open, IDataConnection* con) = 0;
102 virtual StatusCode connectWrite(IDataConnection* con,IoType mode=Connection::CREATE,const std::string& doctype="UNKNOWN") = 0;
104 virtual StatusCode disconnect(IDataConnection* con) = 0;
106 virtual Connection* connection(const std::string& dsn) const = 0;
108 virtual Connections connections(const IInterface* owner) const = 0;
110 virtual StatusCode read(IDataConnection* con, void* const data, size_t len) = 0;
112 virtual StatusCode write(IDataConnection* con, const void* data, int len) = 0;
114 virtual long long int seek(IDataConnection* con, long long int where, int origin) = 0;
115 };
116 } // End namespace Gaudi
117 #endif // GAUDIUTILS_IIODATAMANAGER_H