Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 1771:8790488ae98b
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Nov 2015 17:18:42 +0100 |
parents | 70f544f9c38f |
children | 94990da8710e |
comparison
equal
deleted
inserted
replaced
1770:6473e4e22d44 | 1771:8790488ae98b |
---|---|
1279 Json::FastWriter writer; | 1279 Json::FastWriter writer; |
1280 *p.result = CopyString(writer.write(json)); | 1280 *p.result = CopyString(writer.write(json)); |
1281 } | 1281 } |
1282 | 1282 |
1283 | 1283 |
1284 void OrthancPlugins::DatabaseAnswer(const void* parameters) | |
1285 { | |
1286 const _OrthancPluginDatabaseAnswer& p = | |
1287 *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); | |
1288 | |
1289 if (pimpl_->database_.get() != NULL) | |
1290 { | |
1291 pimpl_->database_->AnswerReceived(p); | |
1292 } | |
1293 else | |
1294 { | |
1295 LOG(ERROR) << "Cannot invoke this service without a custom database back-end"; | |
1296 throw OrthancException(ErrorCode_BadRequest); | |
1297 } | |
1298 } | |
1299 | |
1300 | |
1284 bool OrthancPlugins::InvokeService(SharedLibrary& plugin, | 1301 bool OrthancPlugins::InvokeService(SharedLibrary& plugin, |
1285 _OrthancPluginService service, | 1302 _OrthancPluginService service, |
1286 const void* parameters) | 1303 const void* parameters) |
1287 { | 1304 { |
1288 VLOG(1) << "Calling service " << service << " from plugin " << plugin.GetPath(); | 1305 VLOG(1) << "Calling service " << service << " from plugin " << plugin.GetPath(); |
1293 // on 2015-10-27 that was present in versions of Orthanc <= | 1310 // on 2015-10-27 that was present in versions of Orthanc <= |
1294 // 0.9.4 and related to database plugins implementing a custom | 1311 // 0.9.4 and related to database plugins implementing a custom |
1295 // index. The problem was that locking the database is already | 1312 // index. The problem was that locking the database is already |
1296 // ensured by the "ServerIndex" class if the invoked service is | 1313 // ensured by the "ServerIndex" class if the invoked service is |
1297 // "DatabaseAnswer". | 1314 // "DatabaseAnswer". |
1298 | 1315 DatabaseAnswer(parameters); |
1299 const _OrthancPluginDatabaseAnswer& p = | 1316 return true; |
1300 *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); | |
1301 | |
1302 if (pimpl_->database_.get() != NULL) | |
1303 { | |
1304 pimpl_->database_->AnswerReceived(p); | |
1305 return true; | |
1306 } | |
1307 else | |
1308 { | |
1309 LOG(ERROR) << "Cannot invoke this service without a custom database back-end"; | |
1310 throw OrthancException(ErrorCode_BadRequest); | |
1311 } | |
1312 } | 1317 } |
1313 | 1318 |
1314 | 1319 |
1315 std::auto_ptr<boost::recursive_mutex::scoped_lock> lock; // (*) | 1320 std::auto_ptr<boost::recursive_mutex::scoped_lock> lock; // (*) |
1316 | 1321 |