Mercurial > hg > orthanc
comparison OrthancServer/ServerIndex.h @ 202:1650557bd81a
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 27 Nov 2012 17:48:37 +0100 |
parents | bee20e978835 |
children | 7f4acf490179 |
comparison
equal
deleted
inserted
replaced
201:bee20e978835 | 202:1650557bd81a |
---|---|
44 | 44 |
45 namespace Orthanc | 45 namespace Orthanc |
46 { | 46 { |
47 namespace Internals | 47 namespace Internals |
48 { | 48 { |
49 class SignalDeletedLevelFunction; | 49 class ServerIndexListener; |
50 class ServerIndexListenerTodo; | |
51 } | 50 } |
52 | 51 |
53 | 52 |
54 class ServerIndex | 53 class ServerIndex |
55 { | 54 { |
56 private: | 55 private: |
57 SQLite::Connection db_; | |
58 boost::mutex mutex_; | 56 boost::mutex mutex_; |
59 | 57 |
60 std::auto_ptr<Internals::ServerIndexListenerTodo> listener2_; | 58 std::auto_ptr<Internals::ServerIndexListener> listener_; |
61 std::auto_ptr<DatabaseWrapper> db2_; | 59 std::auto_ptr<DatabaseWrapper> db_; |
62 | 60 |
63 // DO NOT delete the following one, SQLite::Connection will do it automatically | 61 void MainDicomTagsToJson(Json::Value& result, |
64 Internals::SignalDeletedLevelFunction* deletedLevels_; | 62 int64_t resourceId); |
65 | |
66 void StoreMainDicomTags(const std::string& uuid, | |
67 const DicomMap& map); | |
68 | |
69 bool HasPatient(DicomInstanceHasher& hasher); | |
70 | |
71 void CreatePatient(DicomInstanceHasher& hasher, | |
72 const DicomMap& dicomSummary); | |
73 | |
74 bool HasStudy(DicomInstanceHasher& hasher); | |
75 | |
76 void CreateStudy(DicomInstanceHasher& hasher, | |
77 const DicomMap& dicomSummary); | |
78 | |
79 bool HasSeries(DicomInstanceHasher& hasher); | |
80 | |
81 void CreateSeries(DicomInstanceHasher& hasher, | |
82 const DicomMap& dicomSummary); | |
83 | |
84 bool HasInstance(DicomInstanceHasher& hasher); | |
85 | |
86 void CreateInstance(DicomInstanceHasher& hasher, | |
87 const DicomMap& dicomSummary, | |
88 const std::string& fileUuid, | |
89 uint64_t fileSize, | |
90 const std::string& jsonUuid, | |
91 const std::string& remoteAet); | |
92 | |
93 void RecordChange(const std::string& resourceType, | |
94 const std::string& uuid); | |
95 | |
96 void RemoveInstance(const std::string& uuid); | |
97 | |
98 void MainDicomTagsToJson2(Json::Value& result, | |
99 int64_t resourceId); | |
100 | 63 |
101 bool DeleteInternal(Json::Value& target, | 64 bool DeleteInternal(Json::Value& target, |
102 const std::string& uuid, | 65 const std::string& uuid, |
103 const std::string& tableName); | 66 ResourceType expectedType); |
104 | |
105 StoreStatus Store2(const DicomMap& dicomSummary, | |
106 const std::string& fileUuid, | |
107 uint64_t uncompressedFileSize, | |
108 const std::string& jsonUuid, | |
109 const std::string& remoteAet); | |
110 | 67 |
111 bool LookupResource(Json::Value& result, | 68 bool LookupResource(Json::Value& result, |
112 const std::string& publicId, | 69 const std::string& publicId, |
113 ResourceType expectedType); | 70 ResourceType expectedType); |
114 | 71 |
170 ResourceType resourceType); | 127 ResourceType resourceType); |
171 | 128 |
172 bool DeletePatient(Json::Value& target, | 129 bool DeletePatient(Json::Value& target, |
173 const std::string& patientUuid) | 130 const std::string& patientUuid) |
174 { | 131 { |
175 return DeleteInternal(target, patientUuid, "Patients"); | 132 return DeleteInternal(target, patientUuid, ResourceType_Patient); |
176 } | 133 } |
177 | 134 |
178 bool DeleteStudy(Json::Value& target, | 135 bool DeleteStudy(Json::Value& target, |
179 const std::string& studyUuid) | 136 const std::string& studyUuid) |
180 { | 137 { |
181 return DeleteInternal(target, studyUuid, "Studies"); | 138 return DeleteInternal(target, studyUuid, ResourceType_Study); |
182 } | 139 } |
183 | 140 |
184 bool DeleteSeries(Json::Value& target, | 141 bool DeleteSeries(Json::Value& target, |
185 const std::string& seriesUuid) | 142 const std::string& seriesUuid) |
186 { | 143 { |
187 return DeleteInternal(target, seriesUuid, "Series"); | 144 return DeleteInternal(target, seriesUuid, ResourceType_Series); |
188 } | 145 } |
189 | 146 |
190 bool DeleteInstance(Json::Value& target, | 147 bool DeleteInstance(Json::Value& target, |
191 const std::string& instanceUuid) | 148 const std::string& instanceUuid) |
192 { | 149 { |
193 return DeleteInternal(target, instanceUuid, "Instances"); | 150 return DeleteInternal(target, instanceUuid, ResourceType_Instance); |
194 } | 151 } |
195 | 152 |
196 bool GetChanges(Json::Value& target, | 153 bool GetChanges(Json::Value& target, |
197 int64_t since, | 154 int64_t since, |
198 const std::string& filter, | 155 const std::string& filter, |