Mercurial > hg > orthanc
annotate OrthancFramework/Sources/FileStorage/FileInfo.cpp @ 4831:7053502fbf97
added copyright UCLouvain
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Nov 2021 19:01:11 +0100 |
parents | a3c6678aa7b1 |
children | 43e613a7756b |
rev | line source |
---|---|
4500
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4831
7053502fbf97
added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4519
diff
changeset
|
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4500
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * License along with this program. If not, see |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "../PrecompiledHeaders.h" |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "FileInfo.h" |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include "../OrthancException.h" |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 namespace Orthanc |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
4519 | 31 FileInfo::FileInfo() : |
32 valid_(false), | |
33 contentType_(FileContentType_Unknown), | |
34 uncompressedSize_(0), | |
35 compressionType_(CompressionType_None), | |
36 compressedSize_(0) | |
37 { | |
38 } | |
39 | |
40 | |
4500
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 FileInfo::FileInfo(const std::string& uuid, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 FileContentType contentType, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 uint64_t size, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 const std::string& md5) : |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 valid_(true), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 uuid_(uuid), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 contentType_(contentType), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 uncompressedSize_(size), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 uncompressedMD5_(md5), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 compressionType_(CompressionType_None), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 compressedSize_(size), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 compressedMD5_(md5) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 FileInfo::FileInfo(const std::string& uuid, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 FileContentType contentType, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 uint64_t uncompressedSize, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 const std::string& uncompressedMD5, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 CompressionType compressionType, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 uint64_t compressedSize, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 const std::string& compressedMD5) : |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 valid_(true), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 uuid_(uuid), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 contentType_(contentType), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 uncompressedSize_(uncompressedSize), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 uncompressedMD5_(uncompressedMD5), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 compressionType_(compressionType), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 compressedSize_(compressedSize), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 compressedMD5_(compressedMD5) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 bool FileInfo::IsValid() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 return valid_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 const std::string& FileInfo::GetUuid() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 return uuid_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 FileContentType FileInfo::GetContentType() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 return contentType_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 uint64_t FileInfo::GetUncompressedSize() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 return uncompressedSize_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 CompressionType FileInfo::GetCompressionType() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 return compressionType_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 uint64_t FileInfo::GetCompressedSize() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 return compressedSize_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 const std::string& FileInfo::GetCompressedMD5() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 return compressedMD5_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 const std::string& FileInfo::GetUncompressedMD5() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 return uncompressedMD5_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
171 } |