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