OpenWalnut  1.5.0dev
WModuleWrapper.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 WMODULEWRAPPER_H
26 #define WMODULEWRAPPER_H
27 
28 #include <memory>
29 #include <string>
30 
31 
32 #include "WInputConnectorWrapper.h"
33 #include "WOutputConnectorWrapper.h"
34 #include "WPropertyGroupWrapper.h"
35 #include "core/kernel/WModule.h"
36 
37 /**
38  * \class WModuleWrapper
39  *
40  * A wrapper for a module. This is used to expose a part of the WModule functionality
41  * to script interpreters.
42  */
44 {
45 public:
46  /**
47  * Constructor.
48  *
49  * \param module The actual module.
50  */
51  explicit WModuleWrapper( std::shared_ptr< WModule > module );
52 
53  /**
54  * Destructor.
55  */
57 
58  /**
59  * Get the name of the module.
60  *
61  * \return The name of the module.
62  */
63  std::string getName() const;
64 
65  /**
66  * Get the description of the module.
67  *
68  * \return The description.
69  */
70  std::string getDescription() const;
71 
72  /**
73  * Returns the module pointer. Useful to other wrapper classes.
74  *
75  * \return The module pointer.
76  */
77  std::shared_ptr< WModule > getModulePtr();
78 
79  /**
80  * Returns a WPropertyGroupWrapper containing the module's properties. To be used in scripts.
81  *
82  * \return The module's properties.
83  */
85 
86  /**
87  * Returns a WPropertyGroupWrapper containing the module's info properties. To be used in scripts.
88  *
89  * \return The module's properties.
90  */
92 
93  /**
94  * Get an input connector by name.
95  *
96  * \param name The name of the connector.
97  * \return The retrieved connector.
98  */
99  WInputConnectorWrapper getInputConnector( std::string const& name );
100 
101  /**
102  * Get an output connector by name.
103  *
104  * \param name The name of the connector.
105  * \return The retrieved connector.
106  */
107  WOutputConnectorWrapper getOutputConnector( std::string const& name );
108 
109 private:
110  //! A pointer to the module.
111  std::shared_ptr< WModule > m_module;
112 };
113 
114 #endif // WMODULEWRAPPER_H
A wrapper for input connectors.
A wrapper for a module.
WInputConnectorWrapper getInputConnector(std::string const &name)
Get an input connector by name.
WPropertyGroupWrapper getProperties()
Returns a WPropertyGroupWrapper containing the module's properties.
WModuleWrapper(std::shared_ptr< WModule > module)
Constructor.
WOutputConnectorWrapper getOutputConnector(std::string const &name)
Get an output connector by name.
WPropertyGroupWrapper getInformationProperties()
Returns a WPropertyGroupWrapper containing the module's info properties.
std::string getName() const
Get the name of the module.
std::shared_ptr< WModule > getModulePtr()
Returns the module pointer.
std::string getDescription() const
Get the description of the module.
~WModuleWrapper()
Destructor.
std::shared_ptr< WModule > m_module
A pointer to the module.
A wrapper for output connectors.
Encapsulates a property group.