TuttleOFX
1
|
#include <ThreadEnv.hpp>
Public Types | |
typedef ThreadEnv | This |
typedef boost::signals2::signal< void()> | SignalType |
Public Member Functions | |
ThreadEnv (const bool asynchronous=true) | |
memory::MemoryCache & | getImageCache () |
const memory::MemoryCache & | getImageCache () const |
ComputeOptions & | getComputeOptions () |
const ComputeOptions & | getComputeOptions () const |
This & | setAsynchronous (const bool v=true) |
bool | isRunning () |
Main functions. | |
void | compute (Graph &graph, const NodeListArg &nodes=NodeListArg()) |
Launch the graph computation in a synchrone or asynchrone way. | |
void | abort () |
The application would like to abort the process (from another thread). Thread Safe. | |
void | join () |
bool | getResult () const |
Result status of the lastest compute. Thread Safe. | |
SignalType & | getSignalEnd () |
Private Member Functions | |
void | setResult (const bool res) |
Result status of the lastest compute. Thread Safe. | |
void | setIsRunning (const bool res) |
Is this ThreadEnv executing a compute? Thread Safe. | |
Static Private Member Functions | |
static void | runProcessFunc (ThreadEnv *threadEnv, Graph &graph, const std::list< std::string > &nodes) |
Private Attributes | |
boost::thread | _thread |
bool | _asynchronous |
memory::MemoryCache | _imageCache |
ComputeOptions | _options |
boost::atomic_bool | _isRunning |
boost::atomic_bool | _result |
SignalType | _signalEnd |
Utility class to compute a graph inside a thread.
Definition at line 25 of file ThreadEnv.hpp.
typedef boost::signals2::signal<void ()> tuttle::host::ThreadEnv::SignalType |
Definition at line 29 of file ThreadEnv.hpp.
Definition at line 28 of file ThreadEnv.hpp.
tuttle::host::ThreadEnv::ThreadEnv | ( | const bool | asynchronous = true | ) | [inline] |
Definition at line 31 of file ThreadEnv.hpp.
References _options, and tuttle::host::ComputeOptions::setReturnBuffers().
void tuttle::host::ThreadEnv::abort | ( | ) | [inline] |
The application would like to abort the process (from another thread). Thread Safe.
Definition at line 70 of file ThreadEnv.hpp.
References _options, and tuttle::host::ComputeOptions::abort().
Referenced by BOOST_AUTO_TEST_CASE().
void tuttle::host::ThreadEnv::compute | ( | Graph & | graph, |
const NodeListArg & | nodes = NodeListArg() |
||
) |
Launch the graph computation in a synchrone or asynchrone way.
Definition at line 26 of file ThreadEnv.cpp.
References _asynchronous, _imageCache, _options, _thread, tuttle::host::Graph::compute(), tuttle::host::NodeListArg::getNodes(), runProcessFunc(), setIsRunning(), and setResult().
Referenced by BOOST_AUTO_TEST_CASE().
ComputeOptions& tuttle::host::ThreadEnv::getComputeOptions | ( | ) | [inline] |
Definition at line 43 of file ThreadEnv.hpp.
References _options.
Referenced by BOOST_AUTO_TEST_CASE().
const ComputeOptions& tuttle::host::ThreadEnv::getComputeOptions | ( | ) | const [inline] |
Definition at line 44 of file ThreadEnv.hpp.
References _options.
memory::MemoryCache& tuttle::host::ThreadEnv::getImageCache | ( | ) | [inline] |
Definition at line 40 of file ThreadEnv.hpp.
References _imageCache.
const memory::MemoryCache& tuttle::host::ThreadEnv::getImageCache | ( | ) | const [inline] |
Definition at line 41 of file ThreadEnv.hpp.
References _imageCache.
bool tuttle::host::ThreadEnv::getResult | ( | ) | const [inline] |
Result status of the lastest compute. Thread Safe.
Definition at line 78 of file ThreadEnv.hpp.
References _result.
Referenced by BOOST_AUTO_TEST_CASE().
SignalType& tuttle::host::ThreadEnv::getSignalEnd | ( | ) | [inline] |
bool tuttle::host::ThreadEnv::isRunning | ( | ) | [inline] |
Main functions.
Is this ThreadEnv executing a compute? Thread Safe
Definition at line 59 of file ThreadEnv.hpp.
References _isRunning.
void tuttle::host::ThreadEnv::join | ( | ) | [inline] |
Definition at line 72 of file ThreadEnv.hpp.
References _thread.
Referenced by BOOST_AUTO_TEST_CASE().
void tuttle::host::ThreadEnv::runProcessFunc | ( | ThreadEnv * | threadEnv, |
Graph & | graph, | ||
const std::list< std::string > & | nodes | ||
) | [static, private] |
Definition at line 9 of file ThreadEnv.cpp.
References _imageCache, _options, tuttle::host::memory::IMemoryCache::clearUnused(), tuttle::host::Graph::compute(), tuttle::host::core(), tuttle::host::Core::getMemoryCache(), getSignalEnd(), setIsRunning(), setResult(), and TUTTLE_LOG_ERROR.
Referenced by compute().
This& tuttle::host::ThreadEnv::setAsynchronous | ( | const bool | v = true | ) | [inline] |
Definition at line 46 of file ThreadEnv.hpp.
References _asynchronous.
void tuttle::host::ThreadEnv::setIsRunning | ( | const bool | res | ) | [inline, private] |
Is this ThreadEnv executing a compute? Thread Safe.
Definition at line 97 of file ThreadEnv.hpp.
References _isRunning.
Referenced by compute(), and runProcessFunc().
void tuttle::host::ThreadEnv::setResult | ( | const bool | res | ) | [inline, private] |
Result status of the lastest compute. Thread Safe.
Definition at line 91 of file ThreadEnv.hpp.
References _result.
Referenced by compute(), and runProcessFunc().
bool tuttle::host::ThreadEnv::_asynchronous [private] |
Definition at line 102 of file ThreadEnv.hpp.
Referenced by compute(), and setAsynchronous().
Definition at line 103 of file ThreadEnv.hpp.
Referenced by compute(), getImageCache(), and runProcessFunc().
boost::atomic_bool tuttle::host::ThreadEnv::_isRunning [private] |
Definition at line 106 of file ThreadEnv.hpp.
Referenced by isRunning(), and setIsRunning().
Definition at line 104 of file ThreadEnv.hpp.
Referenced by abort(), compute(), getComputeOptions(), runProcessFunc(), and ThreadEnv().
boost::atomic_bool tuttle::host::ThreadEnv::_result [private] |
Definition at line 107 of file ThreadEnv.hpp.
Referenced by getResult(), and setResult().
Definition at line 109 of file ThreadEnv.hpp.
Referenced by getSignalEnd().
boost::thread tuttle::host::ThreadEnv::_thread [private] |
Definition at line 100 of file ThreadEnv.hpp.