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
f07a9013
Commit
f07a9013
authored
Dec 03, 2009
by
Sebastian Eichelbaum
Browse files
[CHANGE] - Changing connector type checkking, first test codes
parent
22e42c45
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
32 deletions
+50
-32
src/CMakeLists.txt
src/CMakeLists.txt
+1
-1
src/kernel/WKernel.cpp
src/kernel/WKernel.cpp
+9
-0
src/kernel/WModuleInputData.hpp
src/kernel/WModuleInputData.hpp
+10
-10
src/kernel/WModuleOutputData.hpp
src/kernel/WModuleOutputData.hpp
+21
-15
src/modules/data/WMData.cpp
src/modules/data/WMData.cpp
+5
-3
src/modules/data/WMData.h
src/modules/data/WMData.h
+1
-0
src/modules/marchingCubes/WMMarchingCubes.cpp
src/modules/marchingCubes/WMMarchingCubes.cpp
+2
-2
src/modules/marchingCubes/WMMarchingCubes.h
src/modules/marchingCubes/WMMarchingCubes.h
+1
-1
No files found.
src/CMakeLists.txt
View file @
f07a9013
...
...
@@ -82,7 +82,7 @@ MARK_AS_ADVANCED( EXECUTABLE_OUTPUT_PATH )
#-----------------------
# -Wno-long-long since on Ubuntu 8.10 it won't compile without it
# -ansi force ISO-C++98 compliance (not GNU++98)
SET
(
CMAKE_CXX_FLAGS
"-pedantic -ansi -Wall -Wextra -Wno-long-long"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS
"
-frtti
-pedantic -ansi -Wall -Wextra -Wno-long-long"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS_DEBUG
"-g -DDEBUG -O0"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS_RELEASE
"-O3"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS_STATIC
"-O3"
CACHE STRING
""
FORCE
)
...
...
src/kernel/WKernel.cpp
View file @
f07a9013
...
...
@@ -229,7 +229,16 @@ void WKernel::doLoadDataSets( std::vector< std::string > fileNames )
shared_ptr
<
WModule
>
mod
=
m_moduleFactory
->
create
(
m_moduleFactory
->
getPrototypeByName
(
"Data Module"
)
);
mod
->
getProperties
()
->
setValue
(
"filename"
,
(
*
iter
)
);
m_moduleContainer
->
add
(
mod
);
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>
comps
=
m_moduleFactory
->
getCompatiblePrototypes
(
mod
);
WLogger
::
getLogger
()
->
addLogMessage
(
"Compatible Modules? -> "
,
"Kernel"
,
LL_ERROR
);
for
(
std
::
set
<
boost
::
shared_ptr
<
WModule
>
>::
iterator
iter
=
comps
.
begin
();
iter
!=
comps
.
end
();
++
iter
)
{
WLogger
::
getLogger
()
->
addLogMessage
(
"Compatible Modules: "
+
(
*
iter
)
->
getName
()
,
"Kernel"
,
LL_ERROR
);
}
}
exit
(
0
);
}
boost
::
shared_ptr
<
WDataHandler
>
WKernel
::
getDataHandler
()
const
...
...
src/kernel/WModuleInputData.hpp
View file @
f07a9013
...
...
@@ -32,7 +32,7 @@
#include <boost/thread/locks.hpp>
// this is necessary since we have some kind of cyclic includes
template
<
typename
T
>
class
WModule
In
putData
;
template
<
typename
T
>
class
WModule
Out
putData
;
#include "WModuleOutputData.hpp"
#include "exceptions/WModuleConnectorUnconnected.h"
...
...
@@ -47,14 +47,14 @@ class WModuleInputData: public WModuleInputConnector
{
public:
/**
/**
* Constructor.
*
*
* \param module the module which is owner of this connector.
* \param name The name of this connector.
* \param description Short description of this connector.
*/
WModuleInputData
(
boost
::
shared_ptr
<
WModule
>
module
,
std
::
string
name
=
""
,
std
::
string
description
=
""
)
WModuleInputData
<
T
>
(
boost
::
shared_ptr
<
WModule
>
module
,
std
::
string
name
=
""
,
std
::
string
description
=
""
)
:
WModuleInputConnector
(
module
,
name
,
description
)
{
};
...
...
@@ -62,13 +62,13 @@ public:
/**
* Destructor.
*/
virtual
~
WModuleInputData
()
virtual
~
WModuleInputData
<
T
>
()
{
};
/**
/**
* Gives the currently set data.
*
*
* \throw WModuleConnectorUnconnected if someone is requesting data but this connector is not connected.
*
* \return the data currently set.
...
...
@@ -99,11 +99,11 @@ public:
return
dat
;
};
/**
/**
* Checks whether the specified connector is an input connector and compatible with T.
*
*
* \param con the connector to check against.
*
*
* \return true if compatible.
*/
virtual
bool
connectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
...
...
src/kernel/WModuleOutputData.hpp
View file @
f07a9013
...
...
@@ -29,8 +29,10 @@
#include <boost/shared_ptr.hpp>
#include "../common/WLogger.h"
// this is necessary since we have some kind of cyclic includes
template
<
typename
T
>
class
WModule
Out
putData
;
template
<
typename
T
>
class
WModule
In
putData
;
#include "WModuleInputData.hpp"
#include "WModuleOutputConnector.h"
...
...
@@ -44,14 +46,14 @@ class WModuleOutputData: public WModuleOutputConnector
{
public:
/**
/**
* Constructor.
*
*
* \param module the module which is owner of this connector.
* \param name The name of this connector.
* \param description Short description of this connector.
*/
WModuleOutputData
(
boost
::
shared_ptr
<
WModule
>
module
,
std
::
string
name
=
""
,
std
::
string
description
=
""
)
WModuleOutputData
<
T
>
(
boost
::
shared_ptr
<
WModule
>
module
,
std
::
string
name
=
""
,
std
::
string
description
=
""
)
:
WModuleOutputConnector
(
module
,
name
,
description
)
{
m_data
=
boost
::
shared_ptr
<
T
>
();
...
...
@@ -60,14 +62,14 @@ public:
/**
* Destructor.
*/
virtual
~
WModuleOutputData
()
virtual
~
WModuleOutputData
<
T
>
()
{
};
/**
* Update the data associated
*
* \param data
/**
* Update the data associated
*
* \param data
*/
virtual
void
updateData
(
boost
::
shared_ptr
<
T
>
data
)
{
...
...
@@ -77,9 +79,9 @@ public:
propagateDataChange
();
};
/**
/**
* Gives the currently set data.
*
*
* \return the data currently set.
*/
const
boost
::
shared_ptr
<
T
>
getData
()
const
...
...
@@ -87,17 +89,21 @@ public:
return
m_data
;
};
/**
/**
* Checks whether the specified connector is an input connector and compatible with T.
*
*
* \param con the connector to check against.
*
*
* \return true if compatible.
*/
virtual
bool
connectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
{
WLogger
::
getLogger
()
->
addLogMessage
(
"MAGUCKN"
,
getCanonicalName
(),
LL_ERROR
);
WLogger
::
getLogger
()
->
addLogMessage
(
"Mit: "
+
con
->
getCanonicalName
(),
getCanonicalName
(),
LL_ERROR
);
if
(
dynamic_cast
<
WModuleInputData
<
T
>*
>
(
con
.
get
()
)
)
// NOLINT - since we really need the dynamic cast here
{
WLogger
::
getLogger
()
->
addLogMessage
(
"GEIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIL"
+
con
->
getCanonicalName
(),
getCanonicalName
(),
LL_ERROR
);
// NOTE: the upper cast already checked the compatibility completely. WModuleOutputConnector::connectable does the
// same check again. But since we do not know what checks will be added to WModuleOutputConnector::connectable in the
// future we forward the call.
...
...
@@ -111,7 +117,7 @@ protected:
private:
/**
/**
* The data associated with this connector.
*/
boost
::
shared_ptr
<
T
>
m_data
;
...
...
src/modules/data/WMData.cpp
View file @
f07a9013
...
...
@@ -25,6 +25,8 @@
#include <string>
#include <vector>
#include "../../dataHandler/WDataSet.h"
#include "../../dataHandler/WDataSetSingle.h"
#include "../../dataHandler/exceptions/WDHException.h"
#include "../../dataHandler/io/WLoaderNIfTI.h"
...
...
@@ -69,8 +71,8 @@ boost::shared_ptr< WDataSet > WMData::getDataSet()
void
WMData
::
connectors
()
{
// initialize connectors
m_output
=
boost
::
shared_ptr
<
WModuleOutputData
<
WDataSet
>
>
(
new
WModuleOutputData
<
WDataSet
>
(
shared_from_this
(),
"out
1
"
,
"A loaded dataset."
)
m_output
=
boost
::
shared_ptr
<
WModuleOutputData
<
WDataSet
>
>
(
new
WModuleOutputData
<
WDataSet
>
(
shared_from_this
(),
"out"
,
"A loaded dataset."
)
);
// add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
...
...
@@ -170,7 +172,7 @@ void WMData::moduleMain()
}
// notify
m_output
->
updateData
(
m_dataSet
);
//
m_output->updateData( m_dataSet );
ready
();
// go to idle mode
...
...
src/modules/data/WMData.h
View file @
f07a9013
...
...
@@ -36,6 +36,7 @@
#include "../../kernel/WModuleOutputData.hpp"
#include "../../dataHandler/WDataSet.h"
#include "../../dataHandler/WDataSetSingle.h"
/**
* Module for encapsulating WDataSets. It can encapsulate almost everything, but is intended to be used with WDataSets and its
...
...
src/modules/marchingCubes/WMMarchingCubes.cpp
View file @
f07a9013
...
...
@@ -168,8 +168,8 @@ void WMMarchingCubes::connectors()
{
// initialize connectors
m_input
=
boost
::
shared_ptr
<
WModuleInputData
<
boost
::
shared_ptr
<
WDataSet
>
>
>
(
new
WModuleInputData
<
boost
::
shared_ptr
<
WDataSet
>
>
(
shared_from_this
(),
m_input
=
boost
::
shared_ptr
<
WModuleInputData
<
WDataSet
Single
>
>
(
new
WModuleInputData
<
WDataSet
Single
>
(
shared_from_this
(),
"in"
,
"Dataset to compute isosurface for."
)
);
...
...
src/modules/marchingCubes/WMMarchingCubes.h
View file @
f07a9013
...
...
@@ -181,7 +181,7 @@ private:
*/
void
renderMesh
(
WTriangleMesh
*
mesh
);
boost
::
shared_ptr
<
WModuleInputData
<
boost
::
shared_ptr
<
WDataSet
>
>
>
m_input
;
//!< Input connector required by this module.
boost
::
shared_ptr
<
WModuleInputData
<
WDataSet
Single
>
>
m_input
;
//!< Input connector required by this module.
static
const
unsigned
int
m_edgeTable
[
256
];
//!< Lookup table for edges used in the construction of the isosurface.
static
const
int
m_triTable
[
256
][
16
];
//!< Lookup table for triangles used in the construction of the isosurface.
...
...
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