Mercurial > hg > orthanc
diff Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 2059:8e67325eaa3f
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 30 Jun 2016 20:02:21 +0200 |
parents | 43cd2ab060c7 |
children | 40ffd0e8676a |
line wrap: on
line diff
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Thu Jun 30 08:20:23 2016 +0200 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Thu Jun 30 20:02:21 2016 +0200 @@ -51,6 +51,15 @@ } } + + void PluginException::Check(OrthancPluginErrorCode code) + { + if (code != OrthancPluginErrorCode_Success) + { + throw PluginException(code); + } + } + MemoryBuffer::MemoryBuffer(OrthancPluginContext* context) : context_(context) @@ -233,6 +242,18 @@ } + void MemoryBuffer::CreateDicom(const Json::Value& tags, + OrthancPluginCreateDicomFlags flags) + { + Clear(); + + Json::FastWriter writer; + std::string s = writer.write(tags); + + PluginException::Check(OrthancPluginCreateDicom(context_, &buffer_, s.c_str(), NULL, flags)); + } + + OrthancString::OrthancString(OrthancPluginContext* context, char* str) : context_(context),