OpenWalnut  1.5.0dev
WMReadVCL.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 WMREADVCL_H
26 #define WMREADVCL_H
27 
28 #include <memory>
29 #include <string>
30 #include <vector>
31 
32 #include "core/dataHandler/WDataSetFibers.h"
33 #include "core/kernel/WModule.h"
34 #include "core/kernel/WModuleInputData.h"
35 #include "core/kernel/WModuleOutputData.h"
36 
37 /**
38  * A module to read VCL line data.
39  *
40  * \ingroup modules
41  */
42 class WMReadVCL: public WModule
43 {
44 public:
45  /**
46  * Constructor of module.
47  */
48  WMReadVCL();
49 
50  /**
51  * Destructor of module.
52  */
53  virtual ~WMReadVCL();
54 
55  /**
56  * Gives back the name of this module.
57  * \return the module's name.
58  */
59  virtual const std::string getName() const;
60 
61  /**
62  * Gives back a description of this module.
63  * \return description to module.
64  */
65  virtual const std::string getDescription() const;
66 
67  /**
68  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
69  * should never be initialized or modified in some other way. A simple new instance is required.
70  *
71  * \return the prototype used to create every module in OpenWalnut.
72  */
73  virtual std::shared_ptr< WModule > factory() const;
74 
75 protected:
76  /**
77  * Entry point after loading the module. Runs in separate thread.
78  */
79  virtual void moduleMain();
80 
81  /**
82  * Initialize the connectors this module is using.
83  */
84  virtual void connectors();
85 
86  /**
87  * Initialize the properties for this module.
88  */
89  virtual void properties();
90 
91 private:
92  std::shared_ptr< WCondition > m_propCondition; //!< A condition used to notify about changes in several properties.
93  WPropFilename m_dataFile; //!< The data will be read from this file.
94  WPropBool m_loadAttrib; //!< Load additional attribute.
95  WPropInt m_attrib; //!< The index of the attribute to use.
96  WPropTrigger m_readTriggerProp; //!< The trigger for loading
97 
98  std::shared_ptr< WDataSetFibers > m_dataSet; //!< This data set is provided as output through the connector.
99  std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_output; //!< Output connector provided by this module.
100 
101  /**
102  * Read VCL data
103  *
104  * \param filename the filenamne
105  */
106  void readData( std::string filename );
107 };
108 
109 #endif // WMREADVCL_H
A module to read VCL line data.
Definition: WMReadVCL.h:43
WPropFilename m_dataFile
The data will be read from this file.
Definition: WMReadVCL.h:93
virtual void moduleMain()
Entry point after loading the module.
Definition: WMReadVCL.cpp:84
virtual const std::string getName() const
Gives back the name of this module.
Definition: WMReadVCL.cpp:53
virtual void connectors()
Initialize the connectors this module is using.
Definition: WMReadVCL.cpp:63
virtual ~WMReadVCL()
Destructor of module.
Definition: WMReadVCL.cpp:43
virtual void properties()
Initialize the properties for this module.
Definition: WMReadVCL.cpp:70
WPropInt m_attrib
The index of the attribute to use.
Definition: WMReadVCL.h:95
WPropBool m_loadAttrib
Load additional attribute.
Definition: WMReadVCL.h:94
virtual const std::string getDescription() const
Gives back a description of this module.
Definition: WMReadVCL.cpp:58
std::shared_ptr< WDataSetFibers > m_dataSet
This data set is provided as output through the connector.
Definition: WMReadVCL.h:98
WPropTrigger m_readTriggerProp
The trigger for loading.
Definition: WMReadVCL.h:96
WMReadVCL()
Constructor of module.
Definition: WMReadVCL.cpp:38
std::shared_ptr< WModuleOutputData< WDataSetFibers > > m_output
Output connector provided by this module.
Definition: WMReadVCL.h:99
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
Definition: WMReadVCL.h:92
void readData(std::string filename)
Read VCL data.
Definition: WMReadVCL.cpp:107
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...
Definition: WMReadVCL.cpp:48
Class representing a single module of OpenWalnut.
Definition: WModule.h:72