ADTF
Loading...
Searching...
No Matches
adtf::filter::cSampleStreamingSource Class Reference

#include <sample_streaming_source.h>

Inherits adtf::ucom::catwo::object< streaming::ant::INamedGraphObject, streaming::ant::IDataBinding, streaming::ant::IInterfaceBinding, streaming::ant::IRuntimeBehaviour, streaming::ant::IDynamicDataBinding, streaming::ant::IDynamicInterfaceBinding, streaming::ant::IStreamingService, streaming::ant::IStreamingSource, streaming::ant::ISampleStreamingSource, base::ant::IConfiguration >, adtf::filter::cGraphObject, and adtf::streaming::ant::streaming_level_machine.

Public Types

template<typename T>
using iobject_ptr = adtf::ucom::ant::iobject_ptr<T>
 
- Public Types inherited from adtf::filter::cGraphObject
enum class  tRecoverableAction : uint8_t { Log = 0 , Fatal = 1 }
 

Public Member Functions

tResult Init () override
 
tResult StartStreaming () override
 
tResult StopStreaming () override
 
tResult SetName (const char *strName) override
 
tResult GetName (base::ant::IString &&strName) const override
 
tResult SetParent (const ucom::ant::IObject *poParentObject) override
 
tResult GetParent (const ucom::ant::IObject *&poParentObject) const override
 
tResult GetPins (ucom::ant::iobject_list< streaming::ant::IPin > &oPins) const override
 
tResult FindPin (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pPin) const override
 
tResult GetBindingObjects (ucom::ant::iobject_list< streaming::ant::IBindingObject > &lstBindingObject) override
 
tResult GetBindingObjects (ucom::ant::iobject_list< const streaming::ant::IBindingObject > &lstBindingObject) const override
 
tResult FindBindingObject (const char *strName, ucom::ant::iobject_ptr< const ucom::ant::IObject > &pIBindingObject) const override
 
tResult FindBindingObject (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pIBindingObject) override
 
tResult GetRunners (ucom::ant::iobject_list< streaming::ant::IRunner > &lstRunners) const override
 
tResult FindRunner (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pRunner) const override
 
tResult GetInnerPipes (ucom::ant::iobject_list< streaming::ant::ITriggerPipe > &lstInnerTriggerPipes) const override
 
tResult RequestPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType, ucom::ant::iobject_ptr< streaming::ant::IInPin > &pInPin) override
 
tResult RequestPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType, ucom::ant::iobject_ptr< streaming::ant::IOutPin > &pOutPin) override
 
tResult RequestBindingObject (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType, ucom::ant::iobject_ptr< streaming::ant::IBindingClient > &pBindingClient) override
 
tResult RequestBindingObject (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType, ucom::ant::iobject_ptr< streaming::ant::IBindingServer > &pBindingServer) override
 
tResult SetState (tStreamingState eFilterState) override
 
tStreamingState GetState () override
 
tResult GetProperties (ucom::ant::iobject_ptr< const base::ant::IProperties > &pProperties) const override
 
tResult GetProperties (ucom::ant::iobject_ptr< base::ant::IProperties > &pProperties) override
 
tResult AttachConfiguration (const char *strName, base::ant::IConfiguration &oAttachedConfiguration) override
 
tResult DetachConfiguration (const char *strName) override
 
- Public Member Functions inherited from adtf::ucom::catwo::object< streaming::ant::INamedGraphObject, streaming::ant::IDataBinding, streaming::ant::IInterfaceBinding, streaming::ant::IRuntimeBehaviour, streaming::ant::IDynamicDataBinding, streaming::ant::IDynamicInterfaceBinding, streaming::ant::IStreamingService, streaming::ant::IStreamingSource, streaming::ant::ISampleStreamingSource, base::ant::IConfiguration >
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object.
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying.
 
void Destroy () const override
 Switch from non-virtual destructor to virtual destructor.
 
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object.
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying.
 
void Destroy () const override
 Switch from non-virtual destructor to virtual destructor.
 
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object.
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying.
 
void Destroy () const override
 Switch from non-virtual destructor to virtual destructor.
 
- Public Member Functions inherited from adtf::ucom::ant::IObject
 ADTF_IID (IObject, "object.ant.ucom.adtf.iid")
 
- Public Member Functions inherited from adtf::filter::cGraphObject
 cGraphObject ()
 Default Constructor.
 
 ~cGraphObject () override
 Destructor.
 
