ADTF  3.18.2
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...
 
void SetSubStream (std::string_view 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 SetSubStream (std::string_view 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);
}
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());
}
}
private:
adtf::streaming::ISampleWriter* m_pWriter = nullptr;
std::set<uint32_t> m_oEnabledSubStreams;
uint32_t m_nTriggerCounter = 0;
};
Copyright © Audi Electronics Venture GmbH.
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
#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
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
Interface for sample writers that write to sample streams via output pins.
Wrapper class that facilitates the handling of output samples.
Definition: sample.h:347
Generator template to create an instance of a ant::IStreamType class for penguin::stream_meta_type_pl...

Definition at line 151 of file stream_type_helper.h.

Member Function Documentation

◆ SetSubStream() [1/2]

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.

◆ SetSubStream() [2/2]

void SetSubStream ( std::string_view  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.