comparison OrthancServer/ExportedResource.h @ 1247:32fcc5dc7562

abstraction
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Dec 2014 13:54:27 +0100
parents 54bf0f0245f4
children 6e7e5ed91c2d
comparison
equal deleted inserted replaced
1246:54bf0f0245f4 1247:32fcc5dc7562
38 #include <string> 38 #include <string>
39 #include <json/value.h> 39 #include <json/value.h>
40 40
41 namespace Orthanc 41 namespace Orthanc
42 { 42 {
43 struct ExportedResource 43 class ExportedResource
44 { 44 {
45 private: 45 private:
46 int64_t seq_; 46 int64_t seq_;
47 ResourceType resourceType_; 47 ResourceType resourceType_;
48 std::string publicId_; 48 std::string publicId_;
118 const std::string& GetSopInstanceUid() const 118 const std::string& GetSopInstanceUid() const
119 { 119 {
120 return sopInstanceUid_; 120 return sopInstanceUid_;
121 } 121 }
122 122
123 void Format(Json::Value& item) const 123 void Format(Json::Value& item) const;
124 {
125 item = Json::objectValue;
126 item["Seq"] = static_cast<int>(seq_);
127 item["ResourceType"] = EnumerationToString(resourceType_);
128 item["ID"] = publicId_;
129 item["Path"] = GetBasePath(resourceType_, publicId_);
130 item["RemoteModality"] = modality_;
131 item["Date"] = date_;
132
133 // WARNING: Do not add "break" below and do not reorder the case items!
134 switch (resourceType_)
135 {
136 case ResourceType_Instance:
137 item["SOPInstanceUID"] = sopInstanceUid_;
138
139 case ResourceType_Series:
140 item["SeriesInstanceUID"] = seriesInstanceUid_;
141
142 case ResourceType_Study:
143 item["StudyInstanceUID"] = studyInstanceUid_;
144
145 case ResourceType_Patient:
146 item["PatientID"] = patientId_;
147 break;
148
149 default:
150 throw OrthancException(ErrorCode_InternalError);
151 }
152 }
153 }; 124 };
154 } 125 }