OpenWalnut  1.4.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WBatchLoader Class Reference

Class for loading many datasets. More...

#include <WBatchLoader.h>

+ Inheritance diagram for WBatchLoader:

Public Types

typedef boost::shared_ptr< WBatchLoaderSPtr
 Shared ptr abbreviation. More...
 
typedef boost::shared_ptr< const WBatchLoaderConstSPtr
 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 boost::function< void(void) > THREADFUNCTION
 Type used for simple thread functions. More...
 

Public Member Functions

 WBatchLoader (std::vector< std::string > filenames, boost::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 WBoolFlagisCrashed () 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...
 
boost::shared_ptr< WModuleContainerm_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...
 

Detailed Description

Class for loading many datasets.

It runs in a separate thread.

Definition at line 50 of file WBatchLoader.h.

Member Typedef Documentation

typedef boost::shared_ptr< const WBatchLoader > WBatchLoader::ConstSPtr

Const shared ptr abbreviation.

Definition at line 62 of file WBatchLoader.h.

The type is used to store the list of data modules.

Definition at line 67 of file WBatchLoader.h.

typedef boost::shared_ptr< WBatchLoader > WBatchLoader::SPtr

Shared ptr abbreviation.

Definition at line 57 of file WBatchLoader.h.

Constructor & Destructor Documentation

WBatchLoader::WBatchLoader ( std::vector< std::string >  filenames,
boost::shared_ptr< WModuleContainer targetContainer 
)

Initializes the batchloader but does not start it.

Use run().

Parameters
filenamesthe files to load.
targetContainerthe container to which the data modules should be added.

Definition at line 34 of file WBatchLoader.cpp.

WBatchLoader::~WBatchLoader ( )
virtual

Destructor.

Definition at line 44 of file WBatchLoader.cpp.

Member Function Documentation

WBatchLoader::DataModuleList::ReadTicket WBatchLoader::getDataModuleList ( ) const

Returns a ticket to the list of data modules that have been added so far.

Returns
the ticket

Definition at line 84 of file WBatchLoader.cpp.

References WSharedObject< T >::getReadTicket(), and m_dataModules.

bool WBatchLoader::getSuppressColormaps ( ) const

Checks whether suppression of colormaps is active.

Returns
true if colormaps are suppressed.

Definition at line 94 of file WBatchLoader.cpp.

References m_suppressColormaps.

void WBatchLoader::run ( )
virtual

Run thread and load the data.

Reimplemented from WThreadedRunner.

Definition at line 49 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.

Notes:
call this before run().
Parameters
suppresstrue if suppress

Definition at line 89 of file WBatchLoader.cpp.

References m_suppressColormaps.

void WBatchLoader::threadMain ( )
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 58 of file WBatchLoader.cpp.

References WModuleFactory::getModuleFactory(), m_dataModules, m_filenamesToLoad, m_suppressColormaps, m_targetContainer, WSharedSequenceContainer< S >::push_back(), and WDataModule::setSuppressColormaps().

Member Data Documentation

DataModuleList WBatchLoader::m_dataModules
protected

The list of modules that have been added.

Definition at line 131 of file WBatchLoader.h.

Referenced by getDataModuleList(), and threadMain().

std::vector< std::string > WBatchLoader::m_filenamesToLoad
protected

List of files to load.

Definition at line 121 of file WBatchLoader.h.

Referenced by threadMain().

bool WBatchLoader::m_suppressColormaps
protected

If true, data modules are instructed to suppress colormap registration.

Definition at line 136 of file WBatchLoader.h.

Referenced by getSuppressColormaps(), setSuppressColormaps(), and threadMain().

boost::shared_ptr< WModuleContainer > WBatchLoader::m_targetContainer
protected

The container which later will contain the loaded datasets.

Definition at line 126 of file WBatchLoader.h.

Referenced by run(), and threadMain().


The documentation for this class was generated from the following files: