Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 1741:06addfcd1d4c
OrthancStarted and OrthancStopped events in plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 23 Oct 2015 16:49:17 +0200 |
parents | 5e99a70b0635 |
children | 2dd5c6b0380b |
comparison
equal
deleted
inserted
replaced
1740:5e99a70b0635 | 1741:06addfcd1d4c |
---|---|
512 } | 512 } |
513 } | 513 } |
514 | 514 |
515 | 515 |
516 | 516 |
517 void OrthancPlugins::SignalChange(const ServerIndexChange& change) | 517 void OrthancPlugins::SignalChangeInternal(OrthancPluginChangeType changeType, |
518 OrthancPluginResourceType resourceType, | |
519 const char* resource) | |
518 { | 520 { |
519 boost::recursive_mutex::scoped_lock lock(pimpl_->changeCallbackMutex_); | 521 boost::recursive_mutex::scoped_lock lock(pimpl_->changeCallbackMutex_); |
520 | 522 |
521 for (std::list<OrthancPluginOnChangeCallback>::const_iterator | 523 for (std::list<OrthancPluginOnChangeCallback>::const_iterator |
522 callback = pimpl_->onChangeCallbacks_.begin(); | 524 callback = pimpl_->onChangeCallbacks_.begin(); |
523 callback != pimpl_->onChangeCallbacks_.end(); ++callback) | 525 callback != pimpl_->onChangeCallbacks_.end(); ++callback) |
524 { | 526 { |
525 OrthancPluginErrorCode error = (*callback) | 527 OrthancPluginErrorCode error = (*callback) (changeType, resourceType, resource); |
526 (Plugins::Convert(change.GetChangeType()), | |
527 Plugins::Convert(change.GetResourceType()), | |
528 change.GetPublicId().c_str()); | |
529 | 528 |
530 if (error != OrthancPluginErrorCode_Success) | 529 if (error != OrthancPluginErrorCode_Success) |
531 { | 530 { |
532 GetErrorDictionary().LogError(error, true); | 531 GetErrorDictionary().LogError(error, true); |
533 throw OrthancException(static_cast<ErrorCode>(error)); | 532 throw OrthancException(static_cast<ErrorCode>(error)); |
534 } | 533 } |
535 } | 534 } |
535 } | |
536 | |
537 | |
538 | |
539 void OrthancPlugins::SignalChange(const ServerIndexChange& change) | |
540 { | |
541 SignalChangeInternal(Plugins::Convert(change.GetChangeType()), | |
542 Plugins::Convert(change.GetResourceType()), | |
543 change.GetPublicId().c_str()); | |
536 } | 544 } |
537 | 545 |
538 | 546 |
539 | 547 |
540 static void CopyToMemoryBuffer(OrthancPluginMemoryBuffer& target, | 548 static void CopyToMemoryBuffer(OrthancPluginMemoryBuffer& target, |
1256 if (p.instanceId == NULL) | 1264 if (p.instanceId == NULL) |
1257 { | 1265 { |
1258 throw OrthancException(ErrorCode_ParameterOutOfRange); | 1266 throw OrthancException(ErrorCode_ParameterOutOfRange); |
1259 } | 1267 } |
1260 | 1268 |
1269 printf("ICI %s\n", p.instanceId); | |
1270 | |
1261 std::string content; | 1271 std::string content; |
1262 pimpl_->context_->ReadFile(content, p.instanceId, FileContentType_Dicom); | 1272 pimpl_->context_->ReadFile(content, p.instanceId, FileContentType_Dicom); |
1263 dicom.reset(new ParsedDicomFile(content)); | 1273 dicom.reset(new ParsedDicomFile(content)); |
1264 } | 1274 } |
1265 | 1275 |