Mercurial > hg > orthanc
annotate Core/SerializationToolbox.h @ 3179:fca730c267d7
New primitives to set and refresh metrics
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Jan 2019 17:12:15 +0100 |
parents | 4e43e67f8ecf |
children | ae866fc06df5 94f4a18a79cc |
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 | |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2845
diff
changeset
|
5 * Copyright (C) 2017-2019 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 | |
52 unsigned int ReadUnsignedInteger(const Json::Value& value, | |
53 const std::string& field); | |
54 | |
55 bool ReadBoolean(const Json::Value& value, | |
56 const std::string& field); | |
57 | |
58 void ReadArrayOfStrings(std::vector<std::string>& target, | |
59 const Json::Value& value, | |
60 const std::string& field); | |
61 | |
62 void ReadListOfStrings(std::list<std::string>& target, | |
63 const Json::Value& value, | |
64 const std::string& field); | |
65 | |
66 void ReadSetOfStrings(std::set<std::string>& target, | |
67 const Json::Value& value, | |
68 const std::string& field); | |
69 | |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
70 void ReadSetOfTags(std::set<DicomTag>& target, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
71 const Json::Value& value, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
72 const std::string& field); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
73 |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
74 void ReadMapOfStrings(std::map<std::string, std::string>& values, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
75 const Json::Value& target, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
76 const std::string& field); |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
77 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
78 void ReadMapOfTags(std::map<DicomTag, 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 |
2656 | 82 void WriteArrayOfStrings(Json::Value& target, |
83 const std::vector<std::string>& values, | |
84 const std::string& field); | |
85 | |
86 void WriteSetOfStrings(Json::Value& target, | |
87 const std::set<std::string>& values, | |
88 const std::string& field); | |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
89 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
90 void WriteSetOfTags(Json::Value& target, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
91 const std::set<DicomTag>& tags, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2656
diff
changeset
|
92 const std::string& field); |
2845
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
93 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
94 void WriteMapOfStrings(Json::Value& target, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
95 const std::map<std::string, std::string>& values, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
96 const std::string& field); |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
97 |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
98 void WriteMapOfTags(Json::Value& target, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
99 const std::map<DicomTag, std::string>& values, |
218e2c864d1d
serialization of SplitStudyJob
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2662
diff
changeset
|
100 const std::string& field); |
2656 | 101 } |
102 } |