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

[CHANGE] - Changing connector type checkking, first test codes

parent 22e42c45
...@@ -82,7 +82,7 @@ MARK_AS_ADVANCED( EXECUTABLE_OUTPUT_PATH ) ...@@ -82,7 +82,7 @@ MARK_AS_ADVANCED( EXECUTABLE_OUTPUT_PATH )
#----------------------- #-----------------------
# -Wno-long-long since on Ubuntu 8.10 it won't compile without it # -Wno-long-long since on Ubuntu 8.10 it won't compile without it
# -ansi force ISO-C++98 compliance (not GNU++98) # -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_DEBUG "-g -DDEBUG -O0" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "" FORCE ) SET( CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "" FORCE )
SET( CMAKE_CXX_FLAGS_STATIC "-O3" CACHE STRING "" FORCE ) SET( CMAKE_CXX_FLAGS_STATIC "-O3" CACHE STRING "" FORCE )
......
...@@ -229,7 +229,16 @@ void WKernel::doLoadDataSets( std::vector< std::string > fileNames ) ...@@ -229,7 +229,16 @@ void WKernel::doLoadDataSets( std::vector< std::string > fileNames )
shared_ptr< WModule > mod = m_moduleFactory->create( m_moduleFactory->getPrototypeByName( "Data Module" ) ); shared_ptr< WModule > mod = m_moduleFactory->create( m_moduleFactory->getPrototypeByName( "Data Module" ) );
mod->getProperties()->setValue( "filename" , ( *iter ) ); mod->getProperties()->setValue( "filename" , ( *iter ) );
m_moduleContainer->add( mod ); 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 boost::shared_ptr< WDataHandler > WKernel::getDataHandler() const
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <boost/thread/locks.hpp> #include <boost/thread/locks.hpp>
// this is necessary since we have some kind of cyclic includes // this is necessary since we have some kind of cyclic includes
template < typename T > class WModuleInputData; template < typename T > class WModuleOutputData;
#include "WModuleOutputData.hpp" #include "WModuleOutputData.hpp"
#include "exceptions/WModuleConnectorUnconnected.h" #include "exceptions/WModuleConnectorUnconnected.h"
...@@ -47,14 +47,14 @@ class WModuleInputData: public WModuleInputConnector ...@@ -47,14 +47,14 @@ class WModuleInputData: public WModuleInputConnector
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* \param module the module which is owner of this connector. * \param module the module which is owner of this connector.
* \param name The name of this connector. * \param name The name of this connector.
* \param description Short description 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 ) :WModuleInputConnector( module, name, description )
{ {
}; };
...@@ -62,13 +62,13 @@ public: ...@@ -62,13 +62,13 @@ public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~WModuleInputData() virtual ~WModuleInputData<T>()
{ {
}; };
/** /**
* Gives the currently set data. * Gives the currently set data.
* *
* \throw WModuleConnectorUnconnected if someone is requesting data but this connector is not connected. * \throw WModuleConnectorUnconnected if someone is requesting data but this connector is not connected.
* *
* \return the data currently set. * \return the data currently set.
...@@ -99,11 +99,11 @@ public: ...@@ -99,11 +99,11 @@ public:
return dat; return dat;
}; };
/** /**
* Checks whether the specified connector is an input connector and compatible with T. * Checks whether the specified connector is an input connector and compatible with T.
* *
* \param con the connector to check against. * \param con the connector to check against.
* *
* \return true if compatible. * \return true if compatible.
*/ */
virtual bool connectable( boost::shared_ptr<WModuleConnector> con ) virtual bool connectable( boost::shared_ptr<WModuleConnector> con )
......
...@@ -29,8 +29,10 @@ ...@@ -29,8 +29,10 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include "../common/WLogger.h"
// this is necessary since we have some kind of cyclic includes // this is necessary since we have some kind of cyclic includes
template < typename T > class WModuleOutputData; template < typename T > class WModuleInputData;
#include "WModuleInputData.hpp" #include "WModuleInputData.hpp"
#include "WModuleOutputConnector.h" #include "WModuleOutputConnector.h"
...@@ -44,14 +46,14 @@ class WModuleOutputData: public WModuleOutputConnector ...@@ -44,14 +46,14 @@ class WModuleOutputData: public WModuleOutputConnector
{ {
public: public:
/** /**
* Constructor. * Constructor.
* *
* \param module the module which is owner of this connector. * \param module the module which is owner of this connector.
* \param name The name of this connector. * \param name The name of this connector.
* \param description Short description 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 ) :WModuleOutputConnector( module, name, description )
{ {
m_data = boost::shared_ptr<T>(); m_data = boost::shared_ptr<T>();
...@@ -60,14 +62,14 @@ public: ...@@ -60,14 +62,14 @@ public:
/** /**
* Destructor. * Destructor.
*/ */
virtual ~WModuleOutputData() virtual ~WModuleOutputData<T>()
{ {
}; };
/** /**
* Update the data associated * Update the data associated
* *
* \param data * \param data
*/ */
virtual void updateData( boost::shared_ptr<T> data ) virtual void updateData( boost::shared_ptr<T> data )
{ {
...@@ -77,9 +79,9 @@ public: ...@@ -77,9 +79,9 @@ public:
propagateDataChange(); propagateDataChange();
}; };
/** /**
* Gives the currently set data. * Gives the currently set data.
* *
* \return the data currently set. * \return the data currently set.
*/ */
const boost::shared_ptr<T> getData() const const boost::shared_ptr<T> getData() const
...@@ -87,17 +89,21 @@ public: ...@@ -87,17 +89,21 @@ public:
return m_data; return m_data;
}; };
/** /**
* Checks whether the specified connector is an input connector and compatible with T. * Checks whether the specified connector is an input connector and compatible with T.
* *
* \param con the connector to check against. * \param con the connector to check against.
* *
* \return true if compatible. * \return true if compatible.
*/ */
virtual bool connectable( boost::shared_ptr<WModuleConnector> con ) 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 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 // 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 // same check again. But since we do not know what checks will be added to WModuleOutputConnector::connectable in the
// future we forward the call. // future we forward the call.
...@@ -111,7 +117,7 @@ protected: ...@@ -111,7 +117,7 @@ protected:
private: private:
/** /**
* The data associated with this connector. * The data associated with this connector.
*/ */
boost::shared_ptr<T> m_data; boost::shared_ptr<T> m_data;
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "../../dataHandler/WDataSet.h"
#include "../../dataHandler/WDataSetSingle.h"
#include "../../dataHandler/exceptions/WDHException.h" #include "../../dataHandler/exceptions/WDHException.h"
#include "../../dataHandler/io/WLoaderNIfTI.h" #include "../../dataHandler/io/WLoaderNIfTI.h"
...@@ -69,8 +71,8 @@ boost::shared_ptr< WDataSet > WMData::getDataSet() ...@@ -69,8 +71,8 @@ boost::shared_ptr< WDataSet > WMData::getDataSet()
void WMData::connectors() void WMData::connectors()
{ {
// initialize connectors // initialize connectors
m_output= boost::shared_ptr< WModuleOutputData< WDataSet > >( new WModuleOutputData< WDataSet >( shared_from_this(), m_output= boost::shared_ptr< WModuleOutputData< WDataSet > >( new WModuleOutputData< WDataSet >(
"out1", "A loaded dataset." ) 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. // 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() ...@@ -170,7 +172,7 @@ void WMData::moduleMain()
} }
// notify // notify
m_output->updateData( m_dataSet ); //m_output->updateData( m_dataSet );
ready(); ready();
// go to idle mode // go to idle mode
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "../../kernel/WModuleOutputData.hpp" #include "../../kernel/WModuleOutputData.hpp"
#include "../../dataHandler/WDataSet.h" #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 * Module for encapsulating WDataSets. It can encapsulate almost everything, but is intended to be used with WDataSets and its
......
...@@ -168,8 +168,8 @@ void WMMarchingCubes::connectors() ...@@ -168,8 +168,8 @@ void WMMarchingCubes::connectors()
{ {
// initialize connectors // initialize connectors
m_input = boost::shared_ptr<WModuleInputData< boost::shared_ptr< WDataSet > > >( m_input = boost::shared_ptr<WModuleInputData< WDataSetSingle > >(
new WModuleInputData< boost::shared_ptr< WDataSet > >( shared_from_this(), new WModuleInputData< WDataSetSingle >( shared_from_this(),
"in", "Dataset to compute isosurface for." ) "in", "Dataset to compute isosurface for." )
); );
......
...@@ -181,7 +181,7 @@ private: ...@@ -181,7 +181,7 @@ private:
*/ */
void renderMesh( WTriangleMesh* mesh ); void renderMesh( WTriangleMesh* mesh );
boost::shared_ptr< WModuleInputData< boost::shared_ptr< WDataSet > > > m_input; //!< Input connector required by this module. boost::shared_ptr< WModuleInputData< WDataSetSingle > > 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 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. static const int m_triTable[256][16]; //!< Lookup table for triangles used in the construction of the isosurface.
......
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