annotate OrthancServer/Sources/ExportedResource.cpp @ 5109:027366cae766

cppcheck
author Alain Mazy <am@osimis.io>
date Tue, 22 Nov 2022 12:57:10 +0100
parents 6eff25f70121
children 0ea402b4d901
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1624
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1247
diff changeset
4 * Department, University Hospital of Liege, Belgium
4870
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
1624
0a2ad4a6858f fix missing precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
23 #include "PrecompiledHeadersServer.h"
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "ExportedResource.h"
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
26 #include "../../OrthancFramework/Sources/OrthancException.h"
1247
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 namespace Orthanc
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 void ExportedResource::Format(Json::Value& item) const
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 item = Json::objectValue;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 item["Seq"] = static_cast<int>(seq_);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 item["ResourceType"] = EnumerationToString(resourceType_);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 item["ID"] = publicId_;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 item["Path"] = GetBasePath(resourceType_, publicId_);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 item["RemoteModality"] = modality_;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 item["Date"] = date_;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 // WARNING: Do not add "break" below and do not reorder the case items!
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 switch (resourceType_)
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 case ResourceType_Instance:
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 item["SOPInstanceUID"] = sopInstanceUid_;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 case ResourceType_Series:
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 item["SeriesInstanceUID"] = seriesInstanceUid_;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 case ResourceType_Study:
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 item["StudyInstanceUID"] = studyInstanceUid_;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 case ResourceType_Patient:
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 item["PatientID"] = patientId_;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 break;
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 default:
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 throw OrthancException(ErrorCode_InternalError);
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 }
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
32fcc5dc7562 abstraction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 }