ADTF
cSampleStreamingSource

Base class for ADTF sample streaming sources. More...

Inheritance diagram for cSampleStreamingSource:
[legend]

Public Types

template<typename T >
using iobject_ptr = adtf::ucom::ant::iobject_ptr< T >
 

Public Member Functions

tResult Init () override
 Initializes the source. More...
 
tResult StartStreaming () override
 Start your threads and timers in this method. More...
 
tResult StopStreaming () override
 Stop your threads and timers in this method. More...
 
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 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. More...
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying. More...
 
void Destroy () const override
 Destruct and deallocate instantiations of type IObject. More...
 
- Public Member Functions inherited from IObject
 ADTF_IID (IObject, "object.ant.ucom.adtf.iid")
 Marks the IObject to be castable with the ucom_cast() More...
 
- Public Member Functions inherited from cGraphObject
 cGraphObject ()
 Default Constructor.
 
 ~cGraphObject () override
 Destructor.
 
virtual tResult Process (base::flash::tNanoSeconds tmTrigger, streaming::ant::IRunner *pRunner)
 The default Runner function of the graph object. More...
 
virtual tResult ProcessInput (base::flash::tNanoSeconds tmTrigger, streaming::flash::ISampleReader *pReader)
 Provides access to the reader of incoming data. More...
 
virtual tResult ProcessInput (streaming::flash::ISampleReader *pReader, const ucom::ant::iobject_ptr< const streaming::ant::ISample > &pSample)
 Provides access to the sample of incoming data. More...
 
virtual tResult ProcessInput (streaming::flash::ISampleReader *pReader, base::flash::tNanoSeconds tmSample, const void *pSampleData, size_t nSampleDataSize)
 Provides access to the sample content of incoming data. More...
 
template<typename ReaderType = cPinReader>
ReaderType * CreateInputPin (const char *strName, bool bDataInTrigger=true, bool bForwardTriggerViaOutputPins=true)
 Creates a new input pin with an anonymous stream type. More...
 
template<typename ReaderType = cPinReader>
ReaderType * CreateInputPin (const char *strName, const cStreamTypeHelper &oType, bool bDataInTrigger=true, bool bForwardTriggerViaOutputPins=true)
 Creates a new input pin with a given stream type. More...
 
template<typename ReaderType = cPinReader>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, std::function< tResult(base::flash::tNanoSeconds)> fnTriggerCallback, bool bForwardTriggerViaOutputPins=true)
 Creates a new input pin with a given stream type. More...
 
template<typename ReaderType = cPinReader>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, std::function< tResult(const ucom::ant::iobject_ptr< const streaming::ant::ISample > &)> fnSampleCallback, bool bForwardTriggerViaOutputPins=true)
 Creates a new input pin with a given stream type. More...
 
template<typename ReaderType = cPinReader>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, std::function< tResult(base::flash::tNanoSeconds, const void *, size_t)> fnSampleDataCallback, bool bForwardTriggerViaOutputPins=true)
 Creates a new input pin with a given stream type. More...
 
template<typename Type , typename ReaderType = cPinReader>
ReaderType * CreateInputPinWithCallback (const char *strName, const cStreamTypeHelper &oType, std::function< tResult(base::flash::tNanoSeconds, const Type &)> fnDataCallback, bool bForwardTriggerViaOutputPins=true)
 Creates a new input pin with a given stream type. More...
 
