Mercurial > hg > orthanc
changeset 2278:fd5869e3ed5e
new constructors in FullOrthancDataset
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 17 May 2017 22:05:34 +0200 |
parents | b85f68a98474 |
children | 16e45af17a4d |
files | Plugins/Samples/Common/FullOrthancDataset.cpp Plugins/Samples/Common/FullOrthancDataset.h Plugins/Samples/Common/IOrthancConnection.cpp Plugins/Samples/Common/IOrthancConnection.h |
diffstat | 4 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Samples/Common/FullOrthancDataset.cpp Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/FullOrthancDataset.cpp Wed May 17 22:05:34 2017 +0200 @@ -166,6 +166,14 @@ } + FullOrthancDataset::FullOrthancDataset(const void* content, + size_t size) + { + IOrthancConnection::ParseJson(root_, content, size); + CheckRoot(); + } + + bool FullOrthancDataset::GetStringValue(std::string& result, const DicomPath& path) const {
--- a/Plugins/Samples/Common/FullOrthancDataset.h Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/FullOrthancDataset.h Wed May 17 22:05:34 2017 +0200 @@ -55,6 +55,9 @@ FullOrthancDataset(const std::string& content); + FullOrthancDataset(const void* content, + size_t size); + virtual bool GetStringValue(std::string& result, const DicomPath& path) const;
--- a/Plugins/Samples/Common/IOrthancConnection.cpp Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/IOrthancConnection.cpp Wed May 17 22:05:34 2017 +0200 @@ -51,6 +51,20 @@ } + void IOrthancConnection::ParseJson(Json::Value& result, + const void* content, + size_t size) + { + Json::Reader reader; + + if (!reader.parse(reinterpret_cast<const char*>(content), + reinterpret_cast<const char*>(content) + size, result)) + { + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); + } + } + + void IOrthancConnection::RestApiGet(Json::Value& result, IOrthancConnection& orthanc, const std::string& uri)
--- a/Plugins/Samples/Common/IOrthancConnection.h Wed Apr 12 18:01:04 2017 +0200 +++ b/Plugins/Samples/Common/IOrthancConnection.h Wed May 17 22:05:34 2017 +0200 @@ -64,6 +64,10 @@ static void ParseJson(Json::Value& result, const std::string& content); + static void ParseJson(Json::Value& result, + const void* content, + size_t size); + static void RestApiGet(Json::Value& result, IOrthancConnection& orthanc, const std::string& uri);