-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInitDamisService.h
More file actions
80 lines (69 loc) · 2.32 KB
/
InitDamisService.h
File metadata and controls
80 lines (69 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
///////////////////////////////////////////////////////////
// InitDamisServiceFile.h
// Implementation of the Class InitDamisServiceFile
// Created on: 30-Sau-2014 17:06:18
// Original author: Povilas
///////////////////////////////////////////////////////////
#if !defined(INITDAMISSERVICE_H)
#define INITDAMISSERVICE_H
#include "ArffFile.h"
#include <string>
/** \brief Structure that holds data for the curl file download
*
*/
struct FtpFile {
std::string filename; /**< File name to be saved stream under */
FILE *stream; /**< File data stream */
};
/** \brief Class that represents Damis service working file
*/
class InitDamisService : public ArffFile
{
public:
/** \brief Constructor
*
* \param std::string path to the file
* \param std::string file prefix
* \param bool validateFile = true indicates if the file data vil be validated after download
*
*/
InitDamisService(std::string fPath, std::string pref, bool validateFile = true);
/** \brief Destructor
*/
virtual ~InitDamisService();
/** \brief Function returns file download URI
*
* \return std::string
*
*/
std::string getDownloadFileURI();
private:
std::string downloadFileURI; /**< Download file URI */
bool validateFile; /**< If file data must be validated */
/** \brief Function checks if stream contains File not found HTTP server response
* \return bool if got error from the server
*
*/
bool checkForHttpError();
/** \brief Downloads file
* \return bool if file downloaded succesfully
*
*/
bool downloadFile();
/** \brief Performs file download and http error checking
* \return bool that indicates if the download and validation were sucessfull
*
*/
bool initialize();
/** \brief Callback to the stream write delegate
*
* \param void* Pointer to the array of elements to be written
* \param size_t Size in bytes of each element to be written
* \param size_t Number of elements, each one with a size of size bytes
* \param void* Pointer to a FILE object that specifies an output stream
* \return size_t The total number of elements successfully written
*
*/
static size_t fileWriteDelegeate(void *buffer, size_t size, size_t nmemb, void *stream);
};
#endif //!defined(INITDAMISSERVICE_H)