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