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