ATLAS Offline Software
Loading...
Searching...
No Matches
FileDescriptor.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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 */
24namespace pool {
25
26 class DbConnection;
27 // as from IFileCatalog
28 typedef std::string FileID;
29
41 private:
45 std::string m_PFN;
48
49 public:
53 FileDescriptor(const FileID& fid, const std::string& pfn)
54 : m_FID(fid), m_PFN(pfn), m_DBC(0) {
55 if (!m_FID.empty() && !Guid::isGuid(m_FID)) {
56 // MN: TODO: review this constructor usage
57 initFromFilename(m_FID);
58 }
59 }
60
62 void initFromFilename(const std::string& filename) {
63 m_PFN = filename;
64 MD5 checkSum((unsigned char*)filename.c_str(), filename.size());
65 uuid_t checkSumUuid;
66 checkSum.raw_digest((unsigned char*)(&checkSumUuid));
67 char text[37];
68 uuid_unparse_upper(checkSumUuid, text);
69 m_FID = text;
70 }
71
73 const std::string& PFN() const { return m_PFN; }
75 void setPFN(const std::string& val) { m_PFN = val; }
76
78 const FileID& FID() const { return m_FID; }
80 void setFID(const FileID& val) { m_FID = val; }
81
83 DbConnection* dbc() { return m_DBC; }
84 const DbConnection* dbc() const { return m_DBC; }
86 void setDbc(DbConnection* val) { m_DBC = val; }
87 };
88} // End namespace pool
89#endif // POOL_FILEDESCRIPTOR_H
This file contains the class definition for the Guid class (migrated from POOL).
solar's public-domain MD5, wrapped for C++.
static bool isGuid(std::string_view) noexcept
Definition Guid.cxx:54
Definition MD5.h:20
void raw_digest(unsigned char *s) const
Definition MD5.cxx:82
Definition of the DbConnection class.
FileID m_FID
File Identifier (UNIQUE).
FileDescriptor()
Standard Constructor.
const FileID & FID() const
Access to file identifier (READ).
void initFromFilename(const std::string &filename)
Generate new FID from the filename.
void setPFN(const std::string &val)
Access to physical file name (WRITE).
const DbConnection * dbc() const
DbConnection * dbc()
Access to file descriptor (READ).
DbConnection * m_DBC
Handle to the Database connection.
void setFID(const FileID &val)
Access to file identifier (WRITE).
std::string m_PFN
Physical file name.
FileDescriptor(const FileID &fid, const std::string &pfn)
Constructor with initializing arguments.
const std::string & PFN() const
Access to physical file name (READ).
void setDbc(DbConnection *val)
Access to file descriptor (WRITE).
Framework include files.
Definition libname.h:15
std::string FileID