OpenWalnut  1.4.0
WModuleContainerWrapper.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 WMODULECONTAINERWRAPPER_H
26 #define WMODULECONTAINERWRAPPER_H
27 
28 #include <string>
29 
30 #ifndef Q_MOC_RUN
31 #include <boost/shared_ptr.hpp>
32 #endif
33 
34 #include "core/kernel/WModuleContainer.h"
35 
36 #include "WModuleWrapper.h"
37 
38 /**
39  * \class WModuleContainerWrapper
40  *
41  * Encapsulates a module container. This class is exposed to scripts.
42  */
44 {
45 public:
46  /**
47  * Constructor. Creates an empty wrapper.
48  */
50 
51  /**
52  * Constructor.
53  *
54  * \param mc The module container.
55  */
56  explicit WModuleContainerWrapper( boost::shared_ptr< WModuleContainer > mc );
57 
58  /**
59  * Destructor.
60  */
62 
63  /**
64  * Creates a module from the prototype with the given name.
65  *
66  * \param name The name of the module prototype.
67  * \return The module.
68  */
69  WModuleWrapper create( std::string const& name );
70 
71  /**
72  * Creates a data module and load the file given via filename.
73  *
74  * \param filename The name of the file to load.
75  * \return The module.
76  */
77  WModuleWrapper createDataModule( std::string const& filename );
78 
79  /**
80  * Remove a module from the container.
81  *
82  * \param module The module to remove.
83  */
84  void remove( WModuleWrapper module );
85 
86 private:
87  //! The module container.
88  boost::shared_ptr< WModuleContainer > m_mc;
89 };
90 
91 #endif // WMODULECONTAINERWRAPPER_H
A wrapper for a module.
WModuleWrapper create(std::string const &name)
Creates a module from the prototype with the given name.
boost::shared_ptr< WModuleContainer > m_mc
The module container.
Encapsulates a module container.
WModuleWrapper createDataModule(std::string const &filename)
Creates a data module and load the file given via filename.