The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
IIODataManager.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
13// Framework include files
15
16// C++ include files
17#include <string>
18#include <vector>
19
20/*
21 * LHCb namespace declaration
22 */
23namespace Gaudi {
24
34 protected:
36 std::string m_name;
38 std::string m_fid;
40 std::string m_pfn;
42 int m_age = 0;
44 const IInterface* m_owner = nullptr;
45
46 public:
48 enum IoType { READ = 1 << 1, UPDATE = 1 << 2, CREATE = 1 << 3, RECREATE = ( 1 << 4 ) + ( 1 << 3 ) };
51
52 public:
54 IDataConnection( const IInterface* own, std::string nam ) : m_name( std::move( nam ) ), m_owner( own ) {}
56 virtual ~IDataConnection() = default;
58 const std::string& name() const { return m_name; }
60 void setFID( std::string fid ) { m_fid = std::move( fid ); }
62 const std::string& fid() const { return m_fid; }
64 const std::string& pfn() const { return m_pfn; }
66 void setPFN( std::string fn ) { m_pfn = std::move( fn ); }
68 int ageFile() { return ++m_age; }
70 void resetAge() { m_age = 0; }
72 int age() const { return m_age; }
74 const IInterface* owner() const { return m_owner; }
76 virtual StatusCode connectRead() = 0;
78 virtual StatusCode connectWrite( IoType type ) = 0;
80 virtual StatusCode disconnect() = 0;
82 virtual bool isConnected() const = 0;
84 virtual StatusCode read( void* const data, size_t len ) = 0;
86 virtual StatusCode write( const void* data, int len ) = 0;
88 virtual long long int seek( long long int where, int origin ) = 0;
89 };
90
97 class GAUDI_API IIODataManager : virtual public IInterface {
98 public:
101
104 typedef std::vector<Connection*> Connections;
106 enum FileType { UNKNOWN = 1, PFN, LFN, FID };
107
109 virtual StatusCode connectRead( bool keep_open, IDataConnection* con ) = 0;
112 const std::string& doctype = "UNKNOWN" ) = 0;
116 virtual Connection* connection( const std::string& dsn ) const = 0;
118 virtual Connections connections( const IInterface* owner ) const = 0;
120 virtual StatusCode read( IDataConnection* con, void* const data, size_t len ) = 0;
122 virtual StatusCode write( IDataConnection* con, const void* data, int len ) = 0;
124 virtual long long int seek( IDataConnection* con, long long int where, int origin ) = 0;
125 };
126} // End namespace Gaudi
#define GAUDI_API
Definition Kernel.h:49
ABC describing basic data connection.
int m_age
Age counter.
const IInterface * m_owner
Owner pointer.
std::string m_fid
File ID of the connection.
virtual ~IDataConnection()=default
Standard destructor.
const IInterface * owner() const
Owner instance.
void resetAge()
Reset age.
virtual StatusCode connectRead()=0
Open data stream in read mode.
std::string m_pfn
Physical file name of the connection.
virtual StatusCode connectWrite(IoType type)=0
Open data stream in write mode.
virtual StatusCode read(void *const data, size_t len)=0
Read raw byte buffer from input stream.
const std::string & fid() const
Access file id.
virtual StatusCode disconnect()=0
Release data stream.
IoStatus
Status Code on bad file connection.
void setPFN(std::string fn)
Set physical file name.
std::string m_name
Connection name/identifier.
void setFID(std::string fid)
Set file ID.
const std::string & name() const
Connection name.
IDataConnection(const IInterface *own, std::string nam)
Standard constructor.
virtual StatusCode write(const void *data, int len)=0
Write raw byte buffer to output stream.
const std::string & pfn() const
Access physical file name.
IoType
I/O Connection types.
int age() const
Access age counter.
int ageFile()
Increase age of I/O source.
virtual long long int seek(long long int where, int origin)=0
Seek on the file described by ioDesc. Arguments as in seek()
virtual bool isConnected() const =0
Check if connected to data source.
virtual StatusCode disconnect(IDataConnection *con)=0
Release data stream.
virtual StatusCode connectRead(bool keep_open, IDataConnection *con)=0
Open data stream in read mode.
virtual long long int seek(IDataConnection *con, long long int where, int origin)=0
Seek on the file described by ioDesc. Arguments as in seek()
virtual Connections connections(const IInterface *owner) const =0
Get connection by owner instance (0=ALL)
Connection::IoType IoType
std::vector< Connection * > Connections
DeclareInterfaceID(IIODataManager, 2, 0)
InterfaceID.
virtual StatusCode write(IDataConnection *con, const void *data, int len)=0
Write raw byte buffer to output stream.
virtual StatusCode connectWrite(IDataConnection *con, IoType mode=Connection::CREATE, const std::string &doctype="UNKNOWN")=0
Open data stream in write mode.
virtual Connection * connection(const std::string &dsn) const =0
Retrieve known connection.
IDataConnection Connection
Connection type definition.
virtual StatusCode read(IDataConnection *con, void *const data, size_t len)=0
Read raw byte buffer from input stream.
Definition of the basic interface.
Definition IInterface.h:225
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
STL namespace.