| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# 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
    00025   class GAUDI_API IDataConnection  {
    00026   protected:
    00028     std::string              m_name;
    00030     std::string              m_fid;
    00032     std::string              m_pfn;
    00034     int                      m_age;
    00036     const IInterface*        m_owner;
    00037   public:
    00039     enum IoType   { READ=1<<1,UPDATE=1<<2,CREATE=1<<3,RECREATE=(1<<4)+(1<<3) };
    00041     enum IoStatus { BAD_DATA_CONNECTION=4 };
    00042   public:
    00044     IDataConnection(const IInterface* own, const std::string& nam)
    00045     : m_name(nam), m_owner(own) {}
    00047     virtual ~IDataConnection() {}
    00049     const std::string& name() const       {     return m_name;       }
    00051     void setFID(const std::string& fid)   {     m_fid = fid;         }
    00053     const std::string& fid() const        {     return m_fid;        }
    00055     const std::string& pfn() const        {     return m_pfn;        }
    00057     void setPFN(const std::string& fn)    {     m_pfn = fn;          }
    00059     void ageFile()                        {     ++m_age;             }
    00061     void resetAge()                       {     m_age = 0;           }
    00063     int age() const                       {     return m_age;        }
    00065     const IInterface* owner() const       {     return m_owner;      }
    00067     virtual StatusCode connectRead() = 0;
    00069     virtual StatusCode connectWrite(IoType type) = 0;
    00071     virtual StatusCode disconnect() = 0;
    00073     virtual bool isConnected() const = 0;
    00075     virtual StatusCode read(void* const data, size_t len) = 0;
    00077     virtual StatusCode write(const void* data, int len) = 0;
    00079     virtual long long int seek(long long int where, int origin) = 0;
    00080   };
    00081
    00088   class GAUDI_API IIODataManager : virtual public IInterface {
    00089   public:
    00091     DeclareInterfaceID(IIODataManager,2,0);
    00092
    00094     typedef IDataConnection           Connection;
    00095     typedef std::vector<Connection*>  Connections;
    00096     typedef Connection::IoType        IoType;
    00097     enum FileType { UNKNOWN=1, PFN, LFN, FID };
    00098
    00100     virtual StatusCode connectRead(bool keep_open, IDataConnection* con) = 0;
    00102     virtual StatusCode connectWrite(IDataConnection* con,IoType mode=Connection::CREATE,const std::string& doctype="UNKNOWN") = 0;
    00104     virtual StatusCode disconnect(IDataConnection* con) = 0;
    00106     virtual Connection* connection(const std::string& dsn) const = 0;
    00108     virtual Connections connections(const IInterface* owner) const = 0;
    00110     virtual StatusCode read(IDataConnection* con, void* const data, size_t len) = 0;
    00112     virtual StatusCode write(IDataConnection* con, const void* data, int len) = 0;
    00114     virtual long long int seek(IDataConnection* con, long long int where, int origin) = 0;
    00115   };
    00116 }         // End namespace Gaudi
    00117 #endif    // GAUDIUTILS_IIODATAMANAGER_H