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
7 
8 // C++ include files
9 #include <string>
10 #include <vector>
11 
12 /*
13  * LHCb namespace declaration
14  */
15 namespace Gaudi {
16 
26  protected:
28  std::string m_name;
30  std::string m_fid;
32  std::string m_pfn;
34  int m_age;
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:
92 
95  typedef std::vector<Connection*> Connections;
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
int age() const
Access age counter.
int m_age
Age counter.
const IInterface * m_owner
Owner pointer.
const std::string & fid() const
Access file id.
std::string m_name
Connection name/identifier.
IoType
I/O Connection types.
IoStatus
Status Code on bad file connection.
std::string m_fid
File ID of the connection.
std::vector< Connection * > Connections
Connection::IoType IoType
const std::string & pfn() const
Access physical file name.
std::string m_pfn
Physical file name of the connection.
string type
Definition: gaudirun.py:126
const std::string & name() const
Connection name.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
#define DeclareInterfaceID(name, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:23
IDataConnection Connection
Connection type definition.
void setPFN(const std::string &fn)
Set physical file name.
virtual ~IDataConnection()
Standard destructor.
const IInterface * owner() const
Owner instance.
ABC describing basic data connection.
IDataConnection(const IInterface *own, const std::string &nam)
Standard constructor.
void setFID(const std::string &fid)
Set file ID.
void resetAge()
Reset age.
This is a number of static methods for bootstrapping the Gaudi framework.
Definition: Bootstrap.h:15
void ageFile()
Increase age of I/O source.
#define GAUDI_API
Definition: Kernel.h:108