OpenWalnut  1.4.0
WDataModule.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WDATAMODULE_H
26 #define WDATAMODULE_H
27 
28 #include <boost/shared_ptr.hpp>
29 
30 #include "WModule.h"
31 
32 /**
33  * 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
34  * to handle arbitrary data/multi-file data and other complex things.
35  */
36 class WDataModule: public WModule
37 {
38 public:
39  /**
40  * Convenience typedef for a boost::shared_ptr< WDataModule >.
41  */
42  typedef boost::shared_ptr< WDataModule > SPtr;
43 
44  /**
45  * Convenience typedef for a boost::shared_ptr< const WDataModule >.
46  */
47  typedef boost::shared_ptr< const WDataModule > ConstSPtr;
48 
49  /**
50  * Default constructor.
51  */
52  WDataModule();
53 
54  /**
55  * Destructor.
56  */
57  virtual ~WDataModule();
58 
59  /**
60  * Gets the type of the module. This is useful for FAST differentiation between several modules like standard modules and data
61  * modules which play a special role in OpenWalnut/Kernel.
62  *
63  * \return the Type. If you do not overwrite this method, it will return MODULE_ARBITRARY.
64  */
65  virtual MODULE_TYPE getType() const;
66 
67  /**
68  * Getter for the dataset.
69  *
70  * \return the dataset encapsulated by this module.
71  */
72  virtual boost::shared_ptr< WDataSet > getDataSet() = 0;
73 
74  /**
75  * 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
76  * construction BEFORE running the data module.
77  *
78  * \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
79  * only this module) needs it before ready got called.
80  *
81  * \param fname the name of the file
82  */
83  virtual void setFilename( boost::filesystem::path fname ) = 0;
84 
85  /**
86  * 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.
87  *
88  * \return the path of the file that has been loaded.
89  */
90  virtual boost::filesystem::path getFilename() const = 0;
91 
92  /**
93  * Allows suppression of colormap registration in data modules. This can be handy if you use data modules in a container to construct more
94  * complex data sets from multiple input files.
95  *
96  * \note call this before adding and running the module.
97  *
98  * \param suppress true if suppress
99  */
100  virtual void setSuppressColormaps( bool suppress = true );
101 
102  /**
103  * Checks whether suppression of colormaps is active.
104  *
105  * \return true if colormaps are suppressed.
106  */
107  bool getSuppressColormaps() const;
108 
109 protected:
110 private:
111  /**
112  * If true, data modules are instructed to suppress colormap registration.
113  */
115 };
116 
117 #endif // WDATAMODULE_H
118