7 #ifndef _ADTF_ADTF2_LEGACY_FILTER_HEADER_
8 #define _ADTF_ADTF2_LEGACY_FILTER_HEADER_
39 return SetType(pStreamType);
52 return Create(strName, pConstHelper);
64 bool m_bManualTriggerRequired =
false;
90 return Create(strName, pConstHelper);
99 m_bManualTriggerRequired = bManualTriggerRequired;
111 if (m_bManualTriggerRequired)
146 template<
typename Child>
199 return adtf::base::get_property<bool>(*
static_cast<Child*
>(
this), strName, bDefault);
211 return adtf::base::get_property<int>(*
static_cast<Child*
>(
this), strName, nDefault);
223 return adtf::base::get_property<double>(*
static_cast<Child*
>(
this), strName,
236 return adtf::base::get_property<adtf_util::cString>(*
static_cast<Child*
>(
this),
237 strName, strDefault);
275 return pMetaType->IsCompatible(*pType.
Get(), *pCurrentType.
Get());
359 bSamplesFound =
false;
360 for (
auto& pReader: m_vecOfReaders)
363 if (
IS_OK(pReader->GetNextSample(pSample)))
367 bSamplesFound =
true;
371 while (bSamplesFound);
383 for (
auto& itReader : m_vecOfReaders)
390 for (
auto& itWriter : m_vecOfWriters)
409 oInput.SetAcceptTypeCallback(
414 return Register(oInput);
425 return Register(oOutput);
444 template<
typename TriggerFunctionImpl>
453 TriggerFunctionImpl m_oTriggerFunc;
463 if (strTriggerFuncName.IsEmpty())
465 strTriggerFuncName =
"trigger";
466 m_oTriggerFunc.SetName(strTriggerFuncName);
468 m_oTriggerFunc.SetFilter(*
this);
477 if (eStage == tInitStage::StageFirst)
487 else if (eStage == tInitStage::StageNormal)
491 else if(eStage == tInitStage::StageGraphReady)
493 RETURN_IF_FAILED(m_oTriggerFunc.Init(cLegacyStateHandler::StageGraphReady));
503 return m_oTriggerFunc.Start();
511 return m_oTriggerFunc.Stop();
519 if (eStage == tInitStage::StageFirst)
523 else if(eStage == tInitStage::StageNormal)
525 RETURN_IF_FAILED(m_oTriggerFunc.Shutdown(cLegacyStateHandler::StageNormal));
527 else if(eStage == tInitStage::StageGraphReady)
529 RETURN_IF_FAILED(m_oTriggerFunc.Shutdown(cLegacyStateHandler::StageGraphReady));
532 return cFilter::Shutdown(eStage);
538 using ant::cLegacyInputPin;
539 using ant::cLegacyOutputPin;
540 using ant::cLegacyFilter;
546 #define __sample_read_lock(__sample, __type, __variable) \
547 adtf::ucom::object_ptr_shared_locked<const adtf::streaming::ISampleBuffer> __variable##Buffer; \
548 RETURN_IF_FAILED(__sample->Lock(__variable##Buffer)); \
549 const __type* __variable = reinterpret_cast<const __type*>(__variable##Buffer->GetPtr());
552 #define __sample_write_lock(__sample, __type, __variable) \
553 adtf::ucom::object_ptr_locked<adtf::streaming::ISampleBuffer> __variable##Buffer; \
554 RETURN_IF_FAILED(__sample->WriteLock(__variable##Buffer, sizeof(__type))); \
555 __type* __variable = reinterpret_cast<__type*>(__variable##Buffer->GetPtr());
558 #define ADTF_LEGACY_FILTER_NAME(_class_identifier_, \
560 _legacyfilterclass_, \
562 class _legacyfilterclass_ : public adtf::adtf2::ant::legacy_filter<_triggerfunction_> \
565 ADTF_CLASS_ID_NAME(_legacyfilterclass_, _class_identifier_, _class_name_); \
567 _legacyfilterclass_() = default; \
568 virtual ~_legacyfilterclass_() = default; \
572 #define ADTF_LEGACY_FILTER_PLUGIN(_class_identifier_, \
575 ADTF_LEGACY_FILTER_NAME(_class_identifier_,\
577 _triggerfunction_##filter,\
579 ADTF_PLUGIN(_class_name_ " Plugin", \
580 _triggerfunction_##filter);
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
tInt64 tTimeStamp
type definition for a time value.
#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 IS_OK(s)
Check if result is OK.
A common result class usable as return value throughout.
Common base class for all legacy filter classes that emulates the old configuration interface.
void SetPropertyInt(const char *strName, int nValue)
Sets a Property value.
double GetPropertyFloat(const char *strName, double fDefault=0.0)
Gets a Property value.
void SetPropertyBool(const char *strName, bool bValue)
Sets a Property value.
adtf_util::cString GetPropertyStr(const tChar *strName, const tChar *strDefault="")
Gets a Property value.
bool GetPropertyBool(const char *strName, bool bDefault=false)
Gets a Property value.
int GetPropertyInt(const char *strName, int nDefault=0)
Gets a Property value.
void SetPropertyStr(const char *strName, const char *strValue)
Sets a Property value.
void SetPropertyFloat(const char *strName, double fValue)
Sets a Property value.
Common base class for all legacy filter classes.
adtf::ucom::object_ptr< adtf::services::IKernel > _kernel
pointer to the kernel service
cKernelAndClockHelper()
Constructor.
adtf::ucom::object_ptr< adtf::services::IReferenceClock > _clock
pointer to the current reference clock
Class that helps with porting old ADTF 2 Filters to ADTF 3.
tResult RegisterPin(cLegacyOutputPin &oOutput)
Compatibility method to register Pins.
tResult ConnectReadersAndWriters(adtf::filter::ant::cFilter &oFilter) override
Used internally to construct the same trigger model as used in ADTF 2.
adtf_util::cString OIGetInstanceName()
Compatibility method to retrieve the name of the current filter instance.
tResult RegisterPin(cLegacyInputPin &oInput)
Compatibility method to register Pins.
tResult Process(tTimeStamp) override
Used internally to emulate to old IPinEventSink interface.
This class helps when porting ADTF 2 Filters to ADTF 3.
tResult Create(const char *strName, const ucom::iobject_ptr< adtf::streaming::IStreamType > &pStreamType)
Initializes an instance of an Output Pin.
tResult Create(const char *strName, const ucom::iobject_ptr< const adtf::streaming::IStreamType > &pStreamType)
Initializes an instance of an Output Pin.
void SetManualTriggerRequired(bool bManualTriggerRequired)
For internal use only.
tResult Transmit(const ucom::iobject_ptr< const adtf::streaming::ISample > &pSample) override
Transmits a sample via an Output Pin.
Common base class for all legacy filter classes that emulates the old IPinEventHandler interface.
virtual tResult OnSampleReceived(cLegacyInputPin *, const adtf::ucom::iobject_ptr< const adtf::streaming::ISample > &)
This is called whenever a sample is received via one of the input Pins.
virtual tResult OnTypeChanged(cLegacyInputPin *pPin, const adtf::ucom::iobject_ptr< const adtf::streaming::IStreamType > &pType)
This is called whenever a type has been changed/received on one of the input Pins.
Common base class for all legacy filter classes that emulates the old state maschine of cFilter.
virtual tResult Stop()
Emulates the old Stop method.
virtual tResult Shutdown(tInitStage)
Emulates the old Shutdown method.
virtual tResult Start()
Emulates the old Start method.
tInitStage
Old init stages.
virtual tResult Init(tInitStage)
Emulates the old Init method.
Internal class that is the glue between the cLegacyFilter and ADTF 3.
legacy_filter()
Internal use only.
tResult Shutdown(tInitStage eStage) override
Internal use only.
tResult Init(tInitStage eStage) override
Internal use only.
tResult Stop() override
Internal use only.
tResult Start() override
Internal use only.
tResult ConfigureDataInTrigger(const char *strRunnerName, const char *strPinName)
Creates an internal trigger pipe for the given pin.
tResult ConfigureDataOutTrigger(const char *strRunnerName, const char *strPinName)
Creates an internal trigger pipe for the given pin.
adtf_util::cString m_strName
Name of the TriggerFunction used to create the IRunner.
tInitStage
The Filters InitStages will be used for the cFilterLevelmachine::Init and cFilterLevelmachine::Shutdo...
This base implementation of a sample writer is able to write to one Sample Stream which is connected ...
virtual tResult Transmit(const ucom::ant::iobject_ptr< const ISample > &pSample)
Transmits and writes a sample reference to the opened ISampleOutStream.
tResult ManualTrigger()
This is to Run a trigger call manually.
A Possible Sample Reader of a Trigger Function! Sample reader with a internal queue,...
void SetName(const char *strName)
Sets the name of the streamer.
tResult SetType(const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
Sets the StreamType of the streamer.
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
Object pointer implementation used for reference counting on objects of type IObject.
virtual T * Get() const
Get pointer to shared object.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
tResult set_property(IConfiguration &oConfiguration, const char *strNameOfValue, VALUETYPE oValue)
Set the property.
Namespace for entire ADTF SDK.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.
#define adtf_string_intf(__string__)
The adtf_string_intf Macro helps to easily create a rvalue reference of a adtf::util::cString.