annotate Core/SerializationToolbox.h @ 4012:dc6e7c7372ae

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