ATLAS Offline Software
Loading...
Searching...
No Matches
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
25class VP1HttpGetFile : public QObject {
26
27 Q_OBJECT
28
29public:
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
49signals:
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 );
59private:
60 class Imp;
62private Q_SLOTS:
65};
66
67//Todo: Set accepts-gzip header?
68
69
70#endif
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
void downloadSuccessful(const QString &urltofile, const QString &localtargetfile, const QString &data)
void setMaxNumberOfPendingDownloads(unsigned)
void downloadThreadTerminated()
void downloadThreadFinished()
VP1HttpGetFile(QObject *parent=0)
void downloadFailed(const QString &error, const QString &urltofile, const QString &localtargetfile, const QString &data)
unsigned maxNumberOfPendingDownloads() const
bool isDownloadingTo(const QString &localtargetfile) const
virtual ~VP1HttpGetFile()
unsigned numberOfPendingDownloads() const
QString startDownload(const QString &urltofile, const QString &localtargetfile, const QString &md5sum="", const QString &data="")
bool isDownloading(const QString &urltofile) const