ATLAS Offline Software
FileDescriptor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //====================================================================
6 // Storage service file descriptor class definitions
7 //--------------------------------------------------------------------
8 //
9 // Package : StorageSvc (The POOL project)
10 // @author M.Frank
11 //====================================================================
12 #ifndef POOL_FILEDESCRIPTOR_H
13 #define POOL_FILEDESCRIPTOR_H 1
14 
15 #include "uuid/uuid.h"
16 #include "CxxUtils/MD5.h"
18 
19 #include <string>
20 
21 /*
22  * POOL namespace declaration
23  */
24 namespace pool {
25 
26  // as from IFileCatalog
27  typedef std::string FileID;
30 
42  private:
46  std::string m_PFN;
49 
50  public:
52  FileDescriptor() : m_DBC(0) { }
54  FileDescriptor(const FileID& fid, const std::string& pfn)
55  : m_FID(fid), m_PFN(pfn), m_DBC(0) {
56  if (!m_FID.empty() && Guid(m_FID).toString() != m_FID) {
57  MD5 checkSum((unsigned char*)m_FID.c_str(), m_FID.size());
58  uuid_t checkSumUuid;
59  checkSum.raw_digest((unsigned char*)(&checkSumUuid));
60  char text[37];
61  uuid_unparse_upper(checkSumUuid, text);
62  m_FID = text;
63  }
64  }
65 
67  const std::string& PFN() const { return m_PFN; }
69  void setPFN(const std::string& val) { m_PFN = val; }
70 
72  const FileID& FID() const { return m_FID; }
74  void setFID(const FileID& val) { m_FID = val; }
75 
77  ConnectionH dbc() { return m_DBC; }
78  ConstConnectionH dbc() const { return m_DBC; }
81  };
82 } // End namespace pool
83 #endif // POOL_FILEDESCRIPTOR_H
pool::DatabaseConnection
Definition: DatabaseConnection.h:23
pool::ConnectionH
class DatabaseConnection * ConnectionH
Definition: FileDescriptor.h:28
pool::FileDescriptor::m_FID
FileID m_FID
File Identifier (UNIQUE)
Definition: FileDescriptor.h:44
pool::FileDescriptor::setDbc
void setDbc(ConnectionH val)
Access to file descriptor (WRITE)
Definition: FileDescriptor.h:80
pool
pool namespace
Definition: libname.h:15
pool::FileDescriptor
Definition: FileDescriptor.h:41
pool::FileDescriptor::FileDescriptor
FileDescriptor(const FileID &fid, const std::string &pfn)
Constructor with initializing arguments.
Definition: FileDescriptor.h:54
MD5::raw_digest
void raw_digest(unsigned char *s) const
Definition: MD5.cxx:82
MD5.h
solar's public-domain MD5, wrapped for C++.
pool::FileDescriptor::FileDescriptor
FileDescriptor()
Standard Constructor.
Definition: FileDescriptor.h:52
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
pool::FileDescriptor::dbc
ConstConnectionH dbc() const
Definition: FileDescriptor.h:78
pool::FileDescriptor::setPFN
void setPFN(const std::string &val)
Access to physical file name (WRITE)
Definition: FileDescriptor.h:69
pool::FileDescriptor::setFID
void setFID(const FileID &val)
Access to file identifier (WRITE)
Definition: FileDescriptor.h:74
pool::FileDescriptor::m_DBC
ConnectionH m_DBC
Handle to the Database connection.
Definition: FileDescriptor.h:48
MD5
Definition: MD5.h:20
pool::FileID
std::string FileID
Definition: FileDescriptor.h:27
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
pool::FileDescriptor::FID
const FileID & FID() const
Access to file identifier (READ)
Definition: FileDescriptor.h:72
pool::FileDescriptor::dbc
ConnectionH dbc()
Access to file descriptor (READ)
Definition: FileDescriptor.h:77
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
pool::FileDescriptor::m_PFN
std::string m_PFN
Physical file name.
Definition: FileDescriptor.h:46
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
Guid.h
This file contains the class definition for the Guid class (migrated from POOL).
pool::FileDescriptor::PFN
const std::string & PFN() const
Access to physical file name (READ)
Definition: FileDescriptor.h:67
pool::ConstConnectionH
const DatabaseConnection * ConstConnectionH
Definition: FileDescriptor.h:29