/**
	 * Handler method for input of perturbed measurement data. All
	 * measurements are collected and will contribute to the finally
	 * generated distribution which will be computed and pushed onward
	 * as soon as the configured amount of trials is reached.
	 *
	 * It is not necessary to trigger the compoent before via the
	 * {@code TriggerInput} input and noisy data may be pushed
	 * asynchronously. However, each push will result in an event to
	 * be issued on the {@code Sync} output.
	 */
    void dataIn( const EventType& e )
    {
		LOG4CPP_TRACE( logger, getName() << " Received perturbed measurement with timestamp " << e.time() );

		if ( m_bStopped ) 
		{
			LOG4CPP_TRACE( logger, getName() << " Covariance estimation has not been triggered yet, ignore measurement" );
			return;
		}
			
		m_counter ++;
		LOG4CPP_TRACE( logger, getName() << " Current counter: " << m_counter << ", go on until: " << m_size );

		// Compute incremental covariance
		typename ResultType::value_type estimate = incrementalEstimate ( *e );

		// Check list size
		if ( m_counter == m_size )
		{
			// push onward final result
			LOG4CPP_DEBUG( logger, getName() << " Terminate and push final result" );
			m_outPortDist.send( ResultType ( e.time(), estimate ) );

			boost::mutex::scoped_lock l( m_mutex );
			m_bStopped = true;

			return;
		}
		
		// If not reached, send next trigger event
		LOG4CPP_TRACE( logger, getName() << " Triggering computation..." );
		m_outPortSync.send( Measurement::Button( Measurement::now(), m_button ) );
	}
Пример #2
0
	/** called when a new item arrives */
	void receive( const EventType& event )
	{
		m_data.push_back( *event );
		if (++m_size > m_maxLength) {
			m_data.erase( m_data.begin() );
			m_size--;
		}
		m_outPort.send( Measurement::Measurement< typename std::vector< typename EventType::value_type > >( event.time(), m_data ) );
	}