Slicer 5.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkURIHandler.h
Go to the documentation of this file.
1#ifndef __vtkURIHandler_h
2#define __vtkURIHandler_h
3
4// MRML includes
5#include "vtkMRML.h"
7
8// VTK includes
9#include <vtkObject.h>
10
11class VTK_MRML_EXPORT vtkURIHandler : public vtkObject
12{
13public:
15 // static vtkURIHandler* New() { return nullptr; };
16 static vtkURIHandler* New();
17 vtkTypeMacro(vtkURIHandler, vtkObject);
18 void PrintSelf(ostream& os, vtkIndent indent) override;
19
20 vtkGetStringMacro(HostName);
21 vtkSetStringMacro(HostName);
22
26 virtual void StageFileRead(const char* source, const char* destination);
27 void StageFileRead(const std::string& source, const std::string& destination) { this->StageFileRead(source.c_str(), destination.c_str()); }
28 virtual void StageFileWrite(const char* source, const char* destination);
29 void StageFileWrite(const std::string& source, const std::string& destination) { this->StageFileWrite(source.c_str(), destination.c_str()); }
30
33 virtual void StageFileRead(const char* source, const char* destination, const char* username, const char* password, const char* hostname);
34
35 virtual void StageFileWrite(const char* source, const char* username, const char* password, const char* hostname, const char* sessionID);
36
38
42 virtual int CanHandleURI(const char* vtkNotUsed(uri)) { return 0; };
43
46 size_t BufferedWrite(char* buffer, size_t size, size_t nitems);
47
50 // virtual void SetLocalFile ( std::ofstream* localFile );
51 virtual void SetLocalFile(FILE* localFile);
52
55 int ProgressCallback(FILE* outputFile, double dltotal, double dlnow, double ultotal, double ulnow);
56
57 vtkGetMacro(RequiresPermission, int);
58 vtkSetMacro(RequiresPermission, int);
59 vtkGetObjectMacro(PermissionPrompter, vtkPermissionPrompter);
61 vtkGetStringMacro(Prefix);
62 vtkSetStringMacro(Prefix);
63 vtkGetStringMacro(Name);
64 vtkSetStringMacro(Name);
65
66private:
67 //--- Methods to configure and close transfer
69 virtual void InitTransfer();
70 virtual int CloseTransfer() { return 0; }
71
72 int RequiresPermission;
73 vtkPermissionPrompter* PermissionPrompter;
74
75protected:
77 ~vtkURIHandler() override;
80
83 // std::ofstream* LocalFile;
84 FILE* LocalFile;
85 char* Prefix;
86 char* Name;
87 char* HostName;
88};
89
90#endif
void StageFileRead(const std::string &source, const std::string &destination)
virtual void SetLocalFile(FILE *localFile)
Use this function to set LocalFile.
int ProgressCallback(FILE *outputFile, double dltotal, double dlnow, double ultotal, double ulnow)
This function gives us some feedback on how our download is going.
virtual void StageFileRead(const char *source, const char *destination, const char *username, const char *password, const char *hostname)
various Read/Write method footprints useful to redefine in specific handlers.
~vtkURIHandler() override
virtual void StageFileWrite(const char *source, const char *username, const char *password, const char *hostname, const char *sessionID)
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void SetPermissionPrompter(vtkPermissionPrompter *prompter)
virtual int CanHandleURI(const char *vtkNotUsed(uri))
need something that goes the other way too...
void operator=(const vtkURIHandler &)
FILE * LocalFile
local file, it gets passed to C functions in the CURL library
static vtkURIHandler * New()
The Usual vtk class functions.
size_t BufferedWrite(char *buffer, size_t size, size_t nitems)
This function writes the downloaded data in a buffered manner.
void StageFileWrite(const std::string &source, const std::string &destination)
vtkURIHandler(const vtkURIHandler &)
virtual void StageFileRead(const char *source, const char *destination)
virtual void StageFileWrite(const char *source, const char *destination)