Commit 84d7ba13 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[ADD] Now the ModuleOutputConnector has a dataChangedCondition as same as the...

[ADD] Now the ModuleOutputConnector has a dataChangedCondition as same as the input connector has. This is to ease to listen in container modules on the output of certain data. Ofcourse we could subscribe to the signal instead, but the InputConnector does provide the same convenience, hence this feature.
parent 9808142f
......@@ -27,15 +27,16 @@
#include <boost/signals2/signal.hpp>
#include <boost/signals2/connection.hpp>
#include "WModuleInputConnector.h"
#include "../common/WCondition.h"
#include "WModuleConnectorSignals.h"
#include "WModuleInputConnector.h"
#include "WModuleOutputConnector.h"
WModuleOutputConnector::WModuleOutputConnector( boost::shared_ptr< WModule > module, std::string name, std::string description ):
WModuleConnector( module, name, description )
WModuleOutputConnector::WModuleOutputConnector( boost::shared_ptr< WModule > module, std::string name, std::string description )
: WModuleConnector( module, name, description ),
m_dataChangedCondition( new WCondition() )
{
// initialize members
}
WModuleOutputConnector::~WModuleOutputConnector()
......@@ -81,6 +82,7 @@ boost::signals2::connection WModuleOutputConnector::subscribeSignal( MODULE_CONN
void WModuleOutputConnector::propagateDataChange()
{
signal_DataChanged( boost::shared_ptr<WModuleConnector>(), shared_from_this() );
m_dataChangedCondition->notify();
}
bool WModuleOutputConnector::isInputConnector() const
......@@ -92,3 +94,9 @@ bool WModuleOutputConnector::isOutputConnector() const
{
return true;
}
boost::shared_ptr< WCondition > WModuleOutputConnector::getDataChangedCondition()
{
return m_dataChangedCondition;
}
......@@ -36,7 +36,7 @@ class WModule;
#include "../common/WPrototyped.h"
#include "../common/WTransferable.h"
class WCondition;
/**
* Class implementing output connection functionality between modules.
......@@ -92,6 +92,13 @@ public:
*/
virtual bool lazyConnectable( boost::shared_ptr<WModuleConnector> con );
/**
* Gets the condition variable that gets fired whenever new data is available.
*
* \return the condition
*/
boost::shared_ptr< WCondition > getDataChangedCondition();
/**
* Returns the prototype of the WTransferable used in this connector.
*
......@@ -135,6 +142,11 @@ private:
* Signal fired whenever new data should be propagated. Represented by DATA_CHANGED enum- element.
*/
t_GenericSignalType signal_DataChanged;
/**
* Condition fired whenever data changes.
*/
boost::shared_ptr< WCondition > m_dataChangedCondition;
};
#endif // WMODULEOUTPUTCONNECTOR_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