#include "demo_signal_generator.h"
ADTF_PLUGIN(
"Demo Signal Generator Plugin", cCounterGenerator);
cCounterGenerator::cCounterGenerator()
{
SetDescription("trigger", "Runner to periodically trigger the function which increases the signal value");
SetDescription("Use this filter to provide monotonically increasing values for Signal Registry.");
SetHelpLink("$(ADTF_DIR)/doc/adtf_html/page_demo_signal_generator.html");
}
tResult cCounterGenerator::Init(tInitStage eStage)
{
if (eStage == StageNormal)
{
object_ptr<ISignalRegistry> pRegistry;
m_pProvider));
RETURN_IF_FAILED(m_pProvider->AddSignal({m_nCounterID,
"counter",
"calls",
"counter that increases monotonically", 0, 0},
this));
}
}
tResult cCounterGenerator::EnableSignal(ISignalRegistry::tSignalID nSignalID)
{
std::lock_guard<std::mutex> oGuard(m_oEnabledSignalsMutex);
m_oEnabledSignals.insert(nSignalID);
}
tResult cCounterGenerator::DisableSignal(ISignalRegistry::tSignalID nSignalID)
{
std::lock_guard<std::mutex> oGuard(m_oEnabledSignalsMutex);
m_oEnabledSignals.erase(nSignalID);
}
tResult cCounterGenerator::Process(tNanoSeconds tmTimeOfTrigger,
IRunner* )
{
++m_nCounter;
std::lock_guard<std::mutex> oGuard(m_oEnabledSignalsMutex);
if (m_oEnabledSignals.count(m_nCounterID))
{
m_pProvider->UpdateSignal(m_nCounterID, {tmTimeOfTrigger, static_cast<double>(m_nCounter)});
}
}
#define ADTF_PLUGIN(__plugin_identifier,...)
The ADTF Plugin Macro will add the code of a adtf::ucom::ant::IPlugin implementation.
#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.
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
std::chrono::seconds seconds
Compatibility to C++11 std::chrono::seconds
adtf_util::cString get_named_graph_object_full_name(const INamedGraphObject &oGraphObject)
Helper function to retrieve a full qualified unique name of an object registered in IFilterGraph.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.