# HG changeset patch # User Sebastien Jodogne # Date 1572432970 -3600 # Node ID 79b1b541fe150d9d8a37d52ccc5ec0cc506b672c # Parent 477203923f26d70763beaf1f34471bc2e10fef82 ThreadedOracle::SetRootDirectory() diff -r 477203923f26 -r 79b1b541fe15 Framework/Oracle/ThreadedOracle.cpp --- 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 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; } diff -r 477203923f26 -r 79b1b541fe15 Framework/Oracle/ThreadedOracle.h --- 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);