Mercurial > hg > orthanc
annotate Core/SerializationToolbox.h @ 3968:22eb9453b3f5 Orthanc-1.7.0
Orthanc-1.7.0
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 22 May 2020 12:30:36 +0200 |
parents | 09798f2b985f |
children | 5d2348b39392 |
rev | line source |
---|---|
2656 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
2656 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
34 #pragma once | |
35 | |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
36 #include "DicomFormat/DicomTag.h" |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
37 |
2656 | 38 #include <json/value.h> |
39 #include <list> | |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
40 #include <map> |
2656 | 41 |
42 namespace Orthanc | |
43 { | |
44 namespace SerializationToolbox | |
45 { | |
46 std::string ReadString(const Json::Value& value, | |
47 const std::string& field); | |
48 | |
49 int ReadInteger(const Json::Value& value, | |
50 const std::string& field); | |
51 | |
3870
09798f2b985f
added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents:
3641
diff
changeset
|
52 int ReadInteger(const Json::Value& value, |
09798f2b985f
added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents:
3641
diff
changeset
|
53 const std::string& field, |
09798f2b985f
added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents:
3641
diff
changeset
|
54 int defaultValue); |
09798f2b985f
added a Timeout argument to every DICOM command + 'TargetAet' not mandatory anymore in /retrieve
Alain Mazy <alain@mazy.be>
parents:
3641
diff
changeset
|
55 |
2656 | 56 unsigned int ReadUnsignedInteger(const Json::Value& value, |
57 const std::string& field); | |
58 | |
59 bool ReadBoolean(const Json::Value& value, | |
60 const std::string& field); | |
61 | |
62 void ReadArrayOfStrings(std::vector<std::string>& target, | |
63 const Json::Value& value, | |
64 const std::string& field); | |
65 | |
66 void ReadListOfStrings(std::list<std::string>& target, | |
67 const Json::Value& value, | |
68 const std::string& field); | |
69 | |
70 void ReadSetOfStrings(std::set<std::string>& target, | |
71 const Json::Value& value, | |
72 const std::string& field); | |
73 | |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
74 void ReadSetOfTags(std::set<DicomTag>& target, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
75 const Json::Value& value, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
76 const std::string& field); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
77 |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
78 void ReadMapOfStrings(std::map<std::string, std::string>& values, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
79 const Json::Value& target, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
80 const std::string& field); |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
81 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
82 void ReadMapOfTags(std::map<DicomTag, std::string>& values, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
83 const Json::Value& target, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
84 const std::string& field); |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
85 |
2656 | 86 void WriteArrayOfStrings(Json::Value& target, |
87 const std::vector<std::string>& values, | |
88 const std::string& field); | |
89 | |
3638
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
90 void WriteListOfStrings(Json::Value& target, |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
91 const std::list<std::string>& values, |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
92 const std::string& field); |
ae866fc06df5
serialization of StorageCommitmentScpJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
93 |
2656 | 94 void WriteSetOfStrings(Json::Value& target, |
95 const std::set<std::string>& values, | |
96 const std::string& field); | |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
97 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
98 void WriteSetOfTags(Json::Value& target, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
99 const std::set<DicomTag>& tags, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
100 const std::string& field); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
101 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
102 void WriteMapOfStrings(Json::Value& target, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
103 const std::map<std::string, std::string>& values, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
104 const std::string& field); |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
105 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
106 void WriteMapOfTags(Json::Value& target, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
107 const std::map<DicomTag, std::string>& values, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
108 const std::string& field); |
2656 | 109 } |
110 } |