ADTF  3.18.2
cTestWriter

Tester helper class to emulate a writing OutPin to InPin connection for sending samples and type to a filters/sample sinks InPin as a stream of samples. More...

Inheritance diagram for cTestWriter:
[legend]

Public Member Functions

 cTestWriter (const ucom::ant::iobject_ptr< ucom::ant::IObject > &pObject, const char *strPinName, const filter::flash::cStreamTypeHelper &oType=streaming::stream_meta_type_anonymous())
 Construct a new Test Writer object. More...
 
 cTestWriter (const ucom::ant::iobject_ptr< ucom::ant::IObject > &pObject, const char *strPinName, const filter::flash::cStreamTypeHelper &oType, std::function< void(uint32_t, const base::IProperties *)> fnRequest, std::function< void(uint32_t)> fnCancel)
 Construct a new Test Writer object. More...
 
 ~cTestWriter ()
 Destroy the c Test Writer object.
 
void ChangeType (const filter::flash::cStreamTypeHelper &oType)
 Emulates a stream type change during writing. More...
 
template<typename T >
void Write (base::flash::tNanoSeconds tmTimeStamp, const T &xValue, bool bTrigger=false)
 Writes one sample with the sample buffer content of T into the writing stream. More...
 
template<typename T >
void Write (const T &xValue, bool bTrigger=false)
 Writes one sample with the sample buffer content of T into the writing stream. More...
 
template<typename T >
void WriteSubStream (uint32_t nSubStreamId, base::flash::tNanoSeconds tmTimeStamp, const T &xValue, bool bTrigger=false)
 Writes one sample with the sample buffer content of T into the writing stream and mark it as part of the SubStream with ID nSubStreamId. More...
 
template<typename T >
void WriteSubStream (uint32_t nSubStreamId, const T &xValue, bool bTrigger=false)
 Writes one sample with the sample buffer content of T into the writing stream and mark it as part of the SubStream with ID nSubStreamId. More...
 
void WriteSample (const ucom::ant::iobject_ptr< const streaming::ant::ISample > &pSample)
 Writes the given sample into the writing stream. More...
 
void ManualTrigger (base::flash::tNanoSeconds tmActivationTime=base::flash::tNanoSeconds{-1})
 Sends a manual trigger call into the runner pipe of the. More...
 
void SetRequestCallbacks (std::function< void(uint32_t, const base::IProperties *)> fnRequest, std::function< void(uint32_t)> fnCancel)
 Set the callbacks for the request calls on substreams. More...
 

Protected Member Functions

base::flash::tNanoSeconds GetCurrentStreamTime () const
 Gets the current stream time (if any clock is present within the _runtime singleton). More...
 

Private Attributes

std::unique_ptr< cImplementation > m_pImplementation
 

Detailed Description

Tester helper class to emulate a writing OutPin to InPin connection for sending samples and type to a filters/sample sinks InPin as a stream of samples.

It will be connected to the filters data and trigger pipe.

  • It creates a writing stream of samples and types into the data pipe:
  • [initial_type] [sample] [sample] [sample] [type_change] [sample] [sample] ...
  • It creates the trigger calls for the data triggers on the connected pin.

Definition at line 39 of file test_writer.h.

Constructor & Destructor Documentation

◆ cTestWriter() [1/2]

cTestWriter ( const ucom::ant::iobject_ptr< ucom::ant::IObject > &  pObject,
const char *  strPinName,
const filter::flash::cStreamTypeHelper oType = streaming::stream_meta_type_anonymous() 
)

Construct a new Test Writer object.

Parameters
pObjectthe filter or sample sink
strPinNamethe pin name of the filter or sample sink to write to
oTypethe initialized stream type for the connection (this emulates the stream type on writing side)

◆ cTestWriter() [2/2]

cTestWriter ( const ucom::ant::iobject_ptr< ucom::ant::IObject > &  pObject,
const char *  strPinName,
const filter::flash::cStreamTypeHelper oType,
std::function< void(uint32_t, const base::IProperties *)>  fnRequest,
std::function< void(uint32_t)>  fnCancel 
)

Construct a new Test Writer object.

