OpenWalnut
1.4.0
|
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 WDATAMODULE_H 00026 #define WDATAMODULE_H 00027 00028 #include <boost/shared_ptr.hpp> 00029 00030 #include "WModule.h" 00031 00032 /** 00033 * Base for all data loader modules. This currently is only a prototype to move WMData out of the core. Later, it will provide a whole interface 00034 * to handle arbitrary data/multi-file data and other complex things. 00035 */ 00036 class WDataModule: public WModule 00037 { 00038 public: 00039 /** 00040 * Convenience typedef for a boost::shared_ptr< WDataModule >. 00041 */ 00042 typedef boost::shared_ptr< WDataModule > SPtr; 00043 00044 /** 00045 * Convenience typedef for a boost::shared_ptr< const WDataModule >. 00046 */ 00047 typedef boost::shared_ptr< const WDataModule > ConstSPtr; 00048 00049 /** 00050 * Default constructor. 00051 */ 00052 WDataModule(); 00053 00054 /** 00055 * Destructor. 00056 */ 00057 virtual ~WDataModule(); 00058 00059 /** 00060 * Gets the type of the module. This is useful for FAST differentiation between several modules like standard modules and data 00061 * modules which play a special role in OpenWalnut/Kernel. 00062 * 00063 * \return the Type. If you do not overwrite this method, it will return MODULE_ARBITRARY. 00064 */ 00065 virtual MODULE_TYPE getType() const; 00066 00067 /** 00068 * Getter for the dataset. 00069 * 00070 * \return the dataset encapsulated by this module. 00071 */ 00072 virtual boost::shared_ptr< WDataSet > getDataSet() = 0; 00073 00074 /** 00075 * Sets the filename of the file to load. If this method is called multiple times it has no effect. It has to be called right after 00076 * construction BEFORE running the data module. 00077 * 00078 * \note The reason for using this method to set the filename instead of a property is, that a property gets set AFTER ready(), but this (and 00079 * only this module) needs it before ready got called. 00080 * 00081 * \param fname the name of the file 00082 */ 00083 virtual void setFilename( boost::filesystem::path fname ) = 0; 00084 00085 /** 00086 * Gets the path of the file that has been loaded. It always is the value which has been set during the FIRST call of setFilename. 00087 * 00088 * \return the path of the file that has been loaded. 00089 */ 00090 virtual boost::filesystem::path getFilename() const = 0; 00091 00092 /** 00093 * Allows suppression of colormap registration in data modules. This can be handy if you use data modules in a container to construct more 00094 * complex data sets from multiple input files. 00095 * 00096 * \note call this before adding and running the module. 00097 * 00098 * \param suppress true if suppress 00099 */ 00100 virtual void setSuppressColormaps( bool suppress = true ); 00101 00102 /** 00103 * Checks whether suppression of colormaps is active. 00104 * 00105 * \return true if colormaps are suppressed. 00106 */ 00107 bool getSuppressColormaps() const; 00108 00109 protected: 00110 private: 00111 /** 00112 * If true, data modules are instructed to suppress colormap registration. 00113 */ 00114 bool m_suppressColormaps; 00115 }; 00116 00117 #endif // WDATAMODULE_H 00118