virtual tResult AcceptType (streaming::flash::ISampleReader *pReader, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 Called whenever a new type is read from a reader that has no other accept type callback (streaming::ant::cSampleReader::SetAcceptTypeCallback) registered. More...
 
template<typename WriterType = cPinWriter>
WriterType * CreateOutputPin (const char *strName)
 Creates a new output pin without an initial stream type. More...
 
template<typename WriterType = cPinWriter>
WriterType * CreateOutputPin (const char *strName, const cStreamTypeHelper &oType)
 Creates a new output pin with a given stream type. More...
 
streaming::ant::IRunnerCreateRunner (const char *strName, const cTriggerHint &oTriggerHint=cNoTriggerHint(), bool bForwardTriggerViaOutputPins=true)
 Creates a new Runner that can be triggered by an Active Runner. More...
 
streaming::ant::IRunnerCreateRunner (const char *strName, std::function< tResult(base::flash::tNanoSeconds)> fnRunFunction, const cTriggerHint &oTriggerHint=cNoTriggerHint(), bool bForwardTriggerViaOutputPins=true)
 Creates a new Runner that can be triggered by an Active Runner. More...
 
template<typename Interface , typename Instance >
void CreateInterfaceServer (const char *strName, ucom::ant::enable_object_ptr_from_this< Instance > *pInstance)
 Creates an interface server binding object. More...
 
template<typename Interface >
void CreateInterfaceServer (const char *strName, const ucom::ant::iobject_ptr< Interface > &pInstance)
 Creates an interface server binding object. More...
 
template<typename Interface >
interface_client< Interface > CreateInterfaceClient (const char *strName)
 Creates an interface client binding object. More...
 
template<typename ReaderType = cPinReader>
std::shared_ptr< ReaderType > CreateReader (const char *strName, const cStreamTypeHelper &oType)
 Creates and intializes a new sample reader. More...
 
template<typename WriterType = cPinWriter>
std::shared_ptr< WriterType > CreateWriter (const char *strName, const cStreamTypeHelper &oType)
 Creates and intializes a new sample reader. More...
 
ucom::ant::object_ptr< streaming::ant::IRunnerRegisterRunner (const char *strName, std::function< tResult(base::flash::tNanoSeconds)> fnRunMethod)
 Creates and registers a new Runner. More...
 
tResult RegisterRunner (const ucom::ant::iobject_ptr< streaming::ant::IRunner > &pRunner) override
 This is here for compatibility reasons. More...
 
tResult RegisterRunner (const char *strName, base::flash::IRunnable &oRunnable)
 This is here for compatibility reasons. More...
 
tResult RegisterRunner (const char *strName, adtf::base::ant::IRunnable &oRunnable) override
 This is here for compatibility reasons. More...
 
tResult ConfigureDataInTrigger (const char *strRunnerName, const char *strPinName)
 This is here for compatibility reasons. More...
 
tResult ConfigureDataOutTrigger (const char *strRunnerName, const char *strPinName)
 This is here for compatibility reasons. More...
 
tResult ConfigureTimerTrigger (const char *strRunnerName, tTimeStamp tmPeriod)
 This is here for compatibility reasons. More...
 
tResult ConfigureThreadTrigger (const char *strRunnerName, bool bCallCyclic)
 This is here for compatibility reasons. More...
 
virtual tResult RequestDynamicInputPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 Called whenever a new dynamic input pin is requested. More...
 
virtual tResult RequestDynamicOutputPin (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 Called whenever a new dynamic output pin is requested. More...
 
virtual tResult RequestDynamicInterfaceClient (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType)
 Called whenever a new dynamic interface client binding object is requested. More...
 
virtual tResult RequestDynamicInterfaceServer (const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType)
 Called whenever a new dynamic interface server binding object is requested. More...
 
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)
 Registers a new property variable which will always reflect the value of a property. More...
 
void SetDescription (const char *strDescription)
 Sets the description information that tools can display. More...
 
void SetEditor (const char *strName, const char *strUrl)
 Sets the editor information that tools can use to edit the objects properties, pins etc. More...
 
- Public Member Functions inherited from 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 cDataBinding
tResult GetPins (ucom::ant::iobject_list< IPin > &lstPins) const
 Returns the current Pins (only const access). More...
 
tResult FindPin (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pPin) const
 Find a Pin with the name of strName (only const access) More...
 
virtual tResult RegisterPin (const ucom::ant::iobject_ptr< IPin > &pIPin)
 Registers a Pin in a pin list. More...
 
tResult RegisterPin (const ucom::ant::iobject_ptr< IInPin > &pIInPin)
 Registers a InPin in a pin list. More...
 
tResult RegisterPin (const ucom::ant::iobject_ptr< IOutPin > &pIOutPin)
 Registers a InPin in a pin list. More...
 
virtual tResult UnregisterPin (const ucom::ant::iobject_ptr< IPin > &pIPin)
 Unregisters a Pin from the pin list. More...
 
tResult ReleasePins ()
 Unregisters all Pins from the pin list. More...
 
virtual tResult ActivatePins ()
 Activate all pins.
 
virtual tResult DeactivatePins ()
 Deactivate all pins.
 
tResult Disconnect ()
 Disconnect all pins.
 
- Public Member Functions inherited from cInterfaceBinding
 cInterfaceBinding ()
 CTOR.
 
virtual ~cInterfaceBinding ()
 DTOR.
 
tResult GetBindingObjects (ucom::ant::iobject_list< IBindingObject > &lstBindingObject)
 Return a list of all Binding Objects on lstBindingObject. More...
 
tResult GetBindingObjects (ucom::ant::iobject_list< const IBindingObject > &lstBindingObject) const
 Return a list of all Binding Objects on lstBindingObject. More...
 
tResult FindBindingObject (const char *strName, ucom::ant::iobject_ptr< const ucom::ant::IObject > &pIBindingObject) const
 This Function will search a binding object with the given strName and return it on pIBindingObject. More...
 
tResult FindBindingObject (const char *strName, ucom::ant::iobject_ptr< ucom::ant::IObject > &pIBindingObject)
 This Function will search a binding object with the given strName and return it on pIBindingObject. More...
 
virtual tResult RegisterBindingObject (const ucom::ant::iobject_ptr< IBindingObject > &pBindingObject)
 RegisterBindingObject will register the given pBindingObject within the internal registry. More...
 
tResult RegisterBindingObject (const ucom::ant::iobject_ptr< IBindingServer > &pBindingServer)
 Registers the given pBindingServer. More...
 
tResult RegisterBindingObject (const ucom::ant::iobject_ptr< IBindingClient > &pBindingClient)
 Registers the given pBindingClient. More...
 
tResult UnregisterBindingObject (const ucom::ant::iobject_ptr< const IBindingObject > &pBindingObject)
 Unregisters the given pBindingObject. More...
 
tResult Unbind ()
 Will Unbind (IBindingObject::Unbind ) every registered binding objects registered with RegisterBindingObject. More...
 
tResult ReleaseBindingObjects ()
 ReleaseBindingObjects will Unbind (IBindingObject::Unbind ) every registered binding objects registered with RegisterBindingObject and unregister them automatically. More...
 
- Public Member Functions inherited from 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)
 Unregisters a Runner. More...
 
