Mercurial > hg > orthanc-object-storage
comparison Azure/AzureBlobStoragePlugin.cpp @ 153:6dd8bb916573
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 21 Jun 2024 14:29:22 +0200 |
parents | d62f52be1943 |
children |
comparison
equal
deleted
inserted
replaced
152:d62f52be1943 | 153:6dd8bb916573 |
---|---|
45 const as::BlobContainerClient& blobClient, | 45 const as::BlobContainerClient& blobClient, |
46 bool enableLegacyStorageStructure, | 46 bool enableLegacyStorageStructure, |
47 bool storageContainsUnknownFiles | 47 bool storageContainsUnknownFiles |
48 ); | 48 ); |
49 | 49 |
50 virtual IWriter* GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled); | 50 virtual IWriter* GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) ORTHANC_OVERRIDE; |
51 virtual IReader* GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled); | 51 virtual IReader* GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) ORTHANC_OVERRIDE; |
52 virtual void DeleteObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled); | 52 virtual void DeleteObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) ORTHANC_OVERRIDE; |
53 virtual bool HasFileExists() {return false;}; | 53 virtual bool HasFileExists() ORTHANC_OVERRIDE {return false;}; |
54 }; | 54 }; |
55 | 55 |
56 | 56 |
57 class Writer : public IStorage::IWriter | 57 class Writer : public IStorage::IWriter |
58 { | 58 { |
68 | 68 |
69 virtual ~Writer() | 69 virtual ~Writer() |
70 { | 70 { |
71 } | 71 } |
72 | 72 |
73 virtual void Write(const char* data, size_t size) | 73 virtual void Write(const char* data, size_t size) ORTHANC_OVERRIDE |
74 { | 74 { |
75 try | 75 try |
76 { | 76 { |
77 as::BlockBlobClient blobClient = client_.GetBlockBlobClient(path_); | 77 as::BlockBlobClient blobClient = client_.GetBlockBlobClient(path_); |
78 blobClient.UploadFrom(reinterpret_cast<const uint8_t*>(data), size); | 78 blobClient.UploadFrom(reinterpret_cast<const uint8_t*>(data), size); |
121 | 121 |
122 virtual ~Reader() | 122 virtual ~Reader() |
123 { | 123 { |
124 } | 124 } |
125 | 125 |
126 virtual size_t GetSize() | 126 virtual size_t GetSize() ORTHANC_OVERRIDE |
127 { | 127 { |
128 try | 128 try |
129 { | 129 { |
130 return static_cast<size_t>(size_); | 130 return static_cast<size_t>(size_); |
131 } | 131 } |
133 { | 133 { |
134 throw StoragePluginException("AzureBlobStorage: error while reading file " + std::string(path_) + ": " + ex.what()); | 134 throw StoragePluginException("AzureBlobStorage: error while reading file " + std::string(path_) + ": " + ex.what()); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 virtual void ReadWhole(char* data, size_t size) | 138 virtual void ReadWhole(char* data, size_t size) ORTHANC_OVERRIDE |
139 { | 139 { |
140 try | 140 try |
141 { | 141 { |
142 as::BlockBlobClient blobClient = client_.GetBlockBlobClient(path_); | 142 as::BlockBlobClient blobClient = client_.GetBlockBlobClient(path_); |
143 blobClient.DownloadTo(reinterpret_cast<uint8_t*>(data), static_cast<int64_t>(size)); | 143 blobClient.DownloadTo(reinterpret_cast<uint8_t*>(data), static_cast<int64_t>(size)); |
146 { | 146 { |
147 throw StoragePluginException("AzureBlobStorage: error while reading file " + std::string(path_) + ": " + ex.what()); | 147 throw StoragePluginException("AzureBlobStorage: error while reading file " + std::string(path_) + ": " + ex.what()); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 virtual void ReadRange(char* data, size_t size, size_t fromOffset) | 151 virtual void ReadRange(char* data, size_t size, size_t fromOffset) ORTHANC_OVERRIDE |
152 { | 152 { |
153 try | 153 try |
154 { | 154 { |
155 as::BlockBlobClient blobClient = client_.GetBlockBlobClient(path_); | 155 as::BlockBlobClient blobClient = client_.GetBlockBlobClient(path_); |
156 as::DownloadBlobToOptions options; | 156 as::DownloadBlobToOptions options; |