virtual tResult Process (base::flash::tNanoSeconds tmTrigger, streaming::ant::IRunner *pRunner)
 
virtual tResult ProcessInput (base::flash::tNanoSeconds tmTrigger, streaming::flash::ISampleReader *pReader)
 
virtual tResult ProcessInput (streaming::flash::ISampleReader *pReader, const ucom::ant::iobject_ptr< const streaming::ant::ISample > &pSample)
 
virtual tResult ProcessInput (streaming::flash::ISampleReader *pReader, base::flash::tNanoSeconds tmSample, const void *pSampleData, size_t nSampleDataSize)
 
template<typename ReaderType = cPinReader>
ReaderType * CreateInputPin (const char *strName, bool bDataInTrigger=true, bool bForwardTriggerViaOutputPins=true)
 
template<typename ReaderType = cPinReader>
ReaderType * CreateInputPin (const char *strName, const cStreamTypeHelper &oType, bool bDataInTrigger=true, bool bForwardTriggerViaOutputPins=true)
 
template<typename ReaderType = cPinReader, typename CALLABLE = std::function<tResult(base::flash::tNanoSeconds)>, std::enable_if_t< std::is_invocable_r_v< tResult, std::decay_t< CALLABLE >, base::flash::tNanoSeconds >, bool > = true>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnTriggerCallback, bool bForwardTriggerViaOutputPins=true)
 
template<typename ReaderType = cPinReader, typename CALLABLE = std::function<tResult(const ucom::ant::iobject_ptr<const streaming::ant::ISample>&)>, std::enable_if_t< std::is_invocable_r_v< tResult, std::decay_t< CALLABLE >, const ucom::ant::iobject_ptr< const streaming::ant::ISample > & >, bool > = true>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnSampleCallback, bool bForwardTriggerViaOutputPins=true)
 
template<typename ReaderType = cPinReader, typename CALLABLE = std::function<tResult(base::flash::tNanoSeconds, const void*, size_t)>, std::enable_if_t< std::is_invocable_r_v< tResult, std::decay_t< CALLABLE >, base::flash::tNanoSeconds, const void *, size_t >, bool > = true>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnSampleDataCallback, bool bForwardTriggerViaOutputPins=true)
 
template<typename Type, typename ReaderType = cPinReader, typename CALLABLE = std::function<tResult(base::flash::tNanoSeconds, const Type&)>, std::enable_if_t< std::is_invocable_r_v< tResult, std::decay_t< CALLABLE >, base::flash::tNanoSeconds, const Type & >, bool > = true>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnDataCallback, bool bForwardTriggerViaOutputPins=true)
 
virtual tResult AcceptType (streaming::flash::ISampleReader *pReader, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 
template<typename WriterType = cPinWriter>
WriterType * CreateOutputPin (const char *strName)
 
template<typename WriterType = cPinWriter>
WriterType * CreateOutputPin (const char *strName, const cStreamTypeHelper &oType)
 
template<typename RequestableWriterType = streaming::requestable_writer<>>
RequestableWriterType * CreateRequestableOutputPin (const char *strName, const cStreamTypeHelper &oType=streaming::ant::stream_meta_type_anonymous())
 
streaming::ant::IRunnerCreateRunner (const char *strName, const cTriggerHint &oTriggerHint=cNoTriggerHint(), bool bForwardTriggerViaOutputPins=true)
 
template<typename CALLABLE, std::enable_if_t< std::is_invocable_r_v< tResult, std::decay_t< CALLABLE >, base::flash::tNanoSeconds >, bool > = true>
streaming::ant::IRunnerCreateRunner (const char *strName, CALLABLE &&fnRunFunction, const cTriggerHint &oTriggerHint=cNoTriggerHint(), bool bForwardTriggerViaOutputPins=true)
 
template<typename Interface, typename Instance>
void CreateInterfaceServer (const char *strName, ucom::ant::enable_object_ptr_from_this< Instance > *pInstance)
 
template<typename Interface>
void CreateInterfaceServer (const char *strName, const ucom::ant::iobject_ptr< Interface > &pInstance)
 
template<typename Interface>
interface_client< Interface > CreateInterfaceClient (const char *strName)
 
template<typename ReaderType = cPinReader>
std::shared_ptr< ReaderType > CreateReader (const char *strName, const cStreamTypeHelper &oType)
 
template<typename WriterType = cPinWriter>
std::shared_ptr< WriterType > CreateWriter (const char *strName, const cStreamTypeHelper &oType)
 
template<typename CALLABLE, std::enable_if_t< std::is_invocable_r_v< tResult, std::decay_t< CALLABLE >, base::flash::tNanoSeconds >, bool > = true>
ucom::ant::object_ptr< streaming::ant::IRunnerRegisterRunner (const char *strName, CALLABLE &&fnRunFunction)
 
tResult RegisterRunner (const ucom::ant::iobject_ptr< streaming::ant::IRunner > &pRunner) override
 
tResult RegisterRunner (const char *strName, base::flash::IRunnable &oRunnable)
 
tResult RegisterRunner (const char *strName, adtf::base::ant::IRunnable &oRunnable) override
 
tResult ConfigureDataInTrigger (const char *strRunnerName, const char *strPinName)
 
tResult ConfigureDataOutTrigger (const char *strRunnerName, const char *strPinName)
 
tResult ConfigureTimerTrigger (const char *strRunnerName, tTimeStamp tmPeriod)
 
tResult ConfigureThreadTrigger (const char *strRunnerName, bool bCallCyclic)
 
virtual tResult RequestDynamicInputPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 
virtual tResult RequestDynamicOutputPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 
virtual tResult RequestDynamicInterfaceClient (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType)
 
virtual tResult RequestDynamicInterfaceServer (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType)
 
virtual tResult EnableSubStream (streaming::flash::ISampleWriter *pWriter, uint32_t nSubStreamId, const base::ant::IProperties *pRequestProperties=nullptr)
 
virtual void DisableSubStream (streaming::flash::ISampleWriter *pWriter, uint32_t nSubStreamId)
 
tResult RequestPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType, ucom::ant::iobject_ptr< streaming::ant::IInPin > &pInPin)
 For internal use. This will call RequestDynamicInputPin().
 