tResult ReleaseRunners ()
 Release every registered Runners
More...
 
virtual tResult RegisterInnerPipe (const ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe)
 Registers and publishes an inner ITriggerPipe object to the IRuntimeBehaviour. More...
 
virtual tResult UnregisterInnerPipe (const ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe)
 Unregisters an inner ITriggerPipe object. More...
 
tResult ReleaseTriggerPipes ()
 Release and unregister every registered TriggerPipes. More...
 
- Public Member Functions inherited from cConfiguration
 cConfiguration ()
 Default constructor.
 
virtual ~cConfiguration ()
 Destructor.
 
tResult GetProperties (adtf::ucom::ant::iobject_ptr< const IProperties > &pProperties) const
 Gets the properties with read access. More...
 
tResult GetProperties (adtf::ucom::ant::iobject_ptr< IProperties > &pProperties)
 Gets the properties with read access. More...
 
tResult AttachConfiguration (const char *strName, IConfiguration &oAttachedConfiguration)
 Attaches the given configuration and its properties as property tree item of this. More...
 
tResult DetachConfiguration (const char *strName)
 Detaches a configuration with the specified name. More...
 
tResult RegisterPropertyVariable (const char *strName, ant::cPropertyVariable &oPropertyVariable)
 Registers a property variable that always reflects the current value of the property. More...
 

Private Attributes

std::unique_ptr< cImplementation > m_pImplementation
 

Additional Inherited Members

- Protected Types inherited from 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 IObject
 ~IObject ()=default
 Protected destructor --> Use implemented Destroy() instead of delete!
 
