| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- File List
- File Members

# IIODataManager.h

Go to the documentation of this file.

    00001 #ifndef GAUDIUTILS_IIODATAMANAGER_H
    00002 #define GAUDIUTILS_IIODATAMANAGER_H
    00003 // $Id:
    00004
    00005 // Framework include files
    00006 #include "GaudiKernel/IInterface.h"
    00007
    00008 // C++ include files
    00009 #include <string>
    00010 #include <vector>
    00011
    00012 /*
    00013  *  LHCb namespace declaration
    00014  */
    00015 namespace Gaudi  {
    00016
    00017   // Declaration of the interface ID ( interface id, major version, minor version)
    00018   static const InterfaceID IID_IIODataManager("IIODataManager", 1, 0);
    00019
    00028   class IDataConnection  {
    00029   protected:
    00031     std::string              m_name;
    00033     std::string              m_fid;
    00035     std::string              m_pfn;
    00037     int                      m_age;
    00039     const IInterface*        m_owner;
    00040   public:
    00042     enum IoType   { READ=1<<1,UPDATE=1<<2,CREATE=1<<3,RECREATE=(1<<4)+(1<<3) };
    00044     enum IoStatus { BAD_DATA_CONNECTION=4 };
    00045   public:
    00047     IDataConnection(const IInterface* own, const std::string& nam)
    00048     : m_name(nam), m_owner(own) {}
    00050     virtual ~IDataConnection() {}
    00052     const std::string& name() const       {     return m_name;       }
    00054     void setFID(const std::string& fid)   {     m_fid = fid;         }
    00056     const std::string& fid() const        {     return m_fid;        }
    00058     const std::string& pfn() const        {     return m_pfn;        }
    00060     void setPFN(const std::string& fn)    {     m_pfn = fn;          }
    00062     void ageFile()                        {     ++m_age;             }
    00064     void resetAge()                       {     m_age = 0;           }
    00066     int age() const                       {     return m_age;        }
    00068     const IInterface* owner() const       {     return m_owner;      }
    00070     virtual StatusCode connectRead() = 0;
    00072     virtual StatusCode connectWrite(IoType type) = 0;
    00074     virtual StatusCode disconnect() = 0;
    00076     virtual bool isConnected() const = 0;
    00078     virtual StatusCode read(void* const data, size_t len) = 0;
    00080     virtual StatusCode write(const void* data, int len) = 0;
    00082     virtual long long int seek(long long int where, int origin) = 0;
    00083   };
    00084
    00091   class IIODataManager : virtual public IInterface  {
    00092   public:
    00094     typedef IDataConnection           Connection;
    00095     typedef std::vector<Connection*>  Connections;
    00096     typedef Connection::IoType        IoType;
    00097     enum FileType { UNKNOWN=1, PFN, LFN, FID };
    00098   public:
    00100     static const InterfaceID& interfaceID() { return IID_IIODataManager; }
    00102     virtual StatusCode connectRead(bool keep_open, IDataConnection* con) = 0;
    00104     virtual StatusCode connectWrite(IDataConnection* con,IoType mode=Connection::CREATE,const std::string& doctype="UNKNOWN") = 0;
    00106     virtual StatusCode disconnect(IDataConnection* con) = 0;
    00108     virtual Connection* connection(const std::string& dsn) const = 0;
    00110     virtual Connections connections(const IInterface* owner) const = 0;
    00112     virtual StatusCode read(IDataConnection* con, void* const data, size_t len) = 0;
    00114     virtual StatusCode write(IDataConnection* con, const void* data, int len) = 0;
    00116     virtual long long int seek(IDataConnection* con, long long int where, int origin) = 0;
    00117   };
    00118 }         // End namespace Gaudi
    00119 #endif    // GAUDIUTILS_IIODATAMANAGER_H