tResult RequestPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType, ucom::ant::iobject_ptr< streaming::ant::IOutPin > &pOutPin)
 For internal use. This will call RequestDynamicOutputPin().
 
tResult RequestBindingObject (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType, ucom::ant::iobject_ptr< streaming::ant::IBindingClient > &pClient)
 For internal use. This will call RequestDynamicInterfaceClient().
 
tResult RequestBindingObject (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType, ucom::ant::iobject_ptr< streaming::ant::IBindingServer > &pServer)
 For internal use. This will call RequestDynamicInterfaceServer().
 
void RegisterPropertyVariable (const char *strName, base::ant::cPropertyVariable &oPropertyVariable)
 
void SetDescription (const char *strDescription)
 
void SetDescription (const char *strItem, const char *strDescription)
 
void SetEditor (const char *strName, const char *strUrl)
 
void SetHelpLink (const char *strUrl)
 
tResult ActivatePins () override
 
util::log::ILogChannel * CreateLogChannel (std::string_view strName, base::elasto::IErrorHandling::tAction eDefaultErrorAction=base::elasto::IErrorHandling::tAction::Stop, tRecoverableAction eDefaultRecoverableAction=tRecoverableAction::Log, util::log::tLogLevel eDefaultLogLevel=util::log::tLogLevel::Detail)
 
util::log::ILogChannel * GetLogChannel (std::string_view strName={})
 
util::log::ILogChannel * a_util_get_current_log_channel () const noexcept
 
tResult SetName (const char *strName)
 
tResult SetParent (const ucom::ant::IObject *oParentObject)
 
ucom::object_ptr< services::ant::IMacroResolverGetParentMacroResolver () const
 
- Public Member Functions inherited from adtf::streaming::flash::cNamedGraphObject
tResult GetName (base::ant::IString &&strName) const
 
tResult SetName (const char *strName)
 
tResult SetParent (const ucom::ant::IObject *pParentObject)
 
tResult GetParent (const ucom::ant::IObject *&poParentObject) const
 
- Public Member Functions inherited from adtf::streaming::ant::cDataBinding
tResult GetPins (ucom::ant::iobject_list< IPin > &lstPins) const
 private d-pointer
 
tResult FindPin (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pPin) const
 
virtual tResult RegisterPin (const ucom::ant::iobject_ptr< IPin > &pIPin)
 
tResult RegisterPin (const ucom::ant::iobject_ptr< IInPin > &pIInPin)
 
tResult RegisterPin (const ucom::ant::iobject_ptr< IOutPin > &pIOutPin)
 
virtual tResult UnregisterPin (const ucom::ant::iobject_ptr< IPin > &pIPin)
 
