Mercurial > hg > orthanc-databases
comparison Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp @ 454:f4244c7e2725 improve-delete
merge pg-transactions -> improve-delete
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 22 Jan 2024 10:00:28 +0100 |
parents | c1b0f3c4e1f5 |
children | ecd0b719cff5 |
comparison
equal
deleted
inserted
replaced
424:95c413106a66 | 454:f4244c7e2725 |
---|---|
77 { | 77 { |
78 ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls); | 78 ORTHANC_PLUGINS_THROW_EXCEPTION(BadSequenceOfCalls); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 void ResetGlobalContext() | |
83 { | |
84 globalContext_ = NULL; | |
85 } | |
82 | 86 |
83 bool HasGlobalContext() | 87 bool HasGlobalContext() |
84 { | 88 { |
85 return globalContext_ != NULL; | 89 return globalContext_ != NULL; |
86 } | 90 } |
1668 { | 1672 { |
1669 // Assume compatibility with the mainline | 1673 // Assume compatibility with the mainline |
1670 return true; | 1674 return true; |
1671 } | 1675 } |
1672 | 1676 |
1677 #ifdef _MSC_VER | |
1678 #define ORTHANC_SCANF sscanf_s | |
1679 #else | |
1680 #define ORTHANC_SCANF sscanf | |
1681 #endif | |
1682 | |
1673 // Parse the version | 1683 // Parse the version |
1674 int aa, bb, cc; | 1684 int aa, bb, cc = 0; |
1675 if ( | 1685 if ((ORTHANC_SCANF(version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 && |
1676 #ifdef _MSC_VER | 1686 ORTHANC_SCANF(version, "%4d.%4d", &aa, &bb) != 2) || |
1677 sscanf_s | |
1678 #else | |
1679 sscanf | |
1680 #endif | |
1681 (version, "%4d.%4d.%4d", &aa, &bb, &cc) != 3 || | |
1682 aa < 0 || | 1687 aa < 0 || |
1683 bb < 0 || | 1688 bb < 0 || |
1684 cc < 0) | 1689 cc < 0) |
1685 { | 1690 { |
1686 return false; | 1691 return false; |
3735 size_t size, | 3740 size_t size, |
3736 const std::string& transferSyntax) | 3741 const std::string& transferSyntax) |
3737 { | 3742 { |
3738 OrthancPluginDicomInstance* instance = OrthancPluginTranscodeDicomInstance( | 3743 OrthancPluginDicomInstance* instance = OrthancPluginTranscodeDicomInstance( |
3739 GetGlobalContext(), buffer, size, transferSyntax.c_str()); | 3744 GetGlobalContext(), buffer, size, transferSyntax.c_str()); |
3745 | |
3746 if (instance == NULL) | |
3747 { | |
3748 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin); | |
3749 } | |
3750 else | |
3751 { | |
3752 boost::movelib::unique_ptr<DicomInstance> result(new DicomInstance(instance)); | |
3753 result->toFree_ = true; | |
3754 return result.release(); | |
3755 } | |
3756 } | |
3757 #endif | |
3758 | |
3759 | |
3760 #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 1) | |
3761 DicomInstance* DicomInstance::Load(const std::string& instanceId, | |
3762 OrthancPluginLoadDicomInstanceMode mode) | |
3763 { | |
3764 OrthancPluginDicomInstance* instance = OrthancPluginLoadDicomInstance( | |
3765 GetGlobalContext(), instanceId.c_str(), mode); | |
3740 | 3766 |
3741 if (instance == NULL) | 3767 if (instance == NULL) |
3742 { | 3768 { |
3743 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin); | 3769 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin); |
3744 } | 3770 } |