ADTF
3.18.4
Source Code for Substream Dumper Plugin
Location
./src/examples/src/
adtf
/filters/standard_filters/substream_element_dumper/
adtf
Namespace for entire ADTF SDK.
Definition:
ddl_specification_legacy.dox:2
Build Environment
To see how to set up the build environment have a look at
ADTF CMake Environment
this implementation shows:
how to create a data triggered
Filter
.
how to work with
adtf::filter::riddler::cSubstreamFilter
and
adtf::filter::riddler::cSubstreamHandling
.
Implementation
#include <
adtffiltersdk/adtf_filtersdk.h
>
using namespace
adtf::ucom
;
using namespace
adtf::base
;
using namespace
adtf::streaming
;
using namespace
adtf::filter
;
// This filter derives from cSubstreamFilter instead of cFilter
// If you want to use the substream handling functionality with a different base class, use the substream_filter<> template.
class
cDemoSubStreamElementDumper:
public
cSubstreamFilter
{
public
:
ADTF_CLASS_ID_NAME
(cDemoSubStreamElementDumper,
"demo_substream_element_dumper.filter.adtf.cid"
,
"Substream Element Dumper"
);
public
:
cDemoSubStreamElementDumper()
{
// cSubstreamFilter will create a single input pin (the name can be specified via the constructor and defaults to "input").
// If you want to handle multiple inputs use cSubstreamHandling directly.
SetDescription(
"input"
,
"Incoming data of substreams."
);
// Register our properties
m_strSubstreamName.SetDescription(
"The name of the substream that the element should be dumped of."
);
RegisterPropertyVariable(
"substream_name"
, m_strSubstreamName);
m_strElementName.SetDescription(
"The name of the element to be dumped, i.e. 'parent.intermediate.leaf'"
);
RegisterPropertyVariable(
"element_name"
, m_strElementName);
// Set a short description for the component
SetDescription(
"Use this filter to dump a single element of a specific substream."
);
// Set help link to jump to documentation from ADTF Configuration Editor
SetHelpLink(
"$(ADTF_DIR)/doc/adtf_html/page_demo_substream_element_dumper.html"
);
}
tResult
Init(tInitStage eStage)
{
RETURN_IF_FAILED
(cSubstreamFilter::Init(eStage));
if
(eStage == StageNormal)
{
// Here we add a handler for a specific (DDL) element of a substream based on our properties.
// Please take a look at all the other Add* functions of cSubstreamHandling.
AddElementHandler<double>(m_strSubstreamName, m_strElementName, [
this
](tNanoSeconds
/* tmTimestamp */
,
double
fValue)
{
// Whenever a sample is received on the specified substream, the given element value
// will be retrieved from the sample and passed to this handler.
LOG_INFO
(
"%s.%s = %f"
, m_strSubstreamName->c_str(), m_strElementName->c_str(), fValue);
});
}
RETURN_NOERROR
;
}
tResult
Shutdown(tInitStage eStage)
{
if
(eStage == StageNormal)
{
RemoveAllHandlers();
}
return
cSubstreamFilter::Shutdown(eStage);
}
private
:
property_variable<std::string> m_strSubstreamName;
property_variable<std::string> m_strElementName;
};
// this creates the plugin entry methods and class factories
ADTF_PLUGIN
(
"Substream Element Dumper Plugin"
, cDemoSubStreamElementDumper);
ADTF_PLUGIN
#define ADTF_PLUGIN(__plugin_identifier,...)
The ADTF Plugin Macro will add the code of a adtf::ucom::ant::IPlugin implementation.
Definition:
adtf_plugin.h:22
adtf_filtersdk.h
Copyright © Audi Electronics Venture GmbH.
LOG_INFO
#define LOG_INFO(...)
Logs an info message.
Definition:
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/std/log.h:130
RETURN_IF_FAILED
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
Definition:
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/base/error.h:44
RETURN_NOERROR
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition:
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/base/error.h:27
ADTF_CLASS_ID_NAME
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Common macro to enable correct treatment of class identifier AND Class Name by IClassInfo.
Definition:
class_id.h:33
A_UTILS_NS::cResult
A common result class usable as return value throughout.
Definition:
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/result.h:18
adtf::base
Namespace for the ADTF Base SDK.
Definition:
page_base_namespaces.dox:11
adtf::filter::riddler::cSubstreamFilter
substream_filter<> cSubstreamFilter
Helper typedef to use substream_filter with the default filter base class.
Definition:
substream_handling.h:205
adtf::filter
Namespace for the ADTF Filter SDK.
Definition:
mainpage_filtersdk.dox:10
adtf::streaming
Namespace for the ADTF Streaming SDK.
Definition:
mainpage_streaming.dox:10
adtf::ucom
Namespace for the ADTF uCOM3 SDK.
Definition:
testing/include/adtftesting/test_runtime.h:12
Copyright © VW Group. All rights reserved. (Generated on Wed Jul 3 2024 by doxygen 1.9.1)