OpenWalnut
1.5.0dev
|
Class for loading many datasets. More...
#include <WBatchLoader.h>
Public Types | |
typedef std::shared_ptr< WBatchLoader > | SPtr |
Shared ptr abbreviation. More... | |
typedef std::shared_ptr< const WBatchLoader > | ConstSPtr |
Const shared ptr abbreviation. More... | |
typedef WSharedSequenceContainer< std::vector< WDataModule::SPtr > > | DataModuleList |
The type is used to store the list of data modules. More... | |
Public Types inherited from WThreadedRunner | |
typedef std::shared_ptr< WThreadedRunner > | SPtr |
Abbreviation to a shared_ptr to this type. More... | |
typedef std::shared_ptr< const WThreadedRunner > | ConstSPtr |
Abbreviation to a const shared_ptr to this type. More... | |
typedef boost::function< void(void) > | THREADFUNCTION |
Type used for simple thread functions. More... | |
Public Member Functions | |
WBatchLoader (std::vector< std::string > filenames, std::shared_ptr< WModuleContainer > targetContainer) | |
Initializes the batchloader but does not start it. More... | |
virtual | ~WBatchLoader () |
Destructor. More... | |
virtual void | run () |
Run thread and load the data. More... | |
DataModuleList::ReadTicket | getDataModuleList () const |
Returns a ticket to the list of data modules that have been added so far. More... | |
void | setSuppressColormaps (bool suppress=true) |
Allows suppression of colormap registration in data modules. More... | |
bool | getSuppressColormaps () const |
Checks whether suppression of colormaps is active. More... | |
Public Member Functions inherited from WThreadedRunner | |
WThreadedRunner () | |
Default constructor. More... | |
virtual | ~WThreadedRunner () |
Destructor. More... | |
void | run (THREADFUNCTION f) |
Run thread. More... | |
void | wait (bool requestFinish=false) |
Wait for the thread to be finished. More... | |
virtual void | requestStop () |
This method's purpose is to request a stop without waiting for it. More... | |
virtual boost::signals2::connection | subscribeSignal (THREAD_SIGNAL signal, t_ThreadErrorSignalHandlerType notifier) |
Connects a specified notify function with a signal this thread instance is offering. More... | |
const WBoolFlag & | isCrashed () const |
Checks whether this thread has been crashed. More... | |
const std::string & | getCrashMessage () const |
Get the message of the exception finally causing the crash. More... | |
void | setThreadName (std::string name) |
Set the name of the thread. More... | |
std::string | getThreadName () const |
Returns the current thread name. More... | |
Protected Member Functions | |
virtual void | threadMain () |
Function that has to be overwritten for execution. More... | |
Protected Member Functions inherited from WThreadedRunner | |
virtual void | notifyStop () |
Gets called when the thread should be stopped. More... | |
void | yield () const |
Give remaining execution timeslice to another thread. More... | |
void | sleep (const int32_t t) const |
Sets thread asleep. More... | |
void | msleep (const int32_t t) const |
Sets thread asleep. More... | |
void | waitForStop () |
Let the thread sleep until a stop request was given. More... | |
virtual void | onThreadException (const WException &e) |
This method is called if an exception was caught, which came from the custom thread code. More... | |
void | handleDeadlyException (const WException &e, std::string sender="WThreadedRunner") |
Handle the specified exception which was not caught in the thread, which basically means the thread has crashed. More... | |
Protected Attributes | |
std::vector< std::string > | m_filenamesToLoad |
List of files to load. More... | |
std::shared_ptr< WModuleContainer > | m_targetContainer |
The container which later will contain the loaded datasets. More... | |
DataModuleList | m_dataModules |
The list of modules that have been added. More... | |
bool | m_suppressColormaps |
If true, data modules are instructed to suppress colormap registration. More... | |
Protected Attributes inherited from WThreadedRunner | |
boost::thread | m_thread |
Thread instance. More... | |
WBoolFlag | m_shutdownFlag |
Condition getting fired whenever the thread should quit. More... | |
WBoolFlag | m_isCrashed |
True whenever an exception is thrown during threadMain. More... | |
std::string | m_crashMessage |
The crash message. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from WThreadedRunner | |
static void | setThisThreadName (std::string name) |
Static function to set the name of the calling thread. More... | |
Class for loading many datasets.
It runs in a separate thread.
Definition at line 41 of file WBatchLoader.h.
typedef std::shared_ptr< const WBatchLoader > WBatchLoader::ConstSPtr |
Const shared ptr abbreviation.
Definition at line 53 of file WBatchLoader.h.
typedef WSharedSequenceContainer< std::vector< WDataModule::SPtr > > WBatchLoader::DataModuleList |
The type is used to store the list of data modules.
Definition at line 58 of file WBatchLoader.h.
typedef std::shared_ptr< WBatchLoader > WBatchLoader::SPtr |
Shared ptr abbreviation.
Definition at line 48 of file WBatchLoader.h.
WBatchLoader::WBatchLoader | ( | std::vector< std::string > | filenames, |
std::shared_ptr< WModuleContainer > | targetContainer | ||
) |
Initializes the batchloader but does not start it.
Use run() to start. The batch-loader will always use the WDataModule which was found first if multiple match to one filename. This is the reason why WBatchLoader will be removed in the future. Follow issue #32.
filenames | the files to load. |
targetContainer | the container to which the data modules should be added. |
Definition at line 35 of file WBatchLoader.cpp.
|
virtual |
Destructor.
Definition at line 45 of file WBatchLoader.cpp.
WBatchLoader::DataModuleList::ReadTicket WBatchLoader::getDataModuleList | ( | ) | const |
Returns a ticket to the list of data modules that have been added so far.
Definition at line 97 of file WBatchLoader.cpp.
References WSharedObject< T >::getReadTicket(), and m_dataModules.
bool WBatchLoader::getSuppressColormaps | ( | ) | const |
Checks whether suppression of colormaps is active.
Definition at line 107 of file WBatchLoader.cpp.
References m_suppressColormaps.
|
virtual |
Run thread and load the data.
Reimplemented from WThreadedRunner.
Definition at line 50 of file WBatchLoader.cpp.
References m_targetContainer, and WThreadedRunner::run().
void WBatchLoader::setSuppressColormaps | ( | bool | suppress = true | ) |
Allows suppression of colormap registration in data modules.
This can be handy if you use data modules in a container to construct more complex data sets from multiple input files.
suppress | true if suppress |
Definition at line 102 of file WBatchLoader.cpp.
References m_suppressColormaps.
|
protectedvirtual |
Function that has to be overwritten for execution.
It gets executed in a separate thread after run() has been called.
Reimplemented from WThreadedRunner.
Definition at line 59 of file WBatchLoader.cpp.
References WModuleFactory::getModuleFactory(), m_dataModules, m_filenamesToLoad, m_suppressColormaps, m_targetContainer, WSharedSequenceContainer< S >::push_back(), and wlog::warn().
|
protected |
The list of modules that have been added.
Definition at line 123 of file WBatchLoader.h.
Referenced by getDataModuleList(), and threadMain().
|
protected |
|
protected |
If true, data modules are instructed to suppress colormap registration.
Definition at line 128 of file WBatchLoader.h.
Referenced by getSuppressColormaps(), setSuppressColormaps(), and threadMain().
|
protected |
The container which later will contain the loaded datasets.
Definition at line 118 of file WBatchLoader.h.
Referenced by run(), and threadMain().