class cDemoSubStreamGenerator: public cFilter
{
public:
"demo_substream_generator.filter.adtf.cid",
"Demo Substream Generator");
public:
struct tExampleStructWithUnit { uint32_t val{}; };
cDemoSubStreamGenerator()
{
SetDescription("Use this filter to generate data of multiple substreams whenever a timer triggers.");
SetHelpLink("$(ADTF_DIR)/doc/adtf_html/page_demo_substream_generator.html");
CreateRunner("generate_samples");
SetDescription("generate_samples", "Runner to periodically trigger the function which generates the substreams.");
auto oExampleStructDefinition = structure<tExampleStructWithUnit>("tExampleStructWithUnit").Add("val", &tExampleStructWithUnit::val);
cSubStreamTypes oSubStreams;
oSubStreams.SetSubStream("stream1", 0, stream_type_plain<uint32_t>());
oSubStreams.SetSubStream("stream2", 1, stream_type_plain<uint32_t>());
oSubStreams.SetSubStream("stream3", 2, stream_type_plain<uint32_t>());
oSubStreams.SetSubStream("stream4", 3, oExampleStructDefinition);
m_pWriter = CreateOutputPin("output", oSubStreams);
SetDescription("output", "Provides the generated substreams.");
}
tResult Process(tNanoSeconds tmTrigger, IRunner* )
override
{
++m_nTriggerCounter;
for (uint32_t nSubStreamId: {0, 1, 2})
{
output_sample_data<uint32_t> oNewData(tmTrigger, m_nTriggerCounter + (nSubStreamId * 1000), nSubStreamId);
m_pWriter->Write(oNewData.Release());
}
output_sample_data<tExampleStructWithUnit> oExampleOutputSampleData(tmTrigger, tExampleStructWithUnit{m_nTriggerCounter + (3 * 1000)}, 3);
m_pWriter->Write(oExampleOutputSampleData.Release());
}
private:
ISampleWriter* m_pWriter = nullptr;
uint32_t m_nTriggerCounter = 0;
};
ADTF_PLUGIN(
"Demo Substream Generator Plugin", cDemoSubStreamGenerator);
#define ADTF_PLUGIN(__plugin_identifier,...)
The ADTF Plugin Macro will add the code of a adtf::ucom::ant::IPlugin implementation.
Copyright © Audi Electronics Venture GmbH.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Common macro to enable correct treatment of class identifier AND Class Name by IClassInfo.
A common result class usable as return value throughout.
Namespace for the ADTF Base SDK.
Namespace for the ADTF Filter SDK.
Namespace for the ADTF Streaming SDK.
Namespace for the ADTF uCOM3 SDK.
alias namespace for the A_UTILS Library.
definition of the ddl namespace
Generator template to create baseunits.