Commit 8aaa8d56 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - distance map now uses forwarding connectors

parent b2907da8
......@@ -55,11 +55,12 @@ WModuleConnector::WModuleConnector( boost::shared_ptr<WModule> module, std::stri
// connect standard signals
// NOTE: these signals are NOT emitted by the connector this one is connected to, since a module can't send a "connection
// closed" message if the connection is closed.
subscribeSignal( CONNECTION_ESTABLISHED, boost::bind( &WModuleConnector::notifyConnectionEstablished, this, _1, _2 ) );
subscribeSignal( CONNECTION_CLOSED, boost::bind( &WModuleConnector::notifyConnectionClosed, this, _1, _2 ) );
signal_ConnectionEstablished.connect( getSignalHandler( CONNECTION_ESTABLISHED ) );
signal_ConnectionClosed.connect( getSignalHandler( CONNECTION_CLOSED ) );
subscribeSignal( CONNECTION_ESTABLISHED, boost::bind( &WModuleConnector::notifyConnectionEstablished, this, _1, _2 ) );
subscribeSignal( CONNECTION_CLOSED, boost::bind( &WModuleConnector::notifyConnectionClosed, this, _1, _2 ) );
}
WModuleConnector::~WModuleConnector()
......@@ -229,7 +230,7 @@ void WModuleConnector::disconnect( boost::shared_ptr<WModuleConnector> con, bool
// signal closed connection
signal_ConnectionClosed( shared_from_this(), con );
con->signal_ConnectionClosed( con, shared_from_this() );
con->signal_ConnectionClosed( shared_from_this(), con );
}
catch( const std::exception& e )
{
......
......@@ -79,6 +79,19 @@ void WModuleInputConnector::disconnectSignals( boost::shared_ptr<WModuleConnecto
WModuleConnector::disconnectSignals( con );
}
boost::signals2::connection WModuleInputConnector::subscribeSignal( MODULE_CONNECTOR_SIGNAL signal,
t_GenericSignalHandlerType notifier )
{
// connect DataChanged signal
switch ( signal )
{
case DATA_CHANGED:
return signal_DataChanged.connect( notifier );
default: // we do not know this signal: maybe the base class knows it
return WModuleConnector::subscribeSignal( signal, notifier );
}
}
void WModuleInputConnector::notifyDataChange( boost::shared_ptr<WModuleConnector> /*input*/,
boost::shared_ptr<WModuleConnector> output )
{
......@@ -98,9 +111,9 @@ void WModuleInputConnector::notifyConnectionEstablished( boost::shared_ptr<WModu
// since the output connector is not able to fill the parameter "input" we need to forward this message and fill it with the
// proper information
// NOTE: connection established also emits a data changed signal since the data available at the connector has changed.
signal_DataChanged( shared_from_this(), there );
m_dataChangedCondition->notify();
notifyDataChange( here, there );
// forward
WModuleConnector::notifyConnectionEstablished( here, there );
}
......@@ -70,6 +70,16 @@ public:
*/
boost::shared_ptr< WCondition > getDataChangedCondition();
/**
* Connects (subscribes) a specified notify function with a signal this module instance is offering.
*
* \exception WModuleSignalSubscriptionFailed thrown if the signal can't be connected.
*
* \param signal the signal to connect to.
* \param notifier the notifier function to bind.
*/
boost::signals2::connection subscribeSignal( MODULE_CONNECTOR_SIGNAL signal, t_GenericSignalHandlerType notifier );
protected:
/**
......
......@@ -107,21 +107,6 @@ protected:
WModuleInputData< T >::notifyDataChange( input, output );
}
/**
* 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 )
{
// a connection -> grab the data and forward it to the output connector
m_out->updateData( WModuleInputData< T >::getData() );
// and forward
WModuleInputData< T >::notifyDataChange( here, there );
}
private:
};
......
......@@ -25,6 +25,7 @@
#ifndef WMODULEOUTPUTFORWARDDATA_H
#define WMODULEOUTPUTFORWARDDATA_H
#include <iostream>
#include <string>
#include <boost/shared_ptr.hpp>
......
......@@ -308,11 +308,21 @@ protected:
*
* \param output the remote connector propagating the event.
*/
virtual void notifyDataChange( boost::shared_ptr< WModuleConnector > /*input*/,
virtual void notifyDataChange( boost::shared_ptr< WModuleConnector > input,
boost::shared_ptr< WModuleConnector > output )
{
// just copy the data and add one
data = boost::shared_dynamic_cast< WModuleOutputData< WTestTransferableBase > >( output )->getData()->get() + 1;
boost::shared_ptr< WModuleOutputData< WTestTransferableBase > > o = boost::shared_dynamic_cast< WModuleOutputData< WTestTransferableBase > >( output );
if ( !o.get() )
{
return;
}
boost::shared_ptr< WTestTransferableBase > ds = o->getData();
if ( ds.get() )
{
data = ds->get() + 1;
}
// std::cout << "change to " << data << " in " << input->getCanonicalName() << " from " << output->getCanonicalName()
// << std::endl;
......
......@@ -188,8 +188,8 @@ void WMMarchingCubes::slotPropertyChanged( std::string propertyName )
{
double isoValue = m_properties->getValue< double >( propertyName );
debugLog() << "Update isosurface for isovalue: " << isoValue << std::endl;
generateSurfacePre( isoValue );
renderSurface();
//generateSurfacePre( isoValue );
//renderSurface();
debugLog() << "Updating done." << std::endl;
}
else if( propertyName == "Use Texture" )
......
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