OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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  /**
41  * Convenience typedef for a boost::shared_ptr< WDataModule >.
42  */
43  typedef boost::shared_ptr< WDataModule > SPtr;
44 
45  /**
46  * Convenience typedef for a boost::shared_ptr< const WDataModule >.
47  */
48  typedef boost::shared_ptr< const WDataModule > ConstSPtr;
49 
50  /**
51  * Default constructor.
52  */
53  WDataModule();
54 
55  /**
56  * Destructor.
57  */
58  virtual ~WDataModule();
59 
60  /**
61  * Gets the type of the module. This is useful for FAST differentiation between several modules like standard modules and data
62  * modules which play a special role in OpenWalnut/Kernel.
63  *
64  * \return the Type. If you do not overwrite this method, it will return MODULE_ARBITRARY.
65  */
66  virtual MODULE_TYPE getType() const;
67 
68  /**
69  * Getter for the dataset.
70  *
71  * \return the dataset encapsulated by this module.
72  */
73  virtual boost::shared_ptr< WDataSet > getDataSet() = 0;
74 
75  /**
76  * 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
77  * construction BEFORE running the data module.
78  *
79  * \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
80  * only this module) needs it before ready got called.
81  *
82  * \param fname the name of the file
83  */
84  virtual void setFilename( boost::filesystem::path fname ) = 0;
85 
86  /**
87  * 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.
88  *
89  * \return the path of the file that has been loaded.
90  */
91  virtual boost::filesystem::path getFilename() const = 0;
92 
93 protected:
94 
95 private:
96 };
97 
98 #endif // WDATAMODULE_H
99