Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
a5f89e76
Commit
a5f89e76
authored
Jul 04, 2011
by
Sebastian Eichelbaum
Browse files
[CHANGE] - movded WMData to modules. No direct need to be placed inside core anymore
parent
2e8a355d
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
187 additions
and
70 deletions
+187
-70
src/core/kernel/WBatchLoader.cpp
src/core/kernel/WBatchLoader.cpp
+2
-1
src/core/kernel/WDataModule.cpp
src/core/kernel/WDataModule.cpp
+41
-0
src/core/kernel/WDataModule.h
src/core/kernel/WDataModule.h
+99
-0
src/core/kernel/WModuleContainer.cpp
src/core/kernel/WModuleContainer.cpp
+2
-2
src/core/kernel/WModuleContainer.h
src/core/kernel/WModuleContainer.h
+3
-3
src/core/kernel/WModuleFactory.cpp
src/core/kernel/WModuleFactory.cpp
+0
-4
src/core/kernel/WModuleFactory.h
src/core/kernel/WModuleFactory.h
+0
-1
src/core/kernel/combiner/WModuleProjectFileCombiner.cpp
src/core/kernel/combiner/WModuleProjectFileCombiner.cpp
+3
-2
src/core/kernel/combiner/WModuleProjectFileCombiner.h
src/core/kernel/combiner/WModuleProjectFileCombiner.h
+1
-1
src/modules/data/WMData.cpp
src/modules/data/WMData.cpp
+27
-29
src/modules/data/WMData.h
src/modules/data/WMData.h
+2
-13
src/modules/data/data.png
src/modules/data/data.png
+0
-0
src/modules/data/data.xpm
src/modules/data/data.xpm
+0
-0
src/qt4gui/qt4/WMainWindow.cpp
src/qt4gui/qt4/WMainWindow.cpp
+2
-2
src/qt4gui/qt4/WQt4Gui.cpp
src/qt4gui/qt4/WQt4Gui.cpp
+0
-6
src/qt4gui/qt4/controlPanel/WQtControlPanel.cpp
src/qt4gui/qt4/controlPanel/WQtControlPanel.cpp
+5
-5
src/qt4gui/qt4/networkEditor/WQtNetworkEditor.h
src/qt4gui/qt4/networkEditor/WQtNetworkEditor.h
+0
-1
No files found.
src/core/kernel/WBatchLoader.cpp
View file @
a5f89e76
...
...
@@ -26,6 +26,7 @@
#include <vector>
#include "WModule.h"
#include "WDataModule.h"
#include "WModuleContainer.h"
#include "WModuleFactory.h"
...
...
@@ -64,7 +65,7 @@ void WBatchLoader::threadMain()
);
// set the filename
boost
::
shared_static_cast
<
W
M
Data
>
(
mod
)
->
setFilename
(
*
iter
);
boost
::
shared_static_cast
<
WData
Module
>
(
mod
)
->
setFilename
(
*
iter
);
m_targetContainer
->
add
(
mod
);
// serialize loading of a couple of data sets
...
...
src/core/kernel/WDataModule.cpp
0 → 100644
View file @
a5f89e76
//---------------------------------------------------------------------------
//
// 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 "WDataModule.h"
WDataModule
::
WDataModule
()
{
// initialize members
}
WDataModule
::~
WDataModule
()
{
// cleanup
}
MODULE_TYPE
WDataModule
::
getType
()
const
{
return
MODULE_DATA
;
}
src/core/kernel/WDataModule.h
0 → 100644
View file @
a5f89e76
//---------------------------------------------------------------------------
//
// 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 WDATAMODULE_H
#define WDATAMODULE_H
#include <boost/shared_ptr.hpp>
#include "WModule.h"
/**
* Base for all data loader modules. This currently is only a prototype to move WMData out of the core. Later, it will provide a whole interface
* to handle arbitrary data/multi-file data and other complex things.
*/
class
WDataModule
:
public
WModule
{
public:
/**
* Convenience typedef for a boost::shared_ptr< WDataModule >.
*/
typedef
boost
::
shared_ptr
<
WDataModule
>
SPtr
;
/**
* Convenience typedef for a boost::shared_ptr< const WDataModule >.
*/
typedef
boost
::
shared_ptr
<
const
WDataModule
>
ConstSPtr
;
/**
* Default constructor.
*/
WDataModule
();
/**
* Destructor.
*/
virtual
~
WDataModule
();
/**
* Gets the type of the module. This is useful for FAST differentiation between several modules like standard modules and data
* modules which play a special role in OpenWalnut/Kernel.
*
* \return the Type. If you do not overwrite this method, it will return MODULE_ARBITRARY.
*/
virtual
MODULE_TYPE
getType
()
const
;
/**
* Getter for the dataset.
*
* \return the dataset encapsulated by this module.
*/
virtual
boost
::
shared_ptr
<
WDataSet
>
getDataSet
()
=
0
;
/**
* Sets the filename of the file to load. If this method is called multiple times it has no effect. It has to be called right after
* construction BEFORE running the data module.
*
* \note The reason for using this method to set the filename instead of a property is, that a property gets set AFTER ready(), but this (and
* only this module) needs it before ready got called.
*
* \param fname the name of the file
*/
virtual
void
setFilename
(
boost
::
filesystem
::
path
fname
)
=
0
;
/**
* Gets the path of the file that has been loaded. It always is the value which has been set during the FIRST call of setFilename.
*
* \return the path of the file that has been loaded.
*/
virtual
boost
::
filesystem
::
path
getFilename
()
const
=
0
;
protected:
private:
};
#endif // WDATAMODULE_H
src/core/kernel/WModuleContainer.cpp
View file @
a5f89e76
...
...
@@ -44,7 +44,7 @@
#include "exceptions/WModuleAlreadyAssociated.h"
#include "exceptions/WModuleSignalSubscriptionFailed.h"
#include "exceptions/WModuleUninitialized.h"
#include "
modules/data/WMData
.h"
#include "
WDataModule
.h"
#include "WModuleContainer.h"
...
...
@@ -253,7 +253,7 @@ WModuleContainer::DataModuleListType WModuleContainer::getDataModules()
// is this module a data module?
if
(
(
*
iter
)
->
getType
()
==
MODULE_DATA
)
{
boost
::
shared_ptr
<
W
M
Data
>
dm
=
boost
::
shared_static_cast
<
W
M
Data
>
(
*
iter
);
boost
::
shared_ptr
<
WData
Module
>
dm
=
boost
::
shared_static_cast
<
WData
Module
>
(
*
iter
);
// now check the contained dataset ( isTexture and whether it is ready )
if
(
dm
->
isReady
()()
)
...
...
src/core/kernel/WModuleContainer.h
View file @
a5f89e76
...
...
@@ -45,7 +45,7 @@
class
WThreadedRunner
;
class
WBatchLoader
;
class
WModule
;
class
W
M
Data
;
class
WData
Module
;
#include "WExportKernel.h"
...
...
@@ -243,9 +243,9 @@ public:
virtual
boost
::
shared_ptr
<
WModule
>
factory
()
const
;
/**
* Simple type for W
M
Data pointer lists.
* Simple type for WData
Module
pointer lists.
*/
typedef
std
::
set
<
boost
::
shared_ptr
<
W
M
Data
>
>
DataModuleListType
;
typedef
std
::
set
<
boost
::
shared_ptr
<
WData
Module
>
>
DataModuleListType
;
/**
* Returns a vector of pointers to the loaded data modules in the container.
...
...
src/core/kernel/WModuleFactory.cpp
View file @
a5f89e76
...
...
@@ -33,7 +33,6 @@
#include "combiner/WApplyCombiner.h"
#include "exceptions/WPrototypeNotUnique.h"
#include "exceptions/WPrototypeUnknown.h"
#include "modules/data/WMData.h" // this is the ONLY module with a special meaning. Everyone knowing the factory also knows this
#include "WModule.h"
#include "WModuleCombiner.h"
#include "WModuleFactory.h"
...
...
@@ -61,9 +60,6 @@ void WModuleFactory::load()
// operation must be exclusive
PrototypeSharedContainerType
::
WriteTicket
m_prototypeAccess
=
m_prototypes
.
getWriteTicket
();
// These modules need to be added by hand. They are special, obviously.
m_prototypeAccess
->
get
().
insert
(
boost
::
shared_ptr
<
WModule
>
(
new
WMData
()
)
);
// Load the dynamic modules here:
m_moduleLoader
.
load
(
m_prototypeAccess
);
...
...
src/core/kernel/WModuleFactory.h
View file @
a5f89e76
...
...
@@ -33,7 +33,6 @@
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include "modules/data/WMData.h" // this is the ONLY module with a special meaning. Every one knowing the factory also knows this
#include "../common/WSharedAssociativeContainer.h"
#include "WModuleCombinerTypes.h"
#include "WModule.h"
...
...
src/core/kernel/combiner/WModuleProjectFileCombiner.cpp
View file @
a5f89e76
...
...
@@ -37,6 +37,7 @@
#include "../WModuleFactory.h"
#include "../WModuleConnector.h"
#include "../WModule.h"
#include "../WDataModule.h"
#include "../WModuleInputConnector.h"
#include "../WModuleOutputConnector.h"
#include "../exceptions/WModuleConnectorNotFound.h"
...
...
@@ -128,7 +129,7 @@ bool WModuleProjectFileCombiner::parse( std::string line, unsigned int lineNumbe
}
else
{
boost
::
shared_static_cast
<
W
M
Data
>
(
module
)
->
setFilename
(
parameter
);
boost
::
shared_static_cast
<
WData
Module
>
(
module
)
->
setFilename
(
parameter
);
m_modules
.
insert
(
ModuleID
(
boost
::
lexical_cast
<
unsigned
int
>
(
matches
[
1
]
),
module
)
);
}
}
...
...
@@ -368,7 +369,7 @@ void WModuleProjectFileCombiner::save( std::ostream& output ) // NOLINT
// handle data modules separately
if
(
(
*
iter
)
->
getType
()
==
MODULE_DATA
)
{
output
<<
"DATA:"
<<
i
<<
":"
<<
boost
::
shared_static_cast
<
W
M
Data
>
(
(
*
iter
)
)
->
getFilename
()
<<
std
::
endl
;
output
<<
"DATA:"
<<
i
<<
":"
<<
boost
::
shared_static_cast
<
WData
Module
>
(
(
*
iter
)
)
->
getFilename
()
<<
std
::
endl
;
}
else
{
...
...
src/core/kernel/combiner/WModuleProjectFileCombiner.h
View file @
a5f89e76
...
...
@@ -67,7 +67,7 @@ public:
/**
* Apply the internal module structure to the target container. Be aware, that this operation might take some time, as modules can be
* connected only if they are "ready", which, at least with W
M
Data modules, might take some time. It applies the loaded project file.
* connected only if they are "ready", which, at least with WData
Module
modules, might take some time. It applies the loaded project file.
*
* \note the loader for project files is very tolerant. It does not abort. It tries to load as much as possible. The only exception that gets
* thrown whenever the file could not be opened.
...
...
src/
core/kernel/
modules/data/WMData.cpp
→
src/modules/data/WMData.cpp
View file @
a5f89e76
...
...
@@ -25,33 +25,36 @@
#include <string>
#include <vector>
#include "
../../..
/common/WAssert.h"
#include "
../../..
/common/WIOTools.h"
#include "
../../..
/common/WPropertyHelper.h"
#include "
../../..
/dataHandler/WDataSet.h"
#include "
../../..
/dataHandler/WDataSetSingle.h"
#include "
../../..
/dataHandler/WDataSetScalar.h"
#include "
../../..
/dataHandler/WDataSetTimeSeries.h"
#include "
../../..
/dataHandler/WDataSetVector.h"
#include "
../../..
/dataHandler/WSubject.h"
#include "
../../..
/dataHandler/WDataHandler.h"
#include "
../../..
/dataHandler/WDataTexture3D.h"
#include "
../../..
/dataHandler/WEEG2.h"
#include "
../../..
/dataHandler/exceptions/WDHException.h"
#include "
../../..
/dataHandler/io/WReaderBiosig.h"
#include "
../../..
/dataHandler/io/WReaderEEGASCII.h"
#include "
../../..
/dataHandler/io/WReaderLibeep.h"
#include "
../../..
/dataHandler/io/WReaderNIfTI.h"
#include "
../../..
/dataHandler/io/WPagerEEGLibeep.h"
#include "
../../..
/dataHandler/io/WReaderELC.h"
#include "
../../..
/dataHandler/io/WReaderFiberVTK.h"
#include "
../../..
/graphicsEngine/WGEColormapping.h"
#include "
../../..
/kernel/WModuleOutputData.h"
#include "
core
/common/WAssert.h"
#include "
core
/common/WIOTools.h"
#include "
core
/common/WPropertyHelper.h"
#include "
core
/dataHandler/WDataSet.h"
#include "
core
/dataHandler/WDataSetSingle.h"
#include "
core
/dataHandler/WDataSetScalar.h"
#include "
core
/dataHandler/WDataSetTimeSeries.h"
#include "
core
/dataHandler/WDataSetVector.h"
#include "
core
/dataHandler/WSubject.h"
#include "
core
/dataHandler/WDataHandler.h"
#include "
core
/dataHandler/WDataTexture3D.h"
#include "
core
/dataHandler/WEEG2.h"
#include "
core
/dataHandler/exceptions/WDHException.h"
#include "
core
/dataHandler/io/WReaderBiosig.h"
#include "
core
/dataHandler/io/WReaderEEGASCII.h"
#include "
core
/dataHandler/io/WReaderLibeep.h"
#include "
core
/dataHandler/io/WReaderNIfTI.h"
#include "
core
/dataHandler/io/WPagerEEGLibeep.h"
#include "
core
/dataHandler/io/WReaderELC.h"
#include "
core
/dataHandler/io/WReaderFiberVTK.h"
#include "
core
/graphicsEngine/WGEColormapping.h"
#include "
core
/kernel/WModuleOutputData.h"
#include "WMData.h"
#include "data.xpm"
// This line is needed by the module loader to actually find your module. You need to add this to your module too. Do NOT add a ";" here.
W_LOADABLE_MODULE
(
WMData
)
WMData
::
WMData
()
:
WModule
(),
W
Data
Module
(),
m_fileNameSet
(
false
),
m_isTexture
(),
m_transformNoMatrix
(
4
,
4
),
...
...
@@ -105,11 +108,6 @@ boost::filesystem::path WMData::getFilename() const
return
m_fileName
;
}
MODULE_TYPE
WMData
::
getType
()
const
{
return
MODULE_DATA
;
}
void
WMData
::
connectors
()
{
// initialize connectors
...
...
@@ -121,7 +119,7 @@ void WMData::connectors()
addConnector
(
m_output
);
// call WModules initialization
WModule
::
connectors
();
W
Data
Module
::
connectors
();
}
void
WMData
::
properties
()
...
...
src/
core/kernel/
modules/data/WMData.h
→
src/modules/data/WMData.h
View file @
a5f89e76
...
...
@@ -30,10 +30,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
// #include "../../WKernel.h"
#include "../../WModule.h"
#include "../../WExportKernel.h"
#include "core/kernel/WDataModule.h"
// forward declarations
class
WDataSet
;
...
...
@@ -46,7 +43,7 @@ template< class T > class WModuleOutputData;
* inherited classes. This class builds a "source" in OpenWalnut's DataFlow Network.
* \ingroup modules
*/
class
OWKERNEL_EXPORT
WMData
:
public
WModule
class
WMData
:
public
W
Data
Module
{
public:
...
...
@@ -92,14 +89,6 @@ public:
*/
virtual
const
char
**
getXPMIcon
()
const
;
/**
* Gets the type of the module. This is useful for FAST differentiation between several modules like standard modules and data
* modules which play a special role in OpenWalnut/Kernel.
*
* \return the Type. This will return MODULE_DATA.
*/
virtual
MODULE_TYPE
getType
()
const
;
/**
* Sets the filename of the file to load. If this method is called multiple times it has no effect. It has to be called right after
* construction BEFORE running the data module.
...
...
src/
core/kernel/
modules/data/data.png
→
src/modules/data/data.png
View file @
a5f89e76
File moved
src/
core/kernel/
modules/data/data.xpm
→
src/modules/data/data.xpm
View file @
a5f89e76
File moved
src/qt4gui/qt4/WMainWindow.cpp
View file @
a5f89e76
...
...
@@ -55,7 +55,7 @@
#include "core/dataHandler/WEEG2.h"
#include "core/graphicsEngine/WGEZoomTrackballManipulator.h"
#include "core/graphicsEngine/WROIBox.h"
#include "core/kernel/
modules/data/WMData
.h"
#include "core/kernel/
WDataModule
.h"
#include "core/kernel/WKernel.h"
#include "core/kernel/WModule.h"
#include "core/kernel/WModuleCombiner.h"
...
...
@@ -458,7 +458,7 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
// data modules contain an member denoting the real data type. Currently we only have one data module and a not very modulated data
// structures.
boost
::
shared_ptr
<
W
M
Data
>
dataModule
=
boost
::
shared_static_cast
<
W
M
Data
>
(
module
);
boost
::
shared_ptr
<
WData
Module
>
dataModule
=
boost
::
shared_static_cast
<
WData
Module
>
(
module
);
// grab data and identify type
if
(
dataModule
->
getDataSet
()
->
isA
<
WDataSetSingle
>
()
&&
dataModule
->
getDataSet
()
->
isTexture
()
)
...
...
src/qt4gui/qt4/WQt4Gui.cpp
View file @
a5f89e76
...
...
@@ -46,7 +46,6 @@
#include "core/dataHandler/WDataHandler.h"
#include "core/dataHandler/WSubject.h"
#include "core/graphicsEngine/WGraphicsEngine.h"
#include "core/kernel/modules/data/WMData.h"
#include "core/kernel/WKernel.h"
#include "core/kernel/WModuleContainer.h"
#include "core/kernel/WProjectFile.h"
...
...
@@ -252,11 +251,6 @@ void WQt4Gui::slotActivateDatasetOrModuleInTree( boost::shared_ptr< WModule > mo
void
WQt4Gui
::
slotRemoveDatasetOrModuleInTree
(
boost
::
shared_ptr
<
WModule
>
module
)
{
// create a new event for this and insert it into event queue
if
(
module
->
getName
()
==
"Data Module"
)
{
boost
::
shared_ptr
<
WMData
>
dataModule
=
boost
::
shared_dynamic_cast
<
WMData
>
(
module
);
WAssert
(
dataModule
,
"Internal failure."
);
}
QCoreApplication
::
postEvent
(
m_mainWindow
->
getNetworkEditor
(),
new
WModuleRemovedEvent
(
module
)
);
QCoreApplication
::
postEvent
(
m_mainWindow
->
getControlPanel
(),
new
WModuleRemovedEvent
(
module
)
);
QCoreApplication
::
postEvent
(
m_mainWindow
,
new
WModuleRemovedEvent
(
module
)
);
...
...
src/qt4gui/qt4/controlPanel/WQtControlPanel.cpp
View file @
a5f89e76
...
...
@@ -38,7 +38,7 @@
#include "core/common/WLogger.h"
#include "core/common/WPredicateHelper.h"
#include "core/dataHandler/WDataSet.h"
#include "core/kernel/
modules/data/WMData
.h"
#include "core/kernel/
WDataModule
.h"
#include "core/kernel/WKernel.h"
#include "core/kernel/WModule.h"
#include "core/kernel/WModuleContainer.h"
...
...
@@ -255,7 +255,7 @@ bool WQtControlPanel::event( QEvent* event )
// finally add the module
// TODO(schurade): is this differentiation between data and "normal" modules really needed?
if
(
boost
::
shared_dynamic_cast
<
W
M
Data
>
(
e1
->
getModule
()
).
get
()
)
if
(
boost
::
shared_dynamic_cast
<
WData
Module
>
(
e1
->
getModule
()
).
get
()
)
{
addDataset
(
e1
->
getModule
(),
0
);
}
...
...
@@ -666,7 +666,7 @@ void WQtControlPanel::selectTreeItem()
createCompatibleButtons
(
module
);
{
boost
::
shared_ptr
<
W
M
Data
>
dataModule
=
boost
::
shared_dynamic_cast
<
W
M
Data
>
(
module
);
boost
::
shared_ptr
<
WData
Module
>
dataModule
=
boost
::
shared_dynamic_cast
<
WData
Module
>
(
module
);
// if the selected module contains a texture, select the corresponding texture in the texture sorter.
if
(
dataModule
)
...
...
@@ -779,8 +779,8 @@ void WQtControlPanel::selectDataModule( boost::shared_ptr< WDataSet > dataSet )
{
if
(
dynamic_cast
<
WQtDatasetTreeItem
*
>
(
*
it
)
)
{
boost
::
shared_ptr
<
W
M
Data
>
dataModule
;
dataModule
=
boost
::
shared_dynamic_cast
<
W
M
Data
>
(
(
dynamic_cast
<
WQtDatasetTreeItem
*
>
(
*
it
)
)
->
getModule
()
);
boost
::
shared_ptr
<
WData
Module
>
dataModule
;
dataModule
=
boost
::
shared_dynamic_cast
<
WData
Module
>
(
(
dynamic_cast
<
WQtDatasetTreeItem
*
>
(
*
it
)
)
->
getModule
()
);
if
(
dataModule
)
{
if
(
dataModule
->
getDataSet
()
==
dataSet
)
...
...
src/qt4gui/qt4/networkEditor/WQtNetworkEditor.h
View file @
a5f89e76
...
...
@@ -35,7 +35,6 @@
#include <QtGui/QDockWidget>
#include <QtGui/QVBoxLayout>
#include "core/kernel/modules/data/WMData.h"
#include "../WQtCombinerToolbar.h"
#include "layout/WNetworkLayout.h"
#include "WQtNetworkItem.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment