OpenWalnut  1.4.0
WModuleWrapper.h
00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #ifndef WMODULEWRAPPER_H
00026 #define WMODULEWRAPPER_H
00027 
00028 #include <string>
00029 
00030 #include <boost/shared_ptr.hpp>
00031 
00032 #include "core/kernel/WModule.h"
00033 
00034 #include "WPropertyGroupWrapper.h"
00035 #include "WInputConnectorWrapper.h"
00036 #include "WOutputConnectorWrapper.h"
00037 
00038 /**
00039  * \class WModuleWrapper
00040  *
00041  * A wrapper for a module. This is used to expose a part of the WModule functionality
00042  * to script interpreters.
00043  */
00044 class WModuleWrapper
00045 {
00046 public:
00047     /**
00048      * Constructor.
00049      *
00050      * \param module The actual module.
00051      */
00052     explicit WModuleWrapper( boost::shared_ptr< WModule > module );
00053 
00054     /**
00055      * Destructor.
00056      */
00057     ~WModuleWrapper();
00058 
00059     /**
00060      * Get the name of the module.
00061      *
00062      * \return The name of the module.
00063      */
00064     std::string getName() const;
00065 
00066     /**
00067      * Get the description of the module.
00068      *
00069      * \return The description.
00070      */
00071     std::string getDescription() const;
00072 
00073     /**
00074      * Returns the module pointer. Useful to other wrapper classes.
00075      *
00076      * \return The module pointer.
00077      */
00078     boost::shared_ptr< WModule > getModulePtr();
00079 
00080     /**
00081      * Returns a WPropertyGroupWrapper containing the module's properties. To be used in scripts.
00082      *
00083      * \return The module's properties.
00084      */
00085     WPropertyGroupWrapper getProperties();
00086 
00087     /**
00088      * Returns a WPropertyGroupWrapper containing the module's info properties. To be used in scripts.
00089      *
00090      * \return The module's properties.
00091      */
00092     WPropertyGroupWrapper getInformationProperties();
00093 
00094     /**
00095      * Get an input connector by name.
00096      *
00097      * \param name The name of the connector.
00098      * \return The retrieved connector.
00099      */
00100     WInputConnectorWrapper getInputConnector( std::string const& name );
00101 
00102     /**
00103      * Get an output connector by name.
00104      *
00105      * \param name The name of the connector.
00106      * \return The retrieved connector.
00107      */
00108     WOutputConnectorWrapper getOutputConnector( std::string const& name );
00109 
00110 private:
00111     //! A pointer to the module.
00112     boost::shared_ptr< WModule > m_module;
00113 };
00114 
00115 #endif  // WMODULEWRAPPER_H