Commit a25b673f authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[ADD] - basic Data module infrastructure

parent 1ec7c317
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WModuleContainer.h"
WModuleContainer::WModuleContainer()
{
// initialize members
}
WModuleContainer::~WModuleContainer()
{
// cleanup
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMODULECONTAINER_H
#define WMODULECONTAINER_H
/**
* Class able to contain other modules. It manages several tasks like finding appropriate modules, managing data modules and
* module initialization.
*
* \ingroup Kernel
*/
class WModuleContainer
{
public:
/**
* Default constructor.
*/
WModuleContainer();
/**
* Destructor.
*/
virtual ~WModuleContainer();
protected:
private:
};
#endif // WMODULECONTAINER_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WMData2.h"
WMData2::WMData2():
WModule()
{
// initialize members
}
WMData2::~WMData2()
{
// cleanup
}
const std::string WMData2::getName() const
{
return "Data Module";
}
const std::string WMData2::getDescription() const
{
return "This module encapsulates data.";
}
void WMData2::connectors()
{
// initialize connectors
m_output= boost::shared_ptr< WModuleOutputData< boost::shared_ptr< WDataSet > > >(
new WModuleOutputData< boost::shared_ptr< WDataSet > >( shared_from_this(),
"out1", "A loaded dataset." )
);
// add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
addConnector( m_output );
// call WModules initialization
WModule::connectors();
}
void WMData2::properties()
{
}
void WMData2::notifyConnectionEstablished( boost::shared_ptr<WModuleConnector> here,
boost::shared_ptr<WModuleConnector> there )
{
}
void WMData2::notifyConnectionClosed( boost::shared_ptr<WModuleConnector> here, boost::shared_ptr<WModuleConnector> there )
{
}
void WMData2::notifyDataChange( boost::shared_ptr<WModuleConnector> input,
boost::shared_ptr<WModuleConnector> output )
{
}
void WMData2::threadMain()
{
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMDATA2_H
#define WMDATA2_H
#include <boost/shared_ptr.hpp>
#include "../../kernel/WKernel.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleConnector.h"
#include "../../kernel/WModuleOutputData.hpp"
#include "../../dataHandler/WDataSet.h"
/**
* Module for encapsulating WDataSets. It can encapsulate almost everything, but is intended to be used with WDataSets and its
* inherited classes. This class builds a "source" in OpenWalnut's DataFlow Network.
*/
class WMData2: public WModule
{
public:
/**
* Default constructor.
*/
WMData2();
/**
* Destructor.
*/
virtual ~WMData2();
/**
* Gives back the name of this module.
* \return the module's name.
*/
virtual const std::string getName() const;
/**
* Gives back a description of this module.
* \return description to module.
*/
virtual const std::string getDescription() const;
protected:
/**
* \par Description
* Entry point after loading the module. Runs in separate thread.
*/
virtual void threadMain();
/**
* Initialize connectors in this function. This function must not be called multiple times for one module instance.
* The module container manages calling those functions -> so just implement it.
*/
virtual void connectors();
/**
* Initialize properties in this function. This function must not be called multiple times for one module instance.
* The module container manages calling those functions -> so just implement it. Once initialized the number and type
* of all properties should be set.
*/
virtual void properties();
/**
* Gets called whenever a connector gets connected to the specified input.
*
* \param here the connector of THIS module that got connected to "there"
* \param there the connector that has been connected with the connector "here" of this module.
*/
virtual void notifyConnectionEstablished( boost::shared_ptr< WModuleConnector > here,
boost::shared_ptr< WModuleConnector > there );
/**
* Gets called whenever a connection between a remote and local connector gets closed.
*
* \param here the connector of THIS module getting disconnected.
* \param there the connector of the other module getting disconnected.
*/
virtual void notifyConnectionClosed( boost::shared_ptr< WModuleConnector > here, boost::shared_ptr< WModuleConnector > there );
/**
* Gets called when the data on one input connector changed.
*
* \param input the input connector receiving the change.
* \param output the output connector sending the change notification.
*/
virtual void notifyDataChange( boost::shared_ptr< WModuleConnector > input,
boost::shared_ptr< WModuleConnector > output );
private:
/**
* The associated dataset.
*/
boost::shared_ptr< WDataSet > m_dataSet;
/**
* The only output of this data module.
*/
boost::shared_ptr< WModuleOutputData< boost::shared_ptr< WDataSet > > > m_output;
};
#endif // WMDATA2_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment