OpenWalnut 1.2.5
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WBATCHLOADER_H 00026 #define WBATCHLOADER_H 00027 00028 #include <string> 00029 #include <vector> 00030 00031 #include <boost/enable_shared_from_this.hpp> 00032 #include <boost/shared_ptr.hpp> 00033 00034 #include "../common/WThreadedRunner.h" 00035 00036 #include "WExportKernel.h" 00037 00038 class WModuleContainer; 00039 00040 /** 00041 * Class for loading many datasets. It runs in a separate thread. 00042 */ 00043 class OWKERNEL_EXPORT WBatchLoader: public WThreadedRunner, 00044 public boost::enable_shared_from_this< WBatchLoader > 00045 { 00046 public: 00047 00048 /** 00049 * Initializes the batchloader but does not start it. Use run(). 00050 * 00051 * \param fileNames the files to load. 00052 * \param targetContainer the container to which the data modules should be added. 00053 */ 00054 WBatchLoader( std::vector< std::string > fileNames, boost::shared_ptr< WModuleContainer > targetContainer ); 00055 00056 /** 00057 * Destructor. 00058 */ 00059 virtual ~WBatchLoader(); 00060 00061 /** 00062 * Run thread and load the data. 00063 */ 00064 virtual void run(); 00065 00066 protected: 00067 00068 /** 00069 * Function that has to be overwritten for execution. It gets executed in a separate thread after run() 00070 * has been called. 00071 */ 00072 virtual void threadMain(); 00073 00074 /** 00075 * List of files to load. 00076 */ 00077 std::vector< std::string > m_fileNamesToLoad; 00078 00079 /** 00080 * The container which later will contain the loaded datasets. 00081 */ 00082 boost::shared_ptr< WModuleContainer > m_targetContainer; 00083 00084 private: 00085 }; 00086 00087 #endif // WBATCHLOADER_H 00088