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#ifndef STORAGESVC_FILEDESCRIPTOR_H
5#define STORAGESVC_FILEDESCRIPTOR_H 1
6
7#include "uuid/uuid.h"
8#include "CxxUtils/MD5.h"
10
11#include <string>
12
13 class DbConnection;
14 // as from IFileCatalog
15 typedef std::string FileID;
16
27 private:
31 std::string m_PFN;
34
35 public:
39 FileDescriptor(const FileID& fid, const std::string& pfn)
40 : m_FID(fid), m_PFN(pfn), m_DBC(0) {
41 if (!m_FID.empty() && !Guid::isGuid(m_FID)) {
42 // MN: TODO: review this constructor usage
43 initFromFilename(m_FID);
44 }
45 }
46
48 void initFromFilename(const std::string& filename) {
49 m_PFN = filename;
50 MD5 checkSum(filename);
51 uuid_t checkSumUuid;
52 checkSum.raw_digest(checkSumUuid);
53 char text[37];
54 uuid_unparse_upper(checkSumUuid, text);
55 m_FID = text;
56 }
57
59 const std::string& PFN() const { return m_PFN; }
61 void setPFN(const std::string& val) { m_PFN = val; }
62
64 const FileID& FID() const { return m_FID; }
66 void setFID(const FileID& val) { m_FID = val; }
67
69 DbConnection* dbc() { return m_DBC; }
70 const DbConnection* dbc() const { return m_DBC; }
72 void setDbc(DbConnection* val) { m_DBC = val; }
73};
74
75#endif
std::string FileID
This file contains the class definition for the Guid class (migrated from POOL).
solar's public-domain MD5, wrapped for C++.
Definition of the DbConnection class.
void setDbc(DbConnection *val)
Access to file descriptor (WRITE).
DbConnection * m_DBC
Handle to the Database connection.
void setPFN(const std::string &val)
Access to physical file name (WRITE).
std::string m_PFN
Physical file name.
FileDescriptor(const FileID &fid, const std::string &pfn)
Constructor with initializing arguments.
void setFID(const FileID &val)
Access to file identifier (WRITE).
DbConnection * dbc()
Access to file descriptor (READ).
const DbConnection * dbc() const
const std::string & PFN() const
Access to physical file name (READ).
void initFromFilename(const std::string &filename)
Generate new FID from the filename.
FileID m_FID
File Identifier (UNIQUE).
FileDescriptor()
Standard Constructor.
const FileID & FID() const
Access to file identifier (READ).
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