comparison Core/FileStorage/FileStorageAccessor.h @ 1124:790ff7a5b3bf

IStorageArea abstraction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Sep 2014 16:28:34 +0200
parents 6c5a77637b23
children bf67431a7383
comparison
equal deleted inserted replaced
1123:6c5a77637b23 1124:790ff7a5b3bf
31 31
32 32
33 #pragma once 33 #pragma once
34 34
35 #include "StorageAccessor.h" 35 #include "StorageAccessor.h"
36 #include "FilesystemStorage.h" 36 #include "IStorageArea.h"
37 #include "../HttpServer/FilesystemHttpSender.h"
38 37
39 namespace Orthanc 38 namespace Orthanc
40 { 39 {
41 class FileStorageAccessor : public StorageAccessor 40 class FileStorageAccessor : public StorageAccessor
42 { 41 {
43 private: 42 private:
44 FilesystemStorage& storage_; 43 IStorageArea& storage_;
45 44
46 protected: 45 protected:
47 virtual FileInfo WriteInternal(const void* data, 46 virtual FileInfo WriteInternal(const void* data,
48 size_t size, 47 size_t size,
49 FileContentType type); 48 FileContentType type);
50 49
51 public: 50 public:
52 FileStorageAccessor(FilesystemStorage& storage) : storage_(storage) 51 FileStorageAccessor(IStorageArea& storage) : storage_(storage)
53 { 52 {
54 } 53 }
55 54
56 virtual void Read(std::string& content, 55 virtual void Read(std::string& content,
57 const std::string& uuid) 56 const std::string& uuid)
58 { 57 {
59 storage_.Read(content, uuid); 58 storage_.Read(content, uuid);
60 } 59 }
61 60
62 virtual HttpFileSender* ConstructHttpFileSender(const std::string& uuid) 61 virtual HttpFileSender* ConstructHttpFileSender(const std::string& uuid);
63 {
64 return new FilesystemHttpSender(storage_.GetPath(uuid));
65 }
66 }; 62 };
67 } 63 }