Mercurial > hg > orthanc-stone
changeset 1109:79b1b541fe15 broker
ThreadedOracle::SetRootDirectory()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Oct 2019 11:56:10 +0100 |
parents | 477203923f26 |
children | b82b74d13830 |
files | Framework/Oracle/ThreadedOracle.cpp Framework/Oracle/ThreadedOracle.h |
diffstat | 2 files changed, 18 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Oracle/ThreadedOracle.cpp Wed Oct 30 10:23:12 2019 +0100 +++ b/Framework/Oracle/ThreadedOracle.cpp Wed Oct 30 11:56:10 2019 +0100 @@ -176,7 +176,13 @@ else { GenericOracleRunner runner; - runner.SetOrthanc(orthanc_); + + { + boost::mutex::scoped_lock lock(mutex_); + runner.SetOrthanc(orthanc_); + runner.SetRootDirectory(rootDirectory_); + } + std::auto_ptr<IMessage> message(runner.Run(item.GetCommand())); emitter_.EmitMessage(item.GetReceiver(), *message); @@ -263,6 +269,7 @@ ThreadedOracle::ThreadedOracle(IMessageEmitter& emitter) : emitter_(emitter), + rootDirectory_("."), state_(State_Setup), workers_(4), sleepingCommands_(new SleepingCommands), @@ -297,16 +304,14 @@ void ThreadedOracle::SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc) { boost::mutex::scoped_lock lock(mutex_); + orthanc_ = orthanc; + } - if (state_ != State_Setup) - { - LOG(ERROR) << "ThreadedOracle::SetOrthancParameters(): (state_ != State_Setup)"; - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); - } - else - { - orthanc_ = orthanc; - } + + void ThreadedOracle::SetRootDirectory(const std::string& rootDirectory) + { + boost::mutex::scoped_lock lock(mutex_); + rootDirectory_ = rootDirectory; }
--- a/Framework/Oracle/ThreadedOracle.h Wed Oct 30 10:23:12 2019 +0100 +++ b/Framework/Oracle/ThreadedOracle.h Wed Oct 30 11:56:10 2019 +0100 @@ -53,6 +53,7 @@ IMessageEmitter& emitter_; Orthanc::WebServiceParameters orthanc_; + std::string rootDirectory_; Orthanc::SharedMessageQueue queue_; State state_; boost::mutex mutex_; @@ -76,6 +77,8 @@ void SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc); + void SetRootDirectory(const std::string& rootDirectory); + void SetThreadsCount(unsigned int count); void SetSleepingTimeResolution(unsigned int milliseconds);