Parameters
pObjectthe filter or sample sink
strPinNamethe pin name of the filter or sample sink to write to
oTypethe initialized stream type for the connection (this emulates the stream type on writing side)
fnRequestcallback that is invoked while the filter requests a substream
fnCancelcallback that is invoked while the filter cancels/resets the request of a substream

Member Function Documentation

◆ ChangeType()

void ChangeType ( const filter::flash::cStreamTypeHelper oType)

Emulates a stream type change during writing.

Usually this happens if the content for the samples changes.

Parameters
oTypethe new stream type to write into the stream.

◆ GetCurrentStreamTime()

base::flash::tNanoSeconds GetCurrentStreamTime ( ) const
protected

Gets the current stream time (if any clock is present within the _runtime singleton).

Returns
base::flash::tNanoSeconds

Referenced by cTestWriter::Write(), and cTestWriter::WriteSubStream().

◆ ManualTrigger()

void ManualTrigger ( base::flash::tNanoSeconds  tmActivationTime = base::flash::tNanoSeconds{-1})

Sends a manual trigger call into the runner pipe of the.

Parameters
tmActivationTimeThe time for the trigger. (if set to default the current stream time will be used)

Referenced by cTestWriter::WriteSubStream().

◆ SetRequestCallbacks()

void SetRequestCallbacks ( std::function< void(uint32_t, const base::IProperties *)>  fnRequest,
std::function< void(uint32_t)>  fnCancel 
)

Set the callbacks for the request calls on substreams.

Parameters
fnRequestcallback that is invoked while the filter requests a substream
fnCancelcallback that is invoked while the filter cancels/resets the request of a substream

◆ Write() [1/2]

void Write ( base::flash::tNanoSeconds  tmTimeStamp,
const T &  xValue,
bool  bTrigger = false 
)
inline

Writes one sample with the sample buffer content of T into the writing stream.

Template Parameters
Tthe type of the sample buffers content
Parameters
tmTimeStampthe time for the sample
xValuethe value to write to the sample buffer
bTriggerindicates wether a manual trigger will be send or not

Definition at line 88 of file test_writer.h.

◆ Write() [2/2]

void Write ( const T &  xValue,
bool  bTrigger = false 
)
inline

Writes one sample with the sample buffer content of T into the writing stream.

Remarks
The time of the sampel will be the current stream time (if any clock is present within the _runtime singleton)
Template Parameters
Tthe type of the sample buffers content
Parameters
xValuethe value to write to the sample buffer
bTriggerindicates wether a manual trigger will be send or not

Definition at line 103 of file test_writer.h.

References cTestWriter::GetCurrentStreamTime().

◆ WriteSample()

void WriteSample ( const ucom::ant::iobject_ptr< const streaming::ant::ISample > &  pSample)

Writes the given sample into the writing stream.

Parameters
pSamplethe sample to write

Referenced by cTestWriter::WriteSubStream().

◆ WriteSubStream() [1/2]

void WriteSubStream ( uint32_t  nSubStreamId,
base::flash::tNanoSeconds  tmTimeStamp,
const T &  xValue,
bool  bTrigger = false 
)
inline

Writes one sample with the sample buffer content of T into the writing stream and mark it as part of the SubStream with ID nSubStreamId.

Template Parameters
Tthe type of the sample buffers content
Parameters
tmTimeStampthe time for the sample
xValuethe value to write to the sample buffer
bTriggerindicates wether a manual trigger will be send or not

Definition at line 118 of file test_writer.h.

References adtf::streaming::ant::alloc_sample(), cTestWriter::ManualTrigger(), THROW_IF_FAILED, and cTestWriter::WriteSample().

◆ WriteSubStream() [2/2]

void WriteSubStream ( uint32_t  nSubStreamId,
const T &  xValue,
bool  bTrigger = false 
)
inline

Writes one sample with the sample buffer content of T into the writing stream and mark it as part of the SubStream with ID nSubStreamId.

Remarks
The time of the sampel will be the current stream time (if any clock is present within the _runtime singleton)
Template Parameters
Tthe type of the sample buffers content
Parameters
xValuethe value to write to the sample buffer
bTriggerindicates wether a manual trigger will be send or not

Definition at line 152 of file test_writer.h.

References cTestWriter::GetCurrentStreamTime().