Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerIndexChange.h @ 5633:5db4ed395d81
merge
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 21 May 2024 12:28:21 +0200 |
parents | 48b8dae6dc77 |
children | f7adfb22e20e |
rev | line source |
---|---|
1198 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1242
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1198 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
9 * modify it under the terms of the GNU General Public License as | |
10 * published by the Free Software Foundation, either version 3 of the | |
11 * License, or (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #pragma once | |
24 | |
25 #include "ServerEnumerations.h" | |
4045 | 26 #include "../../OrthancFramework/Sources/IDynamicObject.h" |
27 #include "../../OrthancFramework/Sources/SystemToolbox.h" | |
1198 | 28 |
29 #include <string> | |
1240 | 30 #include <json/value.h> |
1198 | 31 |
32 namespace Orthanc | |
33 { | |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
34 struct ServerIndexChange : public IDynamicObject |
1198 | 35 { |
36 private: | |
1240 | 37 int64_t seq_; |
1198 | 38 ChangeType changeType_; |
39 ResourceType resourceType_; | |
40 std::string publicId_; | |
1240 | 41 std::string date_; |
1198 | 42 |
43 public: | |
44 ServerIndexChange(ChangeType changeType, | |
45 ResourceType resourceType, | |
1240 | 46 const std::string& publicId) : |
47 seq_(-1), | |
1198 | 48 changeType_(changeType), |
49 resourceType_(resourceType), | |
1240 | 50 publicId_(publicId), |
2475
8cc3ca64a534
Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
51 date_(SystemToolbox::GetNowIsoString(true /* use UTC time (not local time) */)) |
1198 | 52 { |
53 } | |
54 | |
1240 | 55 ServerIndexChange(int64_t seq, |
56 ChangeType changeType, | |
57 ResourceType resourceType, | |
58 const std::string& publicId, | |
59 const std::string& date) : | |
60 seq_(seq), | |
61 changeType_(changeType), | |
62 resourceType_(resourceType), | |
63 publicId_(publicId), | |
64 date_(date) | |
65 { | |
66 } | |
67 | |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
68 ServerIndexChange(const ServerIndexChange& other) |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
69 : seq_(other.seq_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
70 changeType_(other.changeType_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
71 resourceType_(other.resourceType_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
72 publicId_(other.publicId_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
73 date_(other.date_) |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
74 { |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
75 } |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
76 |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
77 ServerIndexChange* Clone() const |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
78 { |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
79 return new ServerIndexChange(*this); |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
80 } |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
81 |
1240 | 82 int64_t GetSeq() const |
83 { | |
84 return seq_; | |
85 } | |
86 | |
1198 | 87 ChangeType GetChangeType() const |
88 { | |
89 return changeType_; | |
90 } | |
91 | |
92 ResourceType GetResourceType() const | |
93 { | |
94 return resourceType_; | |
95 } | |
96 | |
97 const std::string& GetPublicId() const | |
98 { | |
99 return publicId_; | |
100 } | |
1240 | 101 |
102 const std::string& GetDate() const | |
103 { | |
104 return date_; | |
105 } | |
106 | |
107 void Format(Json::Value& item) const | |
108 { | |
109 item = Json::objectValue; | |
110 item["Seq"] = static_cast<int>(seq_); | |
111 item["ChangeType"] = EnumerationToString(changeType_); | |
112 item["ResourceType"] = EnumerationToString(resourceType_); | |
113 item["ID"] = publicId_; | |
114 item["Path"] = GetBasePath(resourceType_, publicId_); | |
115 item["Date"] = date_; | |
116 } | |
1198 | 117 }; |
118 } |