annotate OrthancFramework/Sources/FileStorage/FileInfo.cpp @ 5765:247fc5368693 find-refactoring

un-sharing DatabaseConstraint and ISqlLookupFormatter with orthanc-databases
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Sep 2024 16:14:22 +0200
parents f7adfb22e20e
children 8279eaab0d1d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4500
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * 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
10 * 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
11 * 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
12 * the License, or (at your option) any later version.
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * 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
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * 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
17 * Lesser General Public License for more details.
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * 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
20 * License along with this program. If not, see
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * <http://www.gnu.org/licenses/>.
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "../PrecompiledHeaders.h"
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "FileInfo.h"
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include "../OrthancException.h"
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace Orthanc
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
4519
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
32 FileInfo::FileInfo() :
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
33 valid_(false),
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
34 contentType_(FileContentType_Unknown),
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
35 uncompressedSize_(0),
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
36 compressionType_(CompressionType_None),
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
37 compressedSize_(0)
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
38 {
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
39 }
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
40
a3c6678aa7b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4500
diff changeset
41
4500
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 FileInfo::FileInfo(const std::string& uuid,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 FileContentType contentType,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 uint64_t size,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 const std::string& md5) :
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 valid_(true),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 uuid_(uuid),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 contentType_(contentType),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 uncompressedSize_(size),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 uncompressedMD5_(md5),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 compressionType_(CompressionType_None),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 compressedSize_(size),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 compressedMD5_(md5)
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 FileInfo::FileInfo(const std::string& uuid,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 FileContentType contentType,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 uint64_t uncompressedSize,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 const std::string& uncompressedMD5,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 CompressionType compressionType,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 uint64_t compressedSize,
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 const std::string& compressedMD5) :
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 valid_(true),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 uuid_(uuid),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 contentType_(contentType),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 uncompressedSize_(uncompressedSize),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 uncompressedMD5_(uncompressedMD5),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 compressionType_(compressionType),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 compressedSize_(compressedSize),
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 compressedMD5_(compressedMD5)
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 bool FileInfo::IsValid() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 return valid_;
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 const std::string& FileInfo::GetUuid() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 if (valid_)
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 return uuid_;
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 else
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 FileContentType FileInfo::GetContentType() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 if (valid_)
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 return contentType_;
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 else
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 uint64_t FileInfo::GetUncompressedSize() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 if (valid_)
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 return uncompressedSize_;
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 else
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 CompressionType FileInfo::GetCompressionType() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 if (valid_)
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 return compressionType_;
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 else
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 uint64_t FileInfo::GetCompressedSize() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 if (valid_)
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 return compressedSize_;
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 else
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 const std::string& FileInfo::GetCompressedMD5() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 if (valid_)
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 return compressedMD5_;
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 else
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 const std::string& FileInfo::GetUncompressedMD5() const
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 if (valid_)
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 return uncompressedMD5_;
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 else
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 {
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 throw OrthancException(ErrorCode_BadSequenceOfCalls);
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 }
3b4940bca158 added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 }