comparison Plugins/Engine/OrthancPlugins.cpp @ 1198:1169528a9a5f db-changes

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 Oct 2014 13:52:01 +0200
parents 6b9b02a16e99
children a843ee8bb903
comparison
equal deleted inserted replaced
1197:61b71ccac362 1198:1169528a9a5f
151 151
152 static OrthancPluginChangeType Convert(ChangeType type) 152 static OrthancPluginChangeType Convert(ChangeType type)
153 { 153 {
154 switch (type) 154 switch (type)
155 { 155 {
156 case ChangeType_AnonymizedPatient:
157 return OrthancPluginChangeType_AnonymizedPatient;
158
159 case ChangeType_AnonymizedSeries:
160 return OrthancPluginChangeType_AnonymizedSeries;
161
162 case ChangeType_AnonymizedStudy:
163 return OrthancPluginChangeType_AnonymizedStudy;
164
165 case ChangeType_CompletedSeries: 156 case ChangeType_CompletedSeries:
166 return OrthancPluginChangeType_CompletedSeries; 157 return OrthancPluginChangeType_CompletedSeries;
167 158
168 case ChangeType_Deleted: 159 case ChangeType_Deleted:
169 return OrthancPluginChangeType_Deleted; 160 return OrthancPluginChangeType_Deleted;
170
171 case ChangeType_ModifiedPatient:
172 return OrthancPluginChangeType_ModifiedPatient;
173
174 case ChangeType_ModifiedSeries:
175 return OrthancPluginChangeType_ModifiedSeries;
176
177 case ChangeType_ModifiedStudy:
178 return OrthancPluginChangeType_ModifiedStudy;
179 161
180 case ChangeType_NewChildInstance: 162 case ChangeType_NewChildInstance:
181 return OrthancPluginChangeType_NewChildInstance; 163 return OrthancPluginChangeType_NewChildInstance;
182 164
183 case ChangeType_NewInstance: 165 case ChangeType_NewInstance:
381 } 363 }
382 } 364 }
383 365
384 366
385 367
386 void OrthancPlugins::SignalChange(ChangeType changeType, 368 void OrthancPlugins::SignalChange(const ServerIndexChange& change)
387 ResourceType resourceType,
388 const std::string& publicId)
389 { 369 {
390 OrthancPluginChangeType c; 370 OrthancPluginChangeType c;
391 OrthancPluginResourceType r; 371 OrthancPluginResourceType r;
392 372
393 try 373 try
394 { 374 {
395 c = Convert(changeType); 375 c = Convert(change.GetChangeType());
396 r = Convert(resourceType); 376 r = Convert(change.GetResourceType());
397 } 377 }
398 catch (OrthancException&) 378 catch (OrthancException&)
399 { 379 {
400 // This change type or resource type is not supported by the plugin SDK 380 // This change type or resource type is not supported by the plugin SDK
401 return; 381 return;
405 385
406 for (PImpl::OnChangeCallbacks::const_iterator 386 for (PImpl::OnChangeCallbacks::const_iterator
407 callback = pimpl_->onChangeCallbacks_.begin(); 387 callback = pimpl_->onChangeCallbacks_.begin();
408 callback != pimpl_->onChangeCallbacks_.end(); ++callback) 388 callback != pimpl_->onChangeCallbacks_.end(); ++callback)
409 { 389 {
410 (*callback) (c, r, publicId.c_str()); 390 (*callback) (c, r, change.GetPublicId().c_str());
411 } 391 }
412 } 392 }
413 393
414 394
415 395