Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 1314:01be1432bda9
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 11 Feb 2015 12:33:07 +0100 |
parents | 8f4487d8f79e |
children | 0ac74fa21db8 |
comparison
equal
deleted
inserted
replaced
1313:28582ec2a68c | 1314:01be1432bda9 |
---|---|
117 target.clear(); | 117 target.clear(); |
118 | 118 |
119 if (type_ == _OrthancPluginDatabaseAnswerType_Int64) | 119 if (type_ == _OrthancPluginDatabaseAnswerType_Int64) |
120 { | 120 { |
121 for (std::list<int64_t>::const_iterator | 121 for (std::list<int64_t>::const_iterator |
122 it = answerInt64_.begin(); it != answerInt64_.end(); it++) | 122 it = answerInt64_.begin(); it != answerInt64_.end(); ++it) |
123 { | 123 { |
124 target.push_back(*it); | 124 target.push_back(*it); |
125 } | 125 } |
126 } | 126 } |
127 } | 127 } |
138 target.clear(); | 138 target.clear(); |
139 | 139 |
140 if (type_ == _OrthancPluginDatabaseAnswerType_String) | 140 if (type_ == _OrthancPluginDatabaseAnswerType_String) |
141 { | 141 { |
142 for (std::list<std::string>::const_iterator | 142 for (std::list<std::string>::const_iterator |
143 it = answerStrings_.begin(); it != answerStrings_.end(); it++) | 143 it = answerStrings_.begin(); it != answerStrings_.end(); ++it) |
144 { | 144 { |
145 target.push_back(*it); | 145 target.push_back(*it); |
146 } | 146 } |
147 } | 147 } |
148 } | 148 } |
181 } | 181 } |
182 else | 182 else |
183 { | 183 { |
184 throw OrthancException(ErrorCode_Plugin); | 184 throw OrthancException(ErrorCode_Plugin); |
185 } | 185 } |
186 } | |
187 | |
188 | |
189 OrthancPluginDatabase::OrthancPluginDatabase(const OrthancPluginDatabaseBackend& backend, | |
190 void *payload) : | |
191 type_(_OrthancPluginDatabaseAnswerType_None), | |
192 backend_(backend), | |
193 payload_(payload), | |
194 listener_(NULL), | |
195 answerDicomMap_(NULL), | |
196 answerChanges_(NULL), | |
197 answerExportedResources_(NULL), | |
198 answerDone_(NULL) | |
199 { | |
186 } | 200 } |
187 | 201 |
188 | 202 |
189 void OrthancPluginDatabase::AddAttachment(int64_t id, | 203 void OrthancPluginDatabase::AddAttachment(int64_t id, |
190 const FileInfo& attachment) | 204 const FileInfo& attachment) |
283 ListAvailableMetadata(metadata, id); | 297 ListAvailableMetadata(metadata, id); |
284 | 298 |
285 target.clear(); | 299 target.clear(); |
286 | 300 |
287 for (std::list<MetadataType>::const_iterator | 301 for (std::list<MetadataType>::const_iterator |
288 it = metadata.begin(); it != metadata.end(); it++) | 302 it = metadata.begin(); it != metadata.end(); ++it) |
289 { | 303 { |
290 std::string value; | 304 std::string value; |
291 if (!LookupMetadata(value, id, *it)) | 305 if (!LookupMetadata(value, id, *it)) |
292 { | 306 { |
293 throw OrthancException(ErrorCode_Plugin); | 307 throw OrthancException(ErrorCode_Plugin); |
530 target.clear(); | 544 target.clear(); |
531 | 545 |
532 if (type_ == _OrthancPluginDatabaseAnswerType_Int32) | 546 if (type_ == _OrthancPluginDatabaseAnswerType_Int32) |
533 { | 547 { |
534 for (std::list<int32_t>::const_iterator | 548 for (std::list<int32_t>::const_iterator |
535 it = answerInt32_.begin(); it != answerInt32_.end(); it++) | 549 it = answerInt32_.begin(); it != answerInt32_.end(); ++it) |
536 { | 550 { |
537 target.push_back(static_cast<MetadataType>(*it)); | 551 target.push_back(static_cast<MetadataType>(*it)); |
538 } | 552 } |
539 } | 553 } |
540 } | 554 } |
559 target.clear(); | 573 target.clear(); |
560 | 574 |
561 if (type_ == _OrthancPluginDatabaseAnswerType_Int32) | 575 if (type_ == _OrthancPluginDatabaseAnswerType_Int32) |
562 { | 576 { |
563 for (std::list<int32_t>::const_iterator | 577 for (std::list<int32_t>::const_iterator |
564 it = answerInt32_.begin(); it != answerInt32_.end(); it++) | 578 it = answerInt32_.begin(); it != answerInt32_.end(); ++it) |
565 { | 579 { |
566 target.push_back(static_cast<FileContentType>(*it)); | 580 target.push_back(static_cast<FileContentType>(*it)); |
567 } | 581 } |
568 } | 582 } |
569 } | 583 } |