ADTF  3.14.3
cSubStreamTypes

Helper class to create a stream type with multiple Substreams. More...

Inheritance diagram for cSubStreamTypes:
[legend]

Public Member Functions

void SetSubStream (const char *strName, uint32_t nSubStreamId, const flash::cStreamTypeHelper &oType)
 Adds or updates a Substream. More...
 
- Public Member Functions inherited from cSubStreamTypes
template<typename MetaType = stream_meta_type_substreams, typename = std::enable_if_t<is_stream_meta_type<MetaType>::value, MetaType>>
 cSubStreamTypes (const MetaType &=MetaType())
 Constructor. More...
 
 cSubStreamTypes (const ucom::ant::iobject_ptr< const ant::IStreamMetaType > &pMetaType)
 Constructor. More...
 
virtual ~cSubStreamTypes ()
 Destructor.
 
void SetSubStream (const char *strName, uint32_t nSubStreamId, const ucom::ant::iobject_ptr< const ant::IStreamType > &pType)
 Adds or updates a Substream. More...
 
void SetRequestProperties (const base::ant::IProperties &oProperties, const char *strSubStreamName="")
 Sets the common or Substream specific request properties. More...
 
ucom::ant::object_ptr< const streaming::ant::IStreamTypeGetSubStreamType (const char *strName) const
 Retrieve the Stream Type of a given Substream. More...
 
ucom::ant::object_ptr< ant::IStreamTypeGetStreamType () const
 Get a Stream Type that contains all currently set Substreams. More...
 

Additional Inherited Members

- Protected Attributes inherited from cSubStreamTypes
std::unique_ptr< cImplementation > m_pImplementation
 

Detailed Description

Helper class to create a stream type with multiple Substreams.

Example Usage

#include <set>
class cMyFilter: public adtf::filter::cFilter
{
public:
ADTF_CLASS_ID_NAME(cMyFilter, "my_filter.filter.example.cid", "My Filter");
cMyFilter()
{
CreateRunner("generate_samples");
m_pWriter = CreateRequestableOutputPin("output", oSubStreams);
}
tResult EnableSubStream(adtf::streaming::ISampleWriter* /*pWriter*/,
uint32_t nSubStreamId,
const adtf::base::IProperties* /*pRequestProperties*/) override
{
if (nSubStreamId > 2)
{
RETURN_ERROR_DESC(ERR_INVALID_ARG, "No Substream with id %d available", nSubStreamId);
}
m_oEnabledSubStreams.insert(nSubStreamId);
RETURN_NOERROR;
}
void DisableSubStream(adtf::streaming::ISampleWriter* /*pWriter*/, uint32_t nSubStreamId) override
{
m_oEnabledSubStreams.erase(nSubStreamId);
}
tResult Process(adtf::base::tNanoSeconds tmTrigger, adtf::streaming::IRunner* /*pRunner*/) override
{
++m_nTriggerCounter;
for (const auto& nSubStreamId: m_oEnabledSubStreams)
{
adtf::streaming::output_sample_data<uint32_t> oNewData(tmTrigger, m_nTriggerCounter, nSubStreamId);
m_pWriter->Write(oNewData.Release());
}
RETURN_NOERROR;
}
private:
adtf::streaming::ISampleWriter* m_pWriter = nullptr;
std::set<uint32_t> m_oEnabledSubStreams;
uint32_t m_nTriggerCounter = 0;
};
Copyright © Audi Electronics Venture GmbH.
#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
Defintion of a property set container interface.
Helper class to create a stream type with multiple Substreams.
void SetSubStream(const char *strName, uint32_t nSubStreamId, const flash::cStreamTypeHelper &oType)
Adds or updates a Substream.
The Interface defines a runnable item of the GraphObjects providing a IRuntimeBehaviour.
Definition: runner_intf.h:24
Generator template to create an instance of a IStreamType class for stream_meta_type_plain ("adtf/pla...
Interface for sample writers that write to sample streams via output pins.
Wrapper class that facilitates the handling of output samples.
Definition: sample.h:710

Definition at line 150 of file stream_type_helper.h.

Member Function Documentation

◆ SetSubStream()

void SetSubStream ( const char *  strName,
uint32_t  nSubStreamId,
const flash::cStreamTypeHelper oType 
)

Adds or updates a Substream.

Parameters
[in]strNameThe name of the Substream, required to be unique, this is the key to the map of substreams.
[in]nSubStreamIdThe id of the Substream, should be unique, but can be reused for aliases etc.
[in]oTypeThe type of the substream.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)