comparison OrthancServer/Plugins/Engine/OrthancPlugins.cpp @ 4919:676e03e69703

added origin in OrthancPluginReceivedInstanceCallback
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Feb 2022 09:30:42 +0100
parents 189ae9a37e01
children 309fb4f02704
comparison
equal deleted inserted replaced
4917:95378de340d4 4919:676e03e69703
396 FileContentType type) ORTHANC_OVERRIDE 396 FileContentType type) ORTHANC_OVERRIDE
397 { 397 {
398 std::unique_ptr<MallocMemoryBuffer> result(new MallocMemoryBuffer); 398 std::unique_ptr<MallocMemoryBuffer> result(new MallocMemoryBuffer);
399 399
400 OrthancPluginMemoryBuffer64 buffer; 400 OrthancPluginMemoryBuffer64 buffer;
401 buffer.size = 0;
402 buffer.data = NULL;
401 403
402 OrthancPluginErrorCode error = readWhole_(&buffer, uuid.c_str(), Plugins::Convert(type)); 404 OrthancPluginErrorCode error = readWhole_(&buffer, uuid.c_str(), Plugins::Convert(type));
403 405
404 if (error == OrthancPluginErrorCode_Success) 406 if (error == OrthancPluginErrorCode_Success)
405 { 407 {
1712 sizeof(int32_t) != sizeof(OrthancPluginJobStepStatus) || 1714 sizeof(int32_t) != sizeof(OrthancPluginJobStepStatus) ||
1713 sizeof(int32_t) != sizeof(OrthancPluginConstraintType) || 1715 sizeof(int32_t) != sizeof(OrthancPluginConstraintType) ||
1714 sizeof(int32_t) != sizeof(OrthancPluginMetricsType) || 1716 sizeof(int32_t) != sizeof(OrthancPluginMetricsType) ||
1715 sizeof(int32_t) != sizeof(OrthancPluginDicomWebBinaryMode) || 1717 sizeof(int32_t) != sizeof(OrthancPluginDicomWebBinaryMode) ||
1716 sizeof(int32_t) != sizeof(OrthancPluginStorageCommitmentFailureReason) || 1718 sizeof(int32_t) != sizeof(OrthancPluginStorageCommitmentFailureReason) ||
1719 sizeof(int32_t) != sizeof(OrthancPluginReceivedInstanceAction) ||
1717 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeBinary) != static_cast<int>(DicomToJsonFlags_IncludeBinary) || 1720 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeBinary) != static_cast<int>(DicomToJsonFlags_IncludeBinary) ||
1718 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePrivateTags) != static_cast<int>(DicomToJsonFlags_IncludePrivateTags) || 1721 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePrivateTags) != static_cast<int>(DicomToJsonFlags_IncludePrivateTags) ||
1719 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeUnknownTags) != static_cast<int>(DicomToJsonFlags_IncludeUnknownTags) || 1722 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludeUnknownTags) != static_cast<int>(DicomToJsonFlags_IncludeUnknownTags) ||
1720 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePixelData) != static_cast<int>(DicomToJsonFlags_IncludePixelData) || 1723 static_cast<int>(OrthancPluginDicomToJsonFlags_IncludePixelData) != static_cast<int>(DicomToJsonFlags_IncludePixelData) ||
1721 static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToNull) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToNull) || 1724 static_cast<int>(OrthancPluginDicomToJsonFlags_ConvertBinaryToNull) != static_cast<int>(DicomToJsonFlags_ConvertBinaryToNull) ||
2283 2286
2284 return STATUS_Success; 2287 return STATUS_Success;
2285 } 2288 }
2286 2289
2287 2290
2288 OrthancPluginReceivedInstanceCallbackResult OrthancPlugins::ApplyReceivedInstanceCallbacks( 2291 OrthancPluginReceivedInstanceAction OrthancPlugins::ApplyReceivedInstanceCallbacks(
2289 MallocMemoryBuffer& modified, 2292 MallocMemoryBuffer& modified,
2290 const void* receivedDicom, 2293 const void* receivedDicom,
2291 size_t receivedDicomSize) 2294 size_t receivedDicomSize,
2295 RequestOrigin origin)
2292 { 2296 {
2293 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); 2297 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_);
2294 2298
2295 if (pimpl_->receivedInstanceCallback_ == NULL) 2299 if (pimpl_->receivedInstanceCallback_ == NULL)
2296 { 2300 {
2297 return OrthancPluginReceivedInstanceCallbackResult_KeepAsIs; 2301 return OrthancPluginReceivedInstanceAction_KeepAsIs;
2298 } 2302 }
2299 else 2303 else
2300 { 2304 {
2301 OrthancPluginReceivedInstanceCallbackResult callbackResult; 2305 OrthancPluginReceivedInstanceAction action;
2302 2306
2303 { 2307 {
2304 OrthancPluginMemoryBuffer64 buffer; 2308 OrthancPluginMemoryBuffer64 buffer;
2305 callbackResult = (*pimpl_->receivedInstanceCallback_) (&buffer, receivedDicom, receivedDicomSize); 2309 buffer.size = 0;
2310 buffer.data = NULL;
2311
2312 action = (*pimpl_->receivedInstanceCallback_) (&buffer, receivedDicom, receivedDicomSize, Plugins::Convert(origin));
2306 modified.Assign(buffer.data, buffer.size, ::free); 2313 modified.Assign(buffer.data, buffer.size, ::free);
2307 } 2314 }
2308 2315
2309 return callbackResult; 2316 return action;
2310 } 2317 }
2311 } 2318 }
2312 2319
2313 void OrthancPlugins::SignalChangeInternal(OrthancPluginChangeType changeType, 2320 void OrthancPlugins::SignalChangeInternal(OrthancPluginChangeType changeType,
2314 OrthancPluginResourceType resourceType, 2321 OrthancPluginResourceType resourceType,