Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
IIODataManager.h
Go to the documentation of this file.
1 #ifndef GAUDIUTILS_IIODATAMANAGER_H
2 #define GAUDIUTILS_IIODATAMANAGER_H
3 
4 // Framework include files
6 
7 // C++ include files
8 #include <string>
9 #include <vector>
10 
11 /*
12  * LHCb namespace declaration
13  */
14 namespace Gaudi {
15 
25  protected:
33  int m_age = 0;
35  const IInterface* m_owner = nullptr;
36 
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 
43  public:
45  IDataConnection( const IInterface* own, std::string nam ) : m_name( std::move( nam ) ), m_owner( own ) {}
47  virtual ~IDataConnection() = default;
49  const std::string& name() const { return m_name; }
51  void setFID( std::string fid ) { m_fid = std::move( fid ); }
53  const std::string& fid() const { return m_fid; }
55  const std::string& pfn() const { return m_pfn; }
57  void setPFN( std::string fn ) { m_pfn = std::move( fn ); }
59  int ageFile() { return ++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 
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,
103  const std::string& doctype = "UNKNOWN" ) = 0;
105  virtual StatusCode disconnect( IDataConnection* con ) = 0;
107  virtual Connection* connection( const std::string& dsn ) const = 0;
109  virtual Connections connections( const IInterface* owner ) const = 0;
111  virtual StatusCode read( IDataConnection* con, void* const data, size_t len ) = 0;
113  virtual StatusCode write( IDataConnection* con, const void* data, int len ) = 0;
115  virtual long long int seek( IDataConnection* con, long long int where, int origin ) = 0;
116  };
117 } // End namespace Gaudi
118 #endif // GAUDIUTILS_IIODATAMANAGER_H
int age() const
Access age counter.
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.
IDataConnection(const IInterface *own, std::string nam)
Standard constructor.
std::string m_fid
File ID of the connection.
std::vector< Connection * > Connections
STL namespace.
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:22
Connection::IoType IoType
const std::string & pfn() const
Access physical file name.
STL class.
std::string m_pfn
Physical file name of the connection.
void setPFN(std::string fn)
Set physical file name.
int ageFile()
Increase age of I/O source.
const std::string & name() const
Connection name.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
#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
Definition of the basic interface.
Definition: IInterface.h:244
IDataConnection Connection
Connection type definition.
T move(T...args)
const IInterface * owner() const
Owner instance.
void setFID(std::string fid)
Set file ID.
STL class.
ABC describing basic data connection.
void resetAge()
Reset age.
#define GAUDI_API
Definition: Kernel.h:71
Helper functions to set/get the application return code.
Definition: __init__.py:1