Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 1588:b5bc87a7212d
OrthancPluginReadFile, OrthancPluginWriteFile
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 26 Aug 2015 16:49:46 +0200 |
parents | 357c4bb15701 |
children | 235d89817b89 |
comparison
equal
deleted
inserted
replaced
1587:d7e569640d09 | 1588:b5bc87a7212d |
---|---|
933 | 933 |
934 | 934 |
935 bool OrthancPlugins::InvokeService(_OrthancPluginService service, | 935 bool OrthancPlugins::InvokeService(_OrthancPluginService service, |
936 const void* parameters) | 936 const void* parameters) |
937 { | 937 { |
938 VLOG(1) << "Calling plugin service: " << service; | |
939 | |
938 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); | 940 boost::recursive_mutex::scoped_lock lock(pimpl_->invokeServiceMutex_); |
939 | 941 |
940 switch (service) | 942 switch (service) |
941 { | 943 { |
942 case _OrthancPluginService_GetOrthancPath: | 944 case _OrthancPluginService_GetOrthancPath: |
1196 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); | 1198 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); |
1197 output->SendMultipartItem(p.answer, p.answerSize); | 1199 output->SendMultipartItem(p.answer, p.answerSize); |
1198 return true; | 1200 return true; |
1199 } | 1201 } |
1200 | 1202 |
1203 case _OrthancPluginService_ReadFile: | |
1204 { | |
1205 const _OrthancPluginReadFile& p = | |
1206 *reinterpret_cast<const _OrthancPluginReadFile*>(parameters); | |
1207 | |
1208 std::string content; | |
1209 Toolbox::ReadFile(content, p.path); | |
1210 CopyToMemoryBuffer(*p.target, content.size() > 0 ? content.c_str() : NULL, content.size()); | |
1211 | |
1212 return true; | |
1213 } | |
1214 | |
1215 case _OrthancPluginService_WriteFile: | |
1216 { | |
1217 const _OrthancPluginWriteFile& p = | |
1218 *reinterpret_cast<const _OrthancPluginWriteFile*>(parameters); | |
1219 Toolbox::WriteFile(p.data, p.size, p.path); | |
1220 return true; | |
1221 } | |
1222 | |
1201 default: | 1223 default: |
1202 // This service is unknown by the Orthanc plugin engine | 1224 // This service is unknown by the Orthanc plugin engine |
1203 return false; | 1225 return false; |
1204 } | 1226 } |
1205 } | 1227 } |