- Protected Member Functions inherited from cGraphObject
void SetupStreamer (std::shared_ptr< streaming::flash::ISampleStreamer > pStreamer, const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
 Used by the templated CreateInputPin() and CreateOutputPin() methods. More...
 
void CreateInputPin (std::shared_ptr< streaming::flash::ISampleReader > pReader, bool bDataInTrigger=true, bool bForwardTriggerViaOutputPins=true)
 The implementation used by CreateInputPin(const char*, bool, bool) and CreateInputPin(const char*, const cStreamTypeHelper&, bool, bool)
 
void CreateInputPin (std::shared_ptr< streaming::flash::ISampleReader > pReader, std::function< tResult(base::flash::tNanoSeconds)> fnTriggerCallback, bool bForwardTriggerViaOutputPins=true)
 The implementation used by CreateInputPin(const char*, const cStreamTypeHelper&, std::function<tResult(base::flash::tNanoSeconds)>, bool)
 
void CreateInputPin (std::shared_ptr< streaming::flash::ISampleReader > pReader, std::function< tResult(const ucom::ant::iobject_ptr< const streaming::ant::ISample > &)> fnSampleCallback, bool bForwardTriggerViaOutputPins=true)
 The implementation used by CreateInputPin(const char*, const cStreamTypeHelper&, std::function<tResult(const ucom::ant::iobject_ptr<const streaming::ant::ISample>&)>, bool)
 
void CreateInputPin (std::shared_ptr< streaming::flash::ISampleReader > pReader, std::function< tResult(base::flash::tNanoSeconds, const void *, size_t)> fnSampleDataCallback, bool bForwardTriggerViaOutputPins=true)
 The implementation used by CreateInputPin(const char*, const cStreamTypeHelper&, std::function<tResult(base::flash::tNanoSeconds, const void*, size_t)>, bool)
 
void CreateOutputPin (std::shared_ptr< streaming::flash::ISampleWriter > pWriter)
 The implementation used by CreateOutputPin(const char*, const cStreamTypeHelper&), CreateOutputPin(const char*, const cStreamTypeHelper&).
 
- Protected Member Functions inherited from cDataBinding
 cDataBinding ()
 CTOR.
 
virtual ~cDataBinding ()
 DTOR.
 
- Protected Member Functions inherited from cRuntimeBehaviour
 cRuntimeBehaviour ()
 CTOR.
 
virtual ~cRuntimeBehaviour ()
 DTOR.
 
- Protected Member Functions inherited from 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 ()
 Construct transission while changing from tStreamingState::State_Shutdown to tStreamState::State_Constructed. More...
 
virtual tResult Destruct ()
 Destruct transission while changing from tStreamingState::State_Constructed to tStreamState::State_Shutdown. More...
 
virtual tResult Shutdown ()
 Shutdown transission while changing from tStreamState::State_Initialized to tStreamingState::State_Constructed. More...
 
- Protected Member Functions inherited from level_machine< Subclass, LevelType, START_LEVEL >
virtual ~level_machine ()=default
 DTOR.
 
LevelType GetLevel () const
 Returns the current Level of the levelMachine. More...
 
template<typename ... InnerHandlers>
tResult ChangeLevel (LevelType eLevel)
 Change Level raise or decrease the Level level by level and call the given hendler methods. More...
 
- Protected Attributes inherited from cGraphObject
ucom::ant::object_ptr< services::ant::IReferenceClock_clock
 A reference to the clock service. More...
 
std::unique_ptr< cImplementation > m_pImplementation
 
- Protected Attributes inherited from 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::flash::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().

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:

Dependencies

To inform the ADTF Configuration Editor about required interfaces, please see Setup dependencies between components.

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.

Definition at line 39 of file sample_streaming_source.h.

Member Function Documentation

◆ Init()

tResult 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
{
adtf::util::cString strConfigFileContents;
RETURN_IF_FAILED(adtf::util::cFileSystem::ReadTextFile(m_strConfigFileName, strConfigFileContents));
LOG_INFO("My config file contents: %s", strConfigFileContents.GetPtr());
}
private:
};
Copyright © Audi Electronics Venture GmbH.
#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 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
Property Variable template for the given T.
void RegisterPropertyVariable(const char *strName, base::ant::cPropertyVariable &oPropertyVariable)
Registers a new property variable which will always reflect the value of a property.
tResult Init() override
Initializes the source.
Base class for ADTF sample streaming sources.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2784

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

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 streaming_level_machine.

◆ StartStreaming()

tResult 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
{
}
{
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::streaming::ISampleWriter* m_pWriter = nullptr;
uint32_t m_nCounter = 0;
};
Copyright © Audi Electronics Venture GmbH.
WriterType * CreateOutputPin(const char *strName)
Creates a new output pin without an initial stream type.
tResult StopStreaming() override
Stop your threads and timers in this method.
tResult StartStreaming() override
Start your threads and timers in this method.
Interface for sample writers that write to sample streams via output pins.
Wrapper class that facilitates the handling of output samples.
Definition: sample.h:353
Generator template to create an instance of a ant::IStreamType class for penguin::stream_meta_type_pl...
Class that wraps a kernel timer to call a method at specified intervals.
Definition: kernel_timer.h:20
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
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.

Use this transission 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 streaming_level_machine.

◆ StopStreaming()

tResult 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
{
}
{
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::streaming::ISampleWriter* m_pWriter = nullptr;
uint32_t m_nCounter = 0;
};

Use this transission 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 streaming_level_machine.