#include <adtf2_support.h>
#include "demo_legacy_data_filter.h"
"Demo Legacy Data Trigger",
cDemoLegacyDataFilter);
cDemoLegacyDataFilter::cDemoLegacyDataFilter()
{
SetPropertyFloat("factor", 1.0);
set_description(*
this,
"Use this legacy filter for transmitting a received value changed by a 'factor' property.");
}
cDemoLegacyDataFilter::~cDemoLegacyDataFilter()
{
}
tResult cDemoLegacyDataFilter::Init(tInitStage eStage)
{
if (eStage == tInitStage::StageFirst)
{
object_ptr<const IStreamType> pType = make_object_ptr<stream_type_plain<double>>();
}
else if (eStage == tInitStage::StageNormal)
{
m_fFactor = GetPropertyFloat("factor");
}
}
tResult cDemoLegacyDataFilter::Start()
{
return cLegacyFilter::Start();
}
tResult cDemoLegacyDataFilter::OnSampleReceived(cLegacyInputPin* ,
const iobject_ptr<const ISample>& pSample)
{
object_ptr<ISample> pOutputSample;
{
*pOutputValue = *pInputValue * m_fFactor;
}
return m_oOutputPin.Transmit(object_ptr<const ISample>(pOutputSample));
}
tResult cDemoLegacyDataFilter::OnTypeChanged(cLegacyInputPin* pPin,
const iobject_ptr<const IStreamType>& pType)
{
return cLegacyFilter::OnTypeChanged(pPin, pType);
}
tResult cDemoLegacyDataFilter::Stop()
{
return cLegacyFilter::Stop();
}
tResult cDemoLegacyDataFilter::Shutdown(tInitStage eStage)
{
return cLegacyFilter::Shutdown(eStage);
}
Copyright © Audi Electronics Venture GmbH.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define __sample_read_lock(__sample, __type, __variable)
Compatibility macro to gain read access to a sample.
#define __sample_write_lock(__sample, __type, __variable)
Compatibility macro to gain write access to a sample.
#define ADTF_LEGACY_FILTER_PLUGIN(_class_identifier_, _class_name_, _triggerfunction_)
Macro to define an ADTF 3 Plugin that provides a legacy Filter.
tResult alloc_sample(ucom::ant::iobject_ptr< ucom::ant::IObject > &pSampleObject, const char *strSampleCID)
Helper Function to get a Sample Instance through the adtf::ucom::ant::IRuntime.
void set_description(base::ant::IConfiguration &oConfig, const char *strDescription)
Sets description information.