ATLAS Offline Software
VP1HttpGetFile.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1HttpGetFile //
9 // //
10 // Description: Download files in the background and get //
11 // notified upon completion. Optionally //
12 // require correct md5sum. //
13 // //
14 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
15 // Initial version: May 2008 //
16 // //
18 
19 #ifndef VP1HTTPGETFILE_H
20 #define VP1HTTPGETFILE_H
21 
22 #include <QObject>
23 #include <QByteArray>
24 
25 class VP1HttpGetFile : public QObject {
26 
27  Q_OBJECT
28 
29 public:
30 
31  VP1HttpGetFile(QObject * parent = 0);
32  virtual ~VP1HttpGetFile();
33 
34  void setMaxNumberOfPendingDownloads(unsigned);
35  unsigned maxNumberOfPendingDownloads() const;//Default is 8. A value of 0 disables limit.
36  unsigned numberOfPendingDownloads() const;
37 
38  bool isDownloading(const QString& urltofile) const;
39  bool isDownloadingTo(const QString& localtargetfile) const;
40 
41  QString startDownload( const QString& urltofile,
42  const QString& localtargetfile,
43  const QString& md5sum = "",//md5sum in hex format (like linux md5sum program outputs)
44  const QString& data = "" );
45 
46  //Returns non-empty string in case download could not be started
47  //(too many pending downloads or already downloading to that target).
48 
49 signals:
50  //If download was started succesfully, it will always end with one
51  //of the following signals being emitted at a later time:
52  void downloadSuccessful( const QString& urltofile,
53  const QString& localtargetfile,
54  const QString& data );
55  void downloadFailed( const QString& error,
56  const QString& urltofile,
57  const QString& localtargetfile,
58  const QString& data );
59 private:
60  class Imp;
61  Imp * m_d;
62 private Q_SLOTS:
65 };
66 
67 //Todo: Set accepts-gzip header?
68 
69 
70 #endif
VP1HttpGetFile::m_d
Imp * m_d
Definition: VP1HttpGetFile.h:60
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
VP1HttpGetFile::downloadThreadTerminated
void downloadThreadTerminated()
Definition: VP1HttpGetFile.cxx:116
VP1HttpGetFile::maxNumberOfPendingDownloads
unsigned maxNumberOfPendingDownloads() const
Definition: VP1HttpGetFile.cxx:61
VP1HttpGetFile
Definition: VP1HttpGetFile.h:25
VP1HttpGetFile::downloadThreadFinished
void downloadThreadFinished()
Definition: VP1HttpGetFile.cxx:94
VP1HttpGetFile::numberOfPendingDownloads
unsigned numberOfPendingDownloads() const
Definition: VP1HttpGetFile.cxx:67
VP1HttpGetFile::startDownload
QString startDownload(const QString &urltofile, const QString &localtargetfile, const QString &md5sum="", const QString &data="")
Definition: VP1HttpGetFile.cxx:73
VP1HttpGetFile::downloadSuccessful
void downloadSuccessful(const QString &urltofile, const QString &localtargetfile, const QString &data)
VP1HttpGetFile::VP1HttpGetFile
VP1HttpGetFile(QObject *parent=0)
Definition: VP1HttpGetFile.cxx:32
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1HttpGetFile::isDownloading
bool isDownloading(const QString &urltofile) const
Definition: VP1HttpGetFile.cxx:137
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
VP1HttpGetFile::Imp
Definition: VP1HttpGetFile.cxx:23
VP1HttpGetFile::setMaxNumberOfPendingDownloads
void setMaxNumberOfPendingDownloads(unsigned)
Definition: VP1HttpGetFile.cxx:55
VP1HttpGetFile::downloadFailed
void downloadFailed(const QString &error, const QString &urltofile, const QString &localtargetfile, const QString &data)
VP1HttpGetFile::isDownloadingTo
bool isDownloadingTo(const QString &localtargetfile) const
Definition: VP1HttpGetFile.cxx:148
error
Definition: IImpactPoint3dEstimator.h:70
VP1HttpGetFile::~VP1HttpGetFile
virtual ~VP1HttpGetFile()
Definition: VP1HttpGetFile.cxx:38