tResult ReleasePins ()
 
virtual tResult DeactivatePins ()
 
tResult Disconnect ()
 
- Public Member Functions inherited from adtf::streaming::ant::cInterfaceBinding
 cInterfaceBinding ()
 D Pointer Implementation for private members.
 
virtual ~cInterfaceBinding ()
 
tResult GetBindingObjects (ucom::ant::iobject_list< IBindingObject > &lstBindingObject)
 
tResult GetBindingObjects (ucom::ant::iobject_list< const IBindingObject > &lstBindingObject) const
 
tResult FindBindingObject (const char *strName, ucom::ant::iobject_ptr< const ucom::ant::IObject > &pIBindingObject) const
 
tResult FindBindingObject (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pIBindingObject)
 
virtual tResult RegisterBindingObject (const ucom::ant::iobject_ptr< IBindingObject > &pBindingObject)
 
tResult RegisterBindingObject (const ucom::ant::iobject_ptr< IBindingServer > &pBindingServer)
 
tResult RegisterBindingObject (const ucom::ant::iobject_ptr< IBindingClient > &pBindingClient)
 
tResult UnregisterBindingObject (const ucom::ant::iobject_ptr< const IBindingObject > &pBindingObject)
 
tResult Unbind ()
 
tResult ReleaseBindingObjects ()
 
- Public Member Functions inherited from adtf::streaming::ant::cRuntimeBehaviour
tResult GetRunners (ucom::ant::iobject_list< IRunner > &lstRunners) const
 copydoc IRuntimeBehaviour::GetRunners
 
tResult FindRunner (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pRunner) const
 copydoc IRuntimeBehaviour::FindRunner
 
tResult GetInnerPipes (ucom::ant::iobject_list< ITriggerPipe > &lstInnerpTriggerPipe) const
 copydoc IRuntimeBehaviour::GetInnerPipes
 
virtual tResult UnregisterRunner (const ucom::ant::iobject_ptr< IRunner > &pRunner)
 
tResult ReleaseRunners ()
 
virtual tResult RegisterInnerPipe (const ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe)
 
virtual tResult UnregisterInnerPipe (const ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe)
 
tResult ReleaseTriggerPipes ()
 
- Public Member Functions inherited from adtf::base::flash::cConfiguration
 cConfiguration ()
 Default constructor.
 
virtual ~cConfiguration ()
 Destructor.
 
tResult GetProperties (adtf::ucom::ant::iobject_ptr< const IProperties > &pProperties) const
 
tResult GetProperties (adtf::ucom::ant::iobject_ptr< IProperties > &pProperties)
 
tResult AttachConfiguration (const char *strName, IConfiguration &oAttachedConfiguration)
 
tResult DetachConfiguration (const char *strName)
 
tResult RegisterPropertyVariable (const char *strName, ant::cPropertyVariable &oPropertyVariable)
 

Additional Inherited Members

- Protected Types inherited from adtf::ucom::ant::level_machine< Subclass, LevelType, START_LEVEL >
enum  tDirection : uint8_t { Inc = 0 , Dec = 1 }
 Direction of entering a new Level. More...
 
typedef tResult(Subclass::* tChangeMethod) ()
 Defintion of function type called within the handler implementation.
 
- Protected Member Functions inherited from adtf::ucom::ant::IObject
 ~IObject ()=default
 Protected destructor --> Only the final implementation can be destroyed!
 
- Protected Member Functions inherited from adtf::filter::cGraphObject
void SetupStreamer (std::shared_ptr< streaming::flash::ISampleStreamer > pStreamer, const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 
void CreateInputPin (std::shared_ptr< streaming::flash::ISampleReader > pReader, bool bDataInTrigger=true, bool bForwardTriggerViaOutputPins=true)
 
template<typename CALLABLE, std::enable_if_t< std::is_invocable_r_v< tResult, std::decay_t< CALLABLE >, base::flash::tNanoSeconds >, bool > = true>
void CreateInputPin (std::shared_ptr< streaming::flash::ISampleReader > pReader, CALLABLE &&fnTriggerCallback, bool bForwardTriggerViaOutputPins)
 
void CreateInputPin (std::shared_ptr< streaming::flash::ISampleReader > pReader, const char *strTriggerFunctionName, bool bForwardTriggerViaOutputPins=true)
 
void CreateOutputPin (std::shared_ptr< streaming::flash::ISampleWriter > pWriter)
 
void ConfigureRunner (streaming::ant::IRunner *pRunner, const cTriggerHint &oTriggerHint, bool bForwardTriggerViaOutputPins)
 
std::string GetFullName ()
 
- Protected Member Functions inherited from adtf::streaming::ant::cDataBinding
 cDataBinding ()
 CTOR.
 
virtual ~cDataBinding ()
 DTOR.
 
- Protected Member Functions inherited from adtf::streaming::ant::cRuntimeBehaviour
 cRuntimeBehaviour ()
 private _d-pointer
 
virtual ~cRuntimeBehaviour ()
 DTOR.
 
- Protected Member Functions inherited from adtf::streaming::ant::streaming_level_machine
 streaming_level_machine (const streaming_level_machine &)=delete
 
 streaming_level_machine (streaming_level_machine &&)=delete
 
streaming_level_machineoperator= (const streaming_level_machine &)=delete
 
streaming_level_machineoperator= (streaming_level_machine &&)=delete
 
tResult SetLevel (IStreamingService::tStreamingState eStreamingState)
 
virtual tResult Construct ()
 
virtual tResult Destruct ()
 
virtual tResult Shutdown ()
 
- Protected Member Functions inherited from adtf::ucom::ant::level_machine< Subclass, LevelType, START_LEVEL >
virtual ~level_machine ()=default
 DTOR.
 
LevelType GetLevel () const
 
template<typename ... InnerHandlers>
tResult ChangeLevel (LevelType eLevel)
 
- Protected Attributes inherited from adtf::filter::cGraphObject
ucom::ant::object_ptr< services::ant::IReferenceClock_clock
 
std::unique_ptr< cImplementation > m_pImplementation
 
- Protected Attributes inherited from adtf::streaming::flash::cNamedGraphObject
const adtf::ucom::ant::IObjectm_pParent = nullptr
 parent of the named object
 
std::string m_strName
 name of the
 

Detailed Description

Base class for ADTF sample streaming sources

Use this as a base for implementing an ADTF sample streaming source (that lives and works in the ADTF Streaming Graph). For all available functionality please see adtf::filter::cGraphObject which is a direct base of this class.

Please have a look at the following examples on how to implement sample streaming sources:

Most of the time you

  • create pins in your constructor
  • perform other long running or property based initialization in Init()
  • reset your internal data and start threads and timers in StartStreaming().

Base class for adtf::filter::cFilter, adtf::filter::cSampleStreamingSource and adtf::filter::cSampleStreamingSink.

Basic Data, Interface and Runtime Behaviour

The class provides many convenience member functions that facilitate the following operations:

Dynamic Objects

For the implementation of dynamic pins, interface clients and interface servers overwrite one or more of the following virtual functions:

Error Handling

All Create* methods throw exceptions in case of errors. The ADTF SDK is prepared to cope with exceptions within any of the graph objects methods, especially in your subclasses' constructors. You are also free to throw exceptions (THROW_ERROR_DESC) in methods that return tResult error codes. But if you call methods that return a tResult error code yourself, make sure to wrap them with the appropriate RETURN_IF_FAILED or THROW_IF_FAILED macros.

Member Function Documentation

◆ Init()

tResult adtf::filter::cSampleStreamingSource::Init ( )
overridevirtual

Initializes the source.

Perform your (long running) initialization based on properties here.

Example Usage

class cMySource: public adtf::filter::cSampleStreamingSource
{
public:
ADTF_CLASS_ID_NAME(cMySource, "my_source.streaming_source.adtf.cid", "My Source");
cMySource()
{
RegisterPropertyVariable("my_config_file", m_strConfigFileName);
}
tResult Init() override
{
RETURN_IF_FAILED(cSampleStreamingSource::Init());
adtf::util::cString strConfigFileContents;
RETURN_IF_FAILED(adtf::util::cFileSystem::ReadTextFile(m_strConfigFileName, strConfigFileContents));
LOG_INFO("My config file contents: %s", strConfigFileContents.GetPtr());
}
private:
};
#define LOG_INFO(...)
Logs an info message.
Definition log.h:388
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Definition class_id.h:33
Property Variable template for the given T. A Property Variable will store a copy of a property value...
Definition configuration.h:808
void RegisterPropertyVariable(const char *strName, base::ant::cPropertyVariable &oPropertyVariable)
Definition sample_streaming_source.h:50

Init transition while changing from tStreamingState::State_Constructed to tStreamState::State_Initialized.

Use this transition callback to initialize your service when it depends on the connections. Before Init is called, all pins are requested, connected and their properties are set.

Note
Make sure to call the parent implementation of the used base class at the beginning within your overriding function!
Returns
Returns a standard result code which depends on the implementation.
Return values
ERR_NOERRORSuccessfully constructed
anyError The Streaming Graph will stop initializing.

Reimplemented from adtf::streaming::ant::streaming_level_machine.

◆ StartStreaming()

tResult adtf::filter::cSampleStreamingSource::StartStreaming ( )
overridevirtual

Start your threads and timers in this method.

Example Usage

class cMySource: public adtf::filter::cSampleStreamingSource
{
public:
ADTF_CLASS_ID_NAME(cMySource, "my_source.streaming_source.adtf.cid", "My Source");
cMySource()
{
}
tResult Init() override
{
RETURN_IF_FAILED(cSampleStreamingSource::Init());
RETURN_IF_FAILED(_runtime->GetObject(m_pClock));
}
{
RETURN_IF_FAILED(cSampleStreamingSource::StartStreaming());
m_nCounter = 0;
m_oTimer = adtf::system::kernel_timer(strMyName + ".generation_timer",
1000000,
1000000,
[&]
{
adtf::streaming::output_sample_data<uint32_t> oOutputData(m_pClock->GetStreamTimeNs());
oOutputData = ++m_nCounter;
m_pWriter->Write(oOutputData.Release());
});
}
{
m_oTimer.Stop();
}
private:
adtf::system::kernel_timer m_oTimer;
adtf::streaming::ISampleWriter* m_pWriter = nullptr;
adtf::ucom::object_ptr<adtf::services::IReferenceClock> m_pClock;
uint32_t m_nCounter = 0;
};
WriterType * CreateOutputPin(const char *strName)
Definition graph_object.h:1332
Generator template to create an instance of a ant::IStreamType class for penguin::stream_meta_type_pl...
Definition streammetatypeplain.h:315
Definition kernel_timer.h:20
adtf_util::cString get_named_graph_object_full_name(const INamedGraphObject &oGraphObject)

StatrStreaming transition while changing from tStreamState::State_Initialized to tStreamingState::State_Streaming.

Use this transition callback to initalize and start threads and timers.

Note
Make sure to call the parent implementation of the used base class at the beginning within your overriding function!
Returns
Returns a standard result code which depends on the implementation.

Reimplemented from adtf::streaming::ant::streaming_level_machine.

◆ StopStreaming()

tResult adtf::filter::cSampleStreamingSource::StopStreaming ( )
overridevirtual

Stop your threads and timers in this method.

Example Usage

class cMySource: public adtf::filter::cSampleStreamingSource
{
public:
ADTF_CLASS_ID_NAME(cMySource, "my_source.streaming_source.adtf.cid", "My Source");
cMySource()
{
}
tResult Init() override
{
RETURN_IF_FAILED(cSampleStreamingSource::Init());
RETURN_IF_FAILED(_runtime->GetObject(m_pClock));
}
{
RETURN_IF_FAILED(cSampleStreamingSource::StartStreaming());
m_nCounter = 0;
m_oTimer = adtf::system::kernel_timer(strMyName + ".generation_timer",
1000000,
1000000,
[&]
{
adtf::streaming::output_sample_data<uint32_t> oOutputData(m_pClock->GetStreamTimeNs());
oOutputData = ++m_nCounter;
m_pWriter->Write(oOutputData.Release());
});
}
{
m_oTimer.Stop();
}
private:
adtf::system::kernel_timer m_oTimer;
adtf::streaming::ISampleWriter* m_pWriter = nullptr;
adtf::ucom::object_ptr<adtf::services::IReferenceClock> m_pClock;
uint32_t m_nCounter = 0;
};

StopStreaming transition while changing from tStreamingState::State_Streaming to tStreamState::State_Initialized.

Use this transition callback to stop and destroy threads and timers.

Keep in mind, that streaming and triggers might still occur during and after this function is called. Streaming will only have stopped completely before any other following state change. If your streaming service has any blocking operations during the handling of triggers, make sure that you cancel them in this function.

Note
Make sure to call the parent implementation of the used base class at the end within your overriding function!
Returns
Returns a standard result code which depends on the implementation.
Return values
ERR_NOERRORSuccessfully constructed
anyError The Streaming Graph will stop starting.

Reimplemented from adtf::streaming::ant::streaming_level_machine.


The documentation for this class was generated from the following file: