OpenWalnut  1.5.0dev
WMWriteTransferFunction.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 WMWRITETRANSFERFUNCTION_H
26 #define WMWRITETRANSFERFUNCTION_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include "core/common/WProperties.h"
32 #include "core/kernel/WModule.h"
33 #include "core/kernel/WModuleInputData.h"
34 #include "core/kernel/WModuleOutputData.h"
35 
36 /**
37  * Module to export transferfunctions
38  *
39  * \ingroup modules
40  */
42 {
43 public:
44  /**
45  * Constructor.
46  */
48 
49  /**
50  * Destructor
51  */
52  virtual ~WMWriteTransferFunction();
53 
54  /**
55  * Get the icon for this module in XPM format.
56  *
57  * \return The icon.
58  */
59  const char** getXPMIcon() const;
60 
61  /**
62  * Gives back the name of this module.
63  * \return the module's name.
64  */
65  virtual const std::string getName() const;
66 
67  /**
68  * Gives back a description of this module.
69  * \return description to module.
70  */
71  virtual const std::string getDescription() const;
72 
73  /**
74  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
75  * should never be initialized or modified in some other way. A simple new instance is required.
76  *
77  * \return the prototype used to create every module in OpenWalnut.
78  */
79  virtual std::shared_ptr< WModule > factory() const;
80 
81 protected:
82  /**
83  * Entry point after loading the module. Runs in separate thread.
84  */
85  virtual void moduleMain();
86 
87  /**
88  * Initialize the connectors this module is using.
89  */
90  virtual void connectors();
91 
92  /**
93  * Initialize the properties for this module.
94  */
95  virtual void properties();
96 
97 private:
98  /**
99  * Condition used throughout the module to notify the thread if some changes happened (like properties have changed and similar).
100  */
101  std::shared_ptr< WCondition > m_propCondition;
102 
103  /**
104  * The connector used to get the TF.
105  */
107 
108  /**
109  * Where to save the file to
110  */
111  WPropFilename m_savePath;
112 
113  /**
114  * DO the save operation
115  */
116  WPropTrigger m_saveTrigger;
117 
118  /**
119  * Allows saving as raw data file instead of ascii.
120  */
121  WPropBool m_saveAsRaw;
122 };
123 
124 #endif // WMWRITETRANSFERFUNCTION_H
Module to export transferfunctions.
WPropTrigger m_saveTrigger
DO the save operation.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
virtual const std::string getDescription() const
Gives back a description of this module.
WPropFilename m_savePath
Where to save the file to.
WModuleInputData< WDataSetSingle >::SPtr m_input
The connector used to get the TF.
virtual ~WMWriteTransferFunction()
Destructor.
virtual void moduleMain()
Entry point after loading the module.
virtual const std::string getName() const
Gives back the name of this module.
const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual void properties()
Initialize the properties for this module.
WPropBool m_saveAsRaw
Allows saving as raw data file instead of ascii.
virtual void connectors()
Initialize the connectors this module is using.
std::shared_ptr< WCondition > m_propCondition
Condition used throughout the module to notify the thread if some changes happened (like properties h...
Class offering an instantiate-able data connection